From 6392be9d3e1f92a30138fd4ee4989a7a8eb5d4c2 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 24 Oct 2016 10:18:53 +0100 Subject: [PATCH] JAL-2283 set 'by conservation' correctly when changing colour schem --- src/jalview/viewmodel/AlignmentViewport.java | 3 ++- test/jalview/gui/AlignViewportTest.java | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 3a92e4b..c1c88c1 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -612,7 +612,7 @@ public abstract class AlignmentViewport implements AlignViewportI, boolean recalc = false; if (cs != null) { - cs.setConservationApplied(recalc = getConservationSelected()); + recalc = getConservationSelected(); if (getAbovePIDThreshold() || cs instanceof PIDColourScheme || cs instanceof Blosum62ColourScheme) { @@ -629,6 +629,7 @@ public abstract class AlignmentViewport implements AlignViewportI, cs.setConsensus(hconsensus); cs.setConservation(hconservation); } + cs.setConservationApplied(getConservationSelected()); cs.alignmentChanged(alignment, hiddenRepSequences); } if (getColourAppliesToAllGroups()) diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 341a814..d7b26b0 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -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; @@ -329,4 +331,22 @@ 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("SHOW_ANNOTATIONS", + Boolean.TRUE.toString()); + Cache.applicationProperties.setProperty("SHOW_CONSERVATION", + Boolean.FALSE.toString()); + Cache.applicationProperties.setProperty("DEFAULT_COLOUR_PROT", "NONE"); + AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( + "examples/uniref50.fa", FormatAdapter.FILE); + ColourSchemeI cs = new PIDColourScheme(); + af.getViewport().setGlobalColourScheme(cs); + assertFalse(cs.conservationApplied()); + } } -- 1.7.10.2