X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fschemes%2FFeatureColourTest.java;fp=test%2Fjalview%2Fschemes%2FFeatureColourTest.java;h=ed7adb81f3eb495edc7fe7f3a9fdb01176834e8e;hb=6f87303a01399135dc0e673ac41f8fb90991b8de;hp=7a72c1510ad83ab88b49bc037c157e40dd3c385c;hpb=e99b36343ee0362e70cb3055832959ea8e5568bc;p=jalview.git diff --git a/test/jalview/schemes/FeatureColourTest.java b/test/jalview/schemes/FeatureColourTest.java index 7a72c15..ed7adb8 100644 --- a/test/jalview/schemes/FeatureColourTest.java +++ b/test/jalview/schemes/FeatureColourTest.java @@ -340,4 +340,33 @@ public class FeatureColourTest fc = FeatureColour.parseJalviewFeatureColour(descriptor); assertTrue(fc.isGraduatedColour()); } + + @Test(groups = { "Functional" }) + public void testGetColor_colourByLabel_withThreshold() + { + FeatureColour fc = new FeatureColour(); + fc.setColourByLabel(true); + SequenceFeature sf = new SequenceFeature("type", "desc", 0, 20, 1f, + null); + fc.setThreshold(0); + Color expected = ColorUtils.createColourFromName("desc"); + assertEquals(expected, fc.getColor(sf)); + + // score (1f) is above threshold + fc.setAboveThreshold(true); + assertEquals(expected, fc.getColor(sf)); + + // score is not above threshold + fc.setThreshold(2f); + assertNull(fc.getColor(sf)); + + // score is not below threshold + fc.setThreshold(0f); + fc.setBelowThreshold(true); + assertNull(fc.getColor(sf)); + + // score is below threshold + fc.setThreshold(3f); + assertEquals(expected, fc.getColor(sf)); + } }