1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.schemes; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
|
25 |
|
import java.awt.Color; |
26 |
|
|
27 |
|
import org.testng.annotations.Test; |
28 |
|
|
29 |
|
import jalview.datamodel.SequenceI; |
30 |
|
import jalview.gui.AlignFrame; |
31 |
|
import jalview.gui.AlignViewport; |
32 |
|
import jalview.io.DataSourceType; |
33 |
|
import jalview.io.FileLoader; |
34 |
|
|
|
|
| 96.8% |
Uncovered Elements: 1 (31) |
Complexity: 4 |
Complexity Density: 0.15 |
|
35 |
|
public class PIDColourSchemeTest |
36 |
|
{ |
37 |
|
static final Color white = Color.white; |
38 |
|
|
39 |
|
static final Color over40 = new Color(204, 204, 255); |
40 |
|
|
41 |
|
static final Color over60 = new Color(153, 153, 255); |
42 |
|
|
43 |
|
static final Color over80 = new Color(100, 100, 255); |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
58 |
1 |
@Test(groups = "Functional")... |
59 |
|
public void testFindColour() |
60 |
|
{ |
61 |
1 |
ColourSchemeI scheme = new PIDColourScheme(); |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 0f), white); |
68 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 40f), white); |
69 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 40.1f), over40); |
70 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 60f), over40); |
71 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 60.1f), over60); |
72 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 80f), over60); |
73 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 80.1f), over80); |
74 |
1 |
assertEquals(scheme.findColour('A', 0, null, "A", 100f), over80); |
75 |
1 |
assertEquals(scheme.findColour('A', 0, null, "KFV", 100f), white); |
76 |
|
|
77 |
1 |
assertEquals(scheme.findColour('a', 0, null, "A", 80f), over60); |
78 |
1 |
assertEquals(scheme.findColour('A', 0, null, "AC", 80f), over60); |
79 |
1 |
assertEquals(scheme.findColour('A', 0, null, "KCA", 80f), over60); |
80 |
|
} |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
|
|
| 93.8% |
Uncovered Elements: 1 (16) |
Complexity: 3 |
Complexity Density: 0.21 |
1PASS
|
|
87 |
1 |
@Test(groups = "Functional")... |
88 |
|
public void testFindColour_ignoreGaps() |
89 |
|
{ |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
1 |
String seqs = ">seq1\nAAAAA\n>seq2\nAAAAA\n>seq3\n-CCCC\n>seq4\nFFFFF\n"; |
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
104 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(seqs, |
105 |
|
DataSourceType.PASTE); |
106 |
1 |
AlignViewport viewport = af.getViewport(); |
107 |
1 |
viewport.setIgnoreGapsConsensus(false, af.alignPanel); |
108 |
1 |
do |
109 |
|
{ |
110 |
1 |
try |
111 |
|
{ |
112 |
1 |
Thread.sleep(50); |
113 |
|
} catch (InterruptedException x) |
114 |
|
{ |
115 |
|
} |
116 |
1 |
} while (af.getViewport().getCalcManager().isWorking()); |
117 |
1 |
af.changeColour_actionPerformed(JalviewColourScheme.PID.toString()); |
118 |
|
|
119 |
1 |
SequenceI seq = viewport.getAlignment().getSequenceAt(0); |
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
1 |
Color c = viewport.getResidueShading().findColour('A', 0, seq); |
125 |
1 |
assertEquals(c, over40); |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
1 |
viewport.setIgnoreGapsConsensus(true, af.alignPanel); |
131 |
1 |
c = viewport.getResidueShading().findColour('A', 0, seq); |
132 |
1 |
assertEquals(c, over60); |
133 |
|
} |
134 |
|
} |