Merge branch 'develop' into features/JAL-2360colourSchemeApplicability
[jalview.git] / test / jalview / gui / PopupMenuTest.java
index 38c0de3..335240b 100644 (file)
@@ -48,11 +48,20 @@ import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
 import javax.swing.JSeparator;
 
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 public class PopupMenuTest
 {
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
+
   // 4 sequences x 13 positions
   final static String TEST_DATA = ">FER_CAPAA Ferredoxin\n"
           + "TIETHKEAELVG-\n"
@@ -312,7 +321,8 @@ public class PopupMenuTest
 
     assertEquals(4, showOptions.length); // includes 'All' and separator
     assertEquals(4, hideOptions.length);
-    assertEquals("All", ((JMenuItem) showOptions[0]).getText());
+    String all = MessageManager.getString("label.all");
+    assertEquals(all, ((JMenuItem) showOptions[0]).getText());
     assertTrue(showOptions[1] instanceof JPopupMenu.Separator);
     assertEquals(JSeparator.HORIZONTAL,
             ((JSeparator) showOptions[1]).getOrientation());
@@ -322,7 +332,7 @@ public class PopupMenuTest
     assertEquals("SSP", ((JMenuItem) showOptions[3]).getText());
     assertEquals("JPred", ((JMenuItem) showOptions[3]).getToolTipText());
 
-    assertEquals("All", ((JMenuItem) hideOptions[0]).getText());
+    assertEquals(all, ((JMenuItem) hideOptions[0]).getText());
     assertTrue(hideOptions[1] instanceof JPopupMenu.Separator);
     assertEquals(JSeparator.HORIZONTAL,
             ((JSeparator) hideOptions[1]).getOrientation());
@@ -374,12 +384,13 @@ public class PopupMenuTest
 
     assertEquals(2, showOptions.length); // includes 'All' and separator
     assertEquals(4, hideOptions.length);
-    assertEquals("All", ((JMenuItem) showOptions[0]).getText());
+    String all = MessageManager.getString("label.all");
+    assertEquals(all, ((JMenuItem) showOptions[0]).getText());
     assertTrue(showOptions[1] instanceof JPopupMenu.Separator);
     assertEquals(JSeparator.HORIZONTAL,
             ((JSeparator) showOptions[1]).getOrientation());
 
-    assertEquals("All", ((JMenuItem) hideOptions[0]).getText());
+    assertEquals(all, ((JMenuItem) hideOptions[0]).getText());
     assertTrue(hideOptions[1] instanceof JPopupMenu.Separator);
     assertEquals(JSeparator.HORIZONTAL,
             ((JSeparator) hideOptions[1]).getOrientation());
@@ -431,7 +442,8 @@ public class PopupMenuTest
 
     assertEquals(4, showOptions.length); // includes 'All' and separator
     assertEquals(2, hideOptions.length);
-    assertEquals("All", ((JMenuItem) showOptions[0]).getText());
+    String all = MessageManager.getString("label.all");
+    assertEquals(all, ((JMenuItem) showOptions[0]).getText());
     assertTrue(showOptions[1] instanceof JPopupMenu.Separator);
     assertEquals(JSeparator.HORIZONTAL,
             ((JSeparator) showOptions[1]).getOrientation());
@@ -441,7 +453,7 @@ public class PopupMenuTest
     assertEquals("Temp", ((JMenuItem) showOptions[3]).getText());
     assertEquals("PDB2", ((JMenuItem) showOptions[3]).getToolTipText());
 
-    assertEquals("All", ((JMenuItem) hideOptions[0]).getText());
+    assertEquals(all, ((JMenuItem) hideOptions[0]).getText());
     assertTrue(hideOptions[1] instanceof JPopupMenu.Separator);
     assertEquals(JSeparator.HORIZONTAL,
             ((JSeparator) hideOptions[1]).getOrientation());