From: gmungoc Date: Tue, 7 Nov 2017 13:13:46 +0000 (+0000) Subject: JAL-2069 corrected overloaded constructor behaviour X-Git-Tag: Release_2_11_0~143 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=586870ac526e851e3589fd8880a4a2fc090bbcc3;p=jalview.git JAL-2069 corrected overloaded constructor behaviour --- diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index df4ea39..168ab54 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -389,7 +389,6 @@ public class FeatureColour implements FeatureColourI public FeatureColour(FeatureColour fc, float min, float max) { this(fc); - setGraduatedColour(true); updateBounds(min, max); } diff --git a/test/jalview/schemes/FeatureColourTest.java b/test/jalview/schemes/FeatureColourTest.java index 3f60152..db4fe40 100644 --- a/test/jalview/schemes/FeatureColourTest.java +++ b/test/jalview/schemes/FeatureColourTest.java @@ -183,6 +183,19 @@ public class FeatureColourTest assertTrue((boolean) PA.getValue(fc1, "isHighToLow")); /* + * graduated colour by attribute + */ + fc1.setAttributeName("AF"); + fc1 = new FeatureColour(fc1, 13f, 36f); + assertTrue(fc1.isGraduatedColour()); + assertFalse(fc1.isColourByLabel()); + assertTrue(fc1.isColourByAttribute()); + assertEquals("AF", fc1.getAttributeName()); + assertEquals(13f, fc1.getMin()); + assertEquals(36f, fc1.getMax()); + assertFalse((boolean) PA.getValue(fc1, "isHighToLow")); + + /* * colour by label */ fc = new FeatureColour(Color.BLUE, Color.RED, 1f, 5f); @@ -195,15 +208,27 @@ public class FeatureColourTest assertEquals(5f, fc.getMax()); /* - * update min-max bounds - converts to graduated colour + * update min-max bounds */ fc1 = new FeatureColour(fc, 2f, 6f); - assertTrue(fc1.isGraduatedColour()); - assertFalse(fc1.isColourByLabel()); + assertFalse(fc1.isGraduatedColour()); + assertTrue(fc1.isColourByLabel()); assertFalse(fc1.isColourByAttribute()); assertNull(fc1.getAttributeName()); assertEquals(2f, fc1.getMin()); assertEquals(6f, fc1.getMax()); + + /* + * colour by attribute text + */ + fc1.setAttributeName("AC"); + fc1 = new FeatureColour(fc1, 13f, 36f); + assertFalse(fc1.isGraduatedColour()); + assertTrue(fc1.isColourByLabel()); + assertTrue(fc1.isColourByAttribute()); + assertEquals("AC", fc1.getAttributeName()); + assertEquals(13f, fc1.getMin()); + assertEquals(36f, fc1.getMax()); } @Test(groups = { "Functional" })