From: gmungoc Date: Mon, 11 Mar 2019 08:50:41 +0000 (+0000) Subject: JAL-3206 strict above/below threshold test restored X-Git-Tag: Release_2_11_0~17^2~51 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=7091ed4ecff294623230f96ed93f9a5689ea5938 JAL-3206 strict above/below threshold test restored --- diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index af30689..54eaeb0 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -319,9 +319,9 @@ public class AnnotationColourGradient extends FollowerColourScheme if (annotationThreshold != null) { if ((aboveAnnotationThreshold == ABOVE_THRESHOLD - && aj.value < annotationThreshold.value) + && aj.value <= annotationThreshold.value) || (aboveAnnotationThreshold == BELOW_THRESHOLD - && aj.value > annotationThreshold.value)) + && aj.value >= annotationThreshold.value)) { return Color.white; } diff --git a/test/jalview/schemes/AnnotationColourGradientTest.java b/test/jalview/schemes/AnnotationColourGradientTest.java index be8b58d..22124f7 100644 --- a/test/jalview/schemes/AnnotationColourGradientTest.java +++ b/test/jalview/schemes/AnnotationColourGradientTest.java @@ -214,9 +214,10 @@ public class AnnotationColourGradientTest { Color result = testee.findColour('a', col, seq); /* - * expect white below threshold of 5 + * expect white at or below threshold of 5 */ - Color expected = col < 5 ? Color.white : new Color(50 + 10 * col, + Color expected = col <= 5 ? Color.white + : new Color(50 + 10 * col, 200 - 10 * col, 150 + 10 * col); assertEquals(result, expected, "for column " + col); @@ -230,11 +231,12 @@ public class AnnotationColourGradientTest for (int col = 0; col < WIDTH; col++) { /* - * colours for values >= threshold are graduated + * colours for values > threshold are graduated * range is 6-10 so steps of 100/5 = 20 */ int factor = col - THRESHOLD_FIVE; - Color expected = col < 5 ? Color.white : new Color(50 + 20 * factor, + Color expected = col <= 5 ? Color.white + : new Color(50 + 20 * factor, 200 - 20 * factor, 150 + 20 * factor); Color result = testee.findColour('a', col, seq); @@ -255,7 +257,8 @@ public class AnnotationColourGradientTest for (int col = 0; col < WIDTH; col++) { Color result = testee.findColour('a', col, seq); - Color expected = col > 5 ? Color.white : new Color(50 + 10 * col, + Color expected = col >= 5 ? Color.white + : new Color(50 + 10 * col, 200 - 10 * col, 150 + 10 * col); assertEquals(result, expected, "for column " + col); } @@ -268,10 +271,11 @@ public class AnnotationColourGradientTest for (int col = 0; col < WIDTH; col++) { /* - * colours for values <= threshold are graduated + * colours for values < threshold are graduated * range is 0-5 so steps of 100/5 = 20 */ - Color expected = col > 5 ? Color.white : new Color(50 + 20 * col, + Color expected = col >= 5 ? Color.white + : new Color(50 + 20 * col, 200 - 20 * col, 150 + 20 * col); Color result = testee.findColour('a', col, seq); assertEquals(result, expected, "for column " + col);