Merge branch 'Jalview-JS/jim/JAL-3253-JAL-3418' into Jalview-JS/JAL-3253-applet
[jalview.git] / test / jalview / gui / PopupMenuTest.java
index e04be68..e42c34c 100644 (file)
@@ -196,8 +196,12 @@ public class PopupMenuTest
     testee.configureReferenceAnnotationsMenu(menu, seqs);
     assertTrue(menu.isEnabled());
     String s = MessageManager.getString("label.add_annotations_for");
-    String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
-            + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+    // String expected = "<html><style> p.ttip {width: 350; text-align: justify;
+    // word-wrap: break-word;}</style><p class=\"ttip\">"
+    // + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+    String expected = "<html><style> div.ttip {width:350px;white-space:pre-wrap;padding:2px;overflow-wrap:break-word;}</style>"
+            + "<div class=\"ttip\">" + s
+            + "<br/>Jmol/secondary structure<br/>PDB/Temp </div></html>";
     assertEquals(expected, menu.getToolTipText());
   }
 
@@ -219,8 +223,11 @@ public class PopupMenuTest
     testee.configureReferenceAnnotationsMenu(menu, seqs);
     assertTrue(menu.isEnabled());
     String s = MessageManager.getString("label.add_annotations_for");
-    String expected = "<html><style> p.ttip {width: 350; text-align: justify; word-wrap: break-word;}</style><p class=\"ttip\">"
-            + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+    // String expected = "<html><style> p.ttip {width: 350; text-align: justify;
+    // word-wrap: break-word;}</style><p class=\"ttip\">"
+    // + s + "<br/>Jmol/secondary structure<br/>PDB/Temp</p></html>";
+    String expected = "<html><style> div.ttip {width:350px;white-space:pre-wrap;padding:2px;overflow-wrap:break-word;}</style>"
+            + "<div class=\"ttip\">Add annotations for<br/>Jmol/secondary structure<br/>PDB/Temp </div></html>";
     assertEquals(expected, menu.getToolTipText());
   }
 
@@ -492,7 +499,7 @@ public class PopupMenuTest
    * Test for adding sequence id, dbref and feature links
    */
   @Test(groups = { "Functional" })
-  public void testConstructor_links()
+  public void testBuildLinkMenu()
   {
     List<SequenceI> seqs = parentPanel.getAlignment().getSequences();
     final SequenceI seq0 = seqs.get(0);
@@ -509,11 +516,9 @@ public class PopupMenuTest
     seq1.addDBRef(new DBRefEntry("GENE3D", "1", "3.10.20.30"));
     
     /*
-     * check the Popup Menu for the first sequence
+     * check the Link Menu for the first sequence
      */
-    testee = new PopupMenu(parentPanel, seq0, noFeatures);
-    Component[] seqItems = testee.sequenceMenu.getMenuComponents();
-    JMenu linkMenu = (JMenu) seqItems[6];
+    JMenu linkMenu = PopupMenu.buildLinkMenu(seq0, noFeatures);
     assertEquals(linkText, linkMenu.getText());
     Component[] linkItems = linkMenu.getMenuComponents();
     
@@ -532,12 +537,10 @@ public class PopupMenuTest
     assertEquals("UNIPROT|P83527", ((JMenuItem) linkItems[4]).getText());
 
     /*
-     * check the Popup Menu for second sequence
+     * check the Link Menu for the second sequence
      * note dbref GENE3D is matched to link Gene3D, the latter is displayed
      */
-    testee = new PopupMenu(parentPanel, seq1, noFeatures);
-    seqItems = testee.sequenceMenu.getMenuComponents();
-    linkMenu = (JMenu) seqItems[6];
+    linkMenu = PopupMenu.buildLinkMenu(seq1, noFeatures);
     assertEquals(linkText, linkMenu.getText());
     linkItems = linkMenu.getMenuComponents();
     assertEquals(3, linkItems.length);
@@ -556,9 +559,7 @@ public class PopupMenuTest
             unmatched, "");
     Preferences.sequenceUrlLinks = factory.createUrlProvider();
 
-    testee = new PopupMenu(parentPanel, seq1, noFeatures);
-    seqItems = testee.sequenceMenu.getMenuComponents();
-    linkMenu = (JMenu) seqItems[6];
+    linkMenu = PopupMenu.buildLinkMenu(seq1, noFeatures);
     assertEquals(linkText, linkMenu.getText());
     linkItems = linkMenu.getMenuComponents();
     assertEquals(1, linkItems.length);