Class | Line # | Actions | ||||
---|---|---|---|---|---|---|
StrandColourSchemeTest | 9 | 8 | 1 | 0 |
1 | package jalview.schemes; | |
2 | ||
3 | import static org.testng.Assert.assertEquals; | |
4 | ||
5 | import java.awt.Color; | |
6 | ||
7 | import org.testng.annotations.Test; | |
8 | ||
9 | public class StrandColourSchemeTest | |
10 | { | |
11 | /** | |
12 | * Turn colours are based on the scores in ResidueProperties.strand A = 0.83, | |
13 | * R = 0.93, N = 0.89, D = 0.54... min = 0.37 max = 1.7 | |
14 | * <p> | |
15 | * scores are scaled to c 0-1 between min and max and colour is (c, c, 1-c) | |
16 | */ | |
17 | 1 | @Test(groups = "Functional") |
18 | public void testFindColour() | |
19 | { | |
20 | 1 | ScoreColourScheme scheme = new StrandColourScheme(); |
21 | ||
22 | 1 | float min = 0.37f; |
23 | 1 | float max = 1.7f; |
24 | 1 | float a = (0.83f - min) / (max - min); |
25 | 1 | assertEquals(scheme.findColour('A', 0, null), |
26 | new Color(a, a, 1 - a)); | |
27 | ||
28 | 1 | float d = (0.54f - min) / (max - min); |
29 | 1 | assertEquals(scheme.findColour('D', 0, null), |
30 | new Color(d, d, 1 - d)); | |
31 | ||
32 | 1 | assertEquals(scheme.findColour('-', 0, null), Color.WHITE); |
33 | } | |
34 | ||
35 | } |