JAL-2326 added setup method for JvOptionPane in all Jalveiw test classes to enable...
[jalview.git] / test / jalview / gui / AnnotationChooserTest.java
index 1cd8efa..e742977 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.gui;
 
 import static org.testng.AssertJUnit.assertEquals;
@@ -26,6 +46,7 @@ import java.util.List;
 import javax.swing.JButton;
 import javax.swing.JPanel;
 
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -37,6 +58,14 @@ import org.testng.annotations.Test;
  */
 public class AnnotationChooserTest
 {
+
+  @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"
@@ -55,15 +84,16 @@ public class AnnotationChooserTest
   @BeforeMethod(alwaysRun = true)
   public void setUp() throws IOException
   {
+    Cache.loadProperties("test/jalview/io/testProps.jvprops");
     // pin down annotation sort order for test
     Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS,
             SequenceAnnotationOrder.NONE.name());
-    final String True = Boolean.TRUE.toString();
+    final String TRUE = Boolean.TRUE.toString();
     Cache.applicationProperties.setProperty(
-            Preferences.SHOW_AUTOCALC_ABOVE, True);
-    Cache.applicationProperties.setProperty("SHOW_QUALITY", True);
-    Cache.applicationProperties.setProperty("SHOW_CONSERVATION", True);
-    Cache.applicationProperties.setProperty("SHOW_IDENTITY", True);
+            Preferences.SHOW_AUTOCALC_ABOVE, TRUE);
+    Cache.applicationProperties.setProperty("SHOW_QUALITY", TRUE);
+    Cache.applicationProperties.setProperty("SHOW_CONSERVATION", TRUE);
+    Cache.applicationProperties.setProperty("SHOW_IDENTITY", TRUE);
 
     AlignmentI al = new jalview.io.FormatAdapter().readFile(TEST_DATA,
             AppletFormatAdapter.PASTE, "FASTA");
@@ -739,6 +769,9 @@ public class AnnotationChooserTest
       assertTrue(i + "'th sequence not visible", anns[i].visible);
     }
 
+    /*
+     * check options to hide JMol and IUPRED annotations for all sequences
+     */
     final Checkbox hideCheckbox = (Checkbox) getComponent(testee, 1, 0, 1);
     setSelected(hideCheckbox, true);
 
@@ -752,8 +785,8 @@ public class AnnotationChooserTest
     assertTrue(anns[0].visible); // Conservation
     assertTrue(anns[1].visible); // Quality
     assertTrue(anns[2].visible); // Consensus
-    assertTrue(anns[3].visible); // Beauty (not seq-related)
-    assertFalse(anns[4].visible); // IUPRED
+    assertFalse(anns[3].visible); // IUPRED
+    assertTrue(anns[4].visible); // Beauty (not seq-related)
     assertFalse(anns[5].visible); // JMol
     assertFalse(anns[6].visible); // IUPRED
     assertFalse(anns[7].visible); // JMol