JAL-2283 corrected preferences settings for test
[jalview.git] / test / jalview / gui / AlignViewportTest.java
index bbad963..00c52ed 100644 (file)
@@ -39,6 +39,8 @@ import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
 import jalview.io.FileLoader;
 import jalview.io.FormatAdapter;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.PIDColourScheme;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.MapList;
 
@@ -300,7 +302,7 @@ public class AlignViewportTest
     assertTrue(ssmMappings.contains(acf2));
     assertFalse(ssmMappings.contains(acf3));
   }
-  
+
   /**
    * Test for JAL-1306 - conservation thread should run even when only Quality
    * (and not Conservation) is enabled in Preferences
@@ -318,7 +320,8 @@ public class AlignViewportTest
             Boolean.FALSE.toString());
     AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", FormatAdapter.FILE);
-    AlignmentAnnotation[] anns = af.viewport.getAlignment().getAlignmentAnnotation();
+    AlignmentAnnotation[] anns = af.viewport.getAlignment()
+            .getAlignmentAnnotation();
     assertNotNull("No annotations found", anns);
     assertEquals("More than one annotation found", 1, anns.length);
     assertTrue("Annotation is not Quality",
@@ -328,4 +331,20 @@ public class AlignViewportTest
     assertNotNull("Quality in column 1 is null", annotations[0]);
     assertTrue("No quality value in column 1", annotations[0].value > 10f);
   }
+
+  @Test(groups = { "Functional" })
+  public void testSetGlobalColourScheme()
+  {
+    /*
+     * test for JAL-2283 don't inadvertently turn on colour by conservation
+     */
+    Cache.applicationProperties.setProperty("DEFAULT_COLOUR_PROT", "NONE");
+    Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
+            Boolean.TRUE.toString());
+    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+            "examples/uniref50.fa", FormatAdapter.FILE);
+    ColourSchemeI cs = new PIDColourScheme();
+    af.getViewport().setGlobalColourScheme(cs);
+    assertFalse(cs.conservationApplied());
+  }
 }