X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fschemes%2FAnnotationColourGradientTest.java;fp=test%2Fjalview%2Fschemes%2FAnnotationColourGradientTest.java;h=35e3c2fd14b7797cc6abbfa7f20f13122d3ae10c;hb=c0501eaa85c0594f9275766f64de8ea44a59c368;hp=c56da593d97236e67b67a2d1b9191e10732356ef;hpb=304e64fb34b32659be1bbfd39fb4e15b2f79586e;p=jalview.git diff --git a/test/jalview/schemes/AnnotationColourGradientTest.java b/test/jalview/schemes/AnnotationColourGradientTest.java index c56da59..35e3c2f 100644 --- a/test/jalview/schemes/AnnotationColourGradientTest.java +++ b/test/jalview/schemes/AnnotationColourGradientTest.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.schemes; import static org.testng.Assert.assertEquals; @@ -50,8 +70,8 @@ public class AnnotationColourGradientTest } seq = new Sequence("Seq", ""); - al = new Alignment(new SequenceI[]{ seq}); - + al = new Alignment(new SequenceI[] { seq }); + /* * AlignmentAnnotation constructor works out min-max range */ @@ -217,12 +237,10 @@ public class AnnotationColourGradientTest * expect white at or below threshold of 5 */ Color expected = col <= 5 ? Color.white - : new Color(50 + 10 * col, - 200 - 10 * col, - 150 + 10 * col); + : new Color(50 + 10 * col, 200 - 10 * col, 150 + 10 * col); assertEquals(result, expected, "for column " + col); } - + /* * now make 6-10 the span of the colour range * (annotation value == column number in this test) @@ -236,9 +254,8 @@ public class AnnotationColourGradientTest */ int factor = col - THRESHOLD_FIVE; Color expected = col <= 5 ? Color.white - : new Color(50 + 20 * factor, - 200 - 20 * factor, - 150 + 20 * factor); + : new Color(50 + 20 * factor, 200 - 20 * factor, + 150 + 20 * factor); Color result = testee.findColour('a', col, seq); assertEquals(result, expected, "for column " + col); } @@ -253,16 +270,15 @@ public class AnnotationColourGradientTest AnnotationColourGradient testee = new AnnotationColourGradient(ann, minColour, maxColour, AnnotationColourGradient.BELOW_THRESHOLD); testee = (AnnotationColourGradient) testee.getInstance(null, al); - + 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, - 200 - 10 * col, 150 + 10 * col); + : new Color(50 + 10 * col, 200 - 10 * col, 150 + 10 * col); assertEquals(result, expected, "for column " + col); } - + /* * now make 0-5 the span of the colour range * (annotation value == column number in this test) @@ -275,8 +291,7 @@ public class AnnotationColourGradientTest * range is 0-5 so steps of 100/5 = 20 */ Color expected = col >= 5 ? Color.white - : new Color(50 + 20 * col, - 200 - 20 * col, 150 + 20 * col); + : new Color(50 + 20 * col, 200 - 20 * col, 150 + 20 * col); Color result = testee.findColour('a', col, seq); assertEquals(result, expected, "for column " + col); } @@ -322,7 +337,8 @@ public class AnnotationColourGradientTest { int hue = col * 20; Color c = col == 0 ? minColour : new Color(hue, hue, hue); - assertEquals(testee.findColour('a', col, seq), c, "for column " + col); + assertEquals(testee.findColour('a', col, seq), c, + "for column " + col); } } }