JAL-3253-applet JAL-3423 TestNG/Win
[jalview.git] / test / jalview / gui / PopupMenuTest.java
index e04be68..e9b6e54 100644 (file)
@@ -196,8 +196,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 = JvSwingUtils.HTML_PREFIX + s
+            + "<br/>Jmol/secondary structure<br/>PDB/Temp</div></html>";
     assertEquals(expected, menu.getToolTipText());
   }
 
@@ -219,8 +222,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 = JvSwingUtils.HTML_PREFIX
+            + "Add annotations for<br/>Jmol/secondary structure<br/>PDB/Temp</div></html>";
     assertEquals(expected, menu.getToolTipText());
   }
 
@@ -492,7 +498,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 +515,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 +536,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 +558,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);