JAL-3878 update branch from 2.12 merge from 2.11.2
[jalview.git] / test / jalview / gui / AnnotationChooserTest.java
index f3c0dee..f0c4632 100644 (file)
@@ -88,14 +88,14 @@ public class AnnotationChooserTest
   {
     Cache.loadProperties("test/jalview/io/testProps.jvprops");
     // pin down annotation sort order for test
-    Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS,
+    Cache.setPropertyNoSave(Preferences.SORT_ANNOTATIONS,
             SequenceAnnotationOrder.NONE.name());
     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);
+    Cache.setPropertyNoSave(
+            Preferences.SHOW_AUTOCALC_ABOVE, TRUE);
+    Cache.setPropertyNoSave("SHOW_QUALITY", TRUE);
+    Cache.setPropertyNoSave("SHOW_CONSERVATION", TRUE);
+    Cache.setPropertyNoSave("SHOW_IDENTITY", TRUE);
 
     AlignmentI al = new FormatAdapter().readFile(TEST_DATA,
             DataSourceType.PASTE, FileFormat.Fasta);
@@ -108,9 +108,11 @@ public class AnnotationChooserTest
    * Add 4 annotations, 3 of them sequence-specific.
    * 
    * <PRE>
-   * ann1 - for sequence 0 - label 'IUPRED' ann2 - not sequence related - label
-   * 'Beauty' ann3 - for sequence 3 - label 'JMol' ann4 - for sequence 2 - label
-   * 'IUPRED' ann5 - for sequence 1 - label 'JMol'
+   * ann1 - for sequence 0 - label 'IUPRED' 
+   * ann2 - not sequence related - label 'Beauty' 
+   * ann3 - for sequence 3 - label 'JMol'
+   * ann4 - for sequence 2 - label 'IUPRED'
+   * ann5 - for sequence 1 - label 'JMol'
    */
   private void addAnnotations()
   {
@@ -182,8 +184,8 @@ public class AnnotationChooserTest
     assertTrue("Not enabled", cb1.isEnabled());
     assertTrue("Not enabled", cb2.isEnabled());
     assertTrue("Not enabled", cb3.isEnabled());
-    assertEquals("Option not selected", cb2,
-            cb2.getCheckboxGroup().getSelectedCheckbox());
+    assertEquals("Option not selected", cb2, cb2.getCheckboxGroup()
+            .getSelectedCheckbox());
 
     // check state variables match checkbox selection
     assertTrue(testee.isApplyToSelectedSequences());
@@ -233,16 +235,15 @@ public class AnnotationChooserTest
     assertTrue("Not enabled", cb1.isEnabled());
     assertFalse("Enabled", cb2.isEnabled());
     assertFalse("Enabled", cb3.isEnabled());
-    assertEquals("Not selected", cb1,
-            cb1.getCheckboxGroup().getSelectedCheckbox());
+    assertEquals("Not selected", cb1, cb1.getCheckboxGroup()
+            .getSelectedCheckbox());
 
     // check state variables match checkbox selection
     assertTrue(testee.isApplyToSelectedSequences());
     assertTrue(testee.isApplyToUnselectedSequences());
 
     assertEquals("Wrong text",
-            MessageManager.getString("label.all_sequences"),
-            cb1.getLabel());
+            MessageManager.getString("label.all_sequences"), cb1.getLabel());
     assertEquals("Wrong text",
             MessageManager.getString("label.selected_sequences"),
             cb2.getLabel());
@@ -276,8 +277,8 @@ public class AnnotationChooserTest
     assertTrue("Hide not enabled", cb2.isEnabled());
 
     // Hide (button 2) selected; note this may change to none (null)
-    assertEquals("Not selected", cb2,
-            cb2.getCheckboxGroup().getSelectedCheckbox());
+    assertEquals("Not selected", cb2, cb2.getCheckboxGroup()
+            .getSelectedCheckbox());
 
     assertTrue("Show is flagged", !testee.isShowSelected());
 
@@ -317,14 +318,14 @@ public class AnnotationChooserTest
     // selection group should make no difference to the result
     // as all annotation types for the alignment are considered
 
-    List<String> types = AnnotationChooser
-            .getAnnotationTypes(parentPanel.getAlignment(), true);
+    List<String> types = AnnotationChooser.getAnnotationTypes(
+            parentPanel.getAlignment(), true);
     assertEquals("Not two annotation types", 2, types.size());
     assertTrue("IUPRED missing", types.contains("IUPRED"));
     assertTrue("JMol missing", types.contains("JMol"));
 
-    types = AnnotationChooser.getAnnotationTypes(parentPanel.getAlignment(),
-            false);
+    types = AnnotationChooser.getAnnotationTypes(
+            parentPanel.getAlignment(), false);
     assertEquals("Not six annotation types", 7, types.size());
     assertTrue("IUPRED missing", types.contains("IUPRED"));
     assertTrue("JMol missing", types.contains("JMol"));
@@ -350,8 +351,8 @@ public class AnnotationChooserTest
     final Checkbox hideCheckbox = (Checkbox) getComponent(testee, 1, 0, 1);
     setSelected(hideCheckbox, true);
 
-    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee, 1,
-            1, 0);
+    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee,
+            1, 1, 0);
     setSelected(allSequencesCheckbox, true);
 
     AlignmentAnnotation[] anns = parentPanel.getAlignment()
@@ -428,8 +429,8 @@ public class AnnotationChooserTest
     final Checkbox hideCheckbox = (Checkbox) getComponent(testee, 1, 0, 1);
     setSelected(hideCheckbox, true);
 
-    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee, 1,
-            1, 0);
+    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee,
+            1, 1, 0);
     setSelected(allSequencesCheckbox, true);
 
     AlignmentAnnotation[] anns = parentPanel.getAlignment()
@@ -520,8 +521,8 @@ public class AnnotationChooserTest
     final Checkbox showCheckbox = (Checkbox) getComponent(testee, 1, 0, 0);
     final Checkbox hideCheckbox = (Checkbox) getComponent(testee, 1, 0, 1);
 
-    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee, 1,
-            1, 0);
+    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee,
+            1, 1, 0);
 
     AlignmentAnnotation[] anns = parentPanel.getAlignment()
             .getAlignmentAnnotation();
@@ -596,8 +597,8 @@ public class AnnotationChooserTest
     final Checkbox showCheckbox = (Checkbox) getComponent(testee, 1, 0, 0);
     setSelected(showCheckbox, true);
 
-    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee, 1,
-            1, 0);
+    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee,
+            1, 1, 0);
     setSelected(allSequencesCheckbox, true);
 
     AlignmentAnnotation[] anns = parentPanel.getAlignment()
@@ -696,9 +697,9 @@ public class AnnotationChooserTest
     // TODO refactor to a test utility class
     cb.setState(select);
     // have to manually fire the action listener
-    cb.getItemListeners()[0].itemStateChanged(
-            new ItemEvent(cb, ItemEvent.ITEM_STATE_CHANGED, cb,
-                    select ? ItemEvent.SELECTED : ItemEvent.DESELECTED));
+    cb.getItemListeners()[0].itemStateChanged(new ItemEvent(cb,
+            ItemEvent.ITEM_STATE_CHANGED, cb, select ? ItemEvent.SELECTED
+                    : ItemEvent.DESELECTED));
   }
 
   /**
@@ -795,8 +796,8 @@ public class AnnotationChooserTest
     final Checkbox hideCheckbox = (Checkbox) getComponent(testee, 1, 0, 1);
     setSelected(hideCheckbox, true);
 
-    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee, 1,
-            1, 0);
+    final Checkbox allSequencesCheckbox = (Checkbox) getComponent(testee,
+            1, 1, 0);
     setSelected(allSequencesCheckbox, true);
 
     setSelected(getTypeCheckbox("JMol"), true);