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 |
|
import static org.testng.Assert.assertNull; |
25 |
|
import static org.testng.Assert.assertTrue; |
26 |
|
|
27 |
|
import jalview.datamodel.Alignment; |
28 |
|
import jalview.datamodel.AlignmentI; |
29 |
|
import jalview.datamodel.Sequence; |
30 |
|
import jalview.datamodel.SequenceI; |
31 |
|
|
32 |
|
import java.awt.Color; |
33 |
|
|
34 |
|
import org.testng.annotations.Test; |
35 |
|
|
|
|
| 0% |
Uncovered Elements: 91 (91) |
Complexity: 2 |
Complexity Density: 0.02 |
|
36 |
|
public class ColourSchemePropertyTest |
37 |
|
{ |
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 1 |
Complexity Density: 0.02 |
4-
|
|
38 |
0 |
@Test(groups = "Functional")... |
39 |
|
public void testGetColourName() |
40 |
|
{ |
41 |
0 |
SequenceI seq = new Sequence("Seq1", "abcd"); |
42 |
0 |
AlignmentI al = new Alignment(new SequenceI[] { seq }); |
43 |
0 |
ColourSchemeI cs = new ClustalxColourScheme(al, null); |
44 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Clustal"); |
45 |
0 |
cs = new Blosum62ColourScheme(); |
46 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Blosum62"); |
47 |
0 |
cs = new PIDColourScheme(); |
48 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "% Identity"); |
49 |
0 |
cs = new HydrophobicColourScheme(); |
50 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Hydrophobic"); |
51 |
0 |
cs = new ZappoColourScheme(); |
52 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Zappo"); |
53 |
0 |
cs = new TaylorColourScheme(); |
54 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Taylor"); |
55 |
0 |
cs = new HelixColourScheme(); |
56 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), |
57 |
|
"Helix Propensity"); |
58 |
0 |
cs = new StrandColourScheme(); |
59 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), |
60 |
|
"Strand Propensity"); |
61 |
0 |
cs = new TurnColourScheme(); |
62 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Turn Propensity"); |
63 |
0 |
cs = new BuriedColourScheme(); |
64 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Buried Index"); |
65 |
0 |
cs = new NucleotideColourScheme(); |
66 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "Nucleotide"); |
67 |
0 |
cs = new PurinePyrimidineColourScheme(); |
68 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), |
69 |
|
"Purine/Pyrimidine"); |
70 |
0 |
cs = new TCoffeeColourScheme(al); |
71 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "T-Coffee Scores"); |
72 |
0 |
cs = new RNAHelicesColour(al); |
73 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "RNA Helices"); |
74 |
0 |
cs = new RNAInteractionColourScheme(); |
75 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), |
76 |
|
"RNA Interaction type"); |
77 |
0 |
cs = new UserColourScheme(); |
78 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "User Defined"); |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
0 |
((UserColourScheme) cs).setName("stripy"); |
84 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "stripy"); |
85 |
0 |
((UserColourScheme) cs).setName(""); |
86 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "User Defined"); |
87 |
0 |
((UserColourScheme) cs).setName(null); |
88 |
0 |
assertEquals(ColourSchemeProperty.getColourName(cs), "User Defined"); |
89 |
|
|
90 |
0 |
assertEquals(ColourSchemeProperty.getColourName(null), "None"); |
91 |
|
} |
92 |
|
|
|
|
| 0% |
Uncovered Elements: 48 (48) |
Complexity: 1 |
Complexity Density: 0.02 |
4-
|
|
93 |
0 |
@Test(groups = "Functional")... |
94 |
|
public void testGetColourScheme() |
95 |
|
{ |
96 |
0 |
SequenceI seq = new Sequence("Seq1", "abcd"); |
97 |
0 |
AlignmentI al = new Alignment(new SequenceI[] { seq }); |
98 |
|
|
99 |
0 |
ColourSchemeI cs = ColourSchemeProperty.getColourScheme(null, al, |
100 |
|
"Clustal"); |
101 |
0 |
assertTrue(cs instanceof ClustalxColourScheme); |
102 |
|
|
103 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "CLUSTAL"); |
104 |
0 |
assertTrue(cs instanceof ClustalxColourScheme); |
105 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "clustal"); |
106 |
0 |
assertTrue(cs instanceof ClustalxColourScheme); |
107 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Blosum62"); |
108 |
0 |
assertTrue(cs instanceof Blosum62ColourScheme); |
109 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "% Identity"); |
110 |
0 |
assertTrue(cs instanceof PIDColourScheme); |
111 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Zappo"); |
112 |
0 |
assertTrue(cs instanceof ZappoColourScheme); |
113 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Taylor"); |
114 |
0 |
assertTrue(cs instanceof TaylorColourScheme); |
115 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Hydrophobic"); |
116 |
0 |
assertTrue(cs instanceof HydrophobicColourScheme); |
117 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Helix Propensity"); |
118 |
0 |
assertTrue(cs instanceof HelixColourScheme); |
119 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, |
120 |
|
"Strand Propensity"); |
121 |
0 |
assertTrue(cs instanceof StrandColourScheme); |
122 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Turn Propensity"); |
123 |
0 |
assertTrue(cs instanceof TurnColourScheme); |
124 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Buried Index"); |
125 |
0 |
assertTrue(cs instanceof BuriedColourScheme); |
126 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "Nucleotide"); |
127 |
0 |
assertTrue(cs instanceof NucleotideColourScheme); |
128 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, |
129 |
|
"Purine/Pyrimidine"); |
130 |
0 |
assertTrue(cs instanceof PurinePyrimidineColourScheme); |
131 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "T-Coffee Scores"); |
132 |
0 |
assertTrue(cs instanceof TCoffeeColourScheme); |
133 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "RNA Helices"); |
134 |
0 |
assertTrue(cs instanceof RNAHelicesColour); |
135 |
|
|
136 |
0 |
assertNull(ColourSchemeProperty.getColourScheme(null, al, "None")); |
137 |
0 |
assertNull(ColourSchemeProperty.getColourScheme(null, al, "none")); |
138 |
|
|
139 |
0 |
cs = ColourSchemeProperty.getColourScheme(null, al, "elephants"); |
140 |
0 |
assertTrue(cs instanceof UserColourScheme); |
141 |
|
|
142 |
|
|
143 |
|
|
144 |
|
|
145 |
0 |
UserColourScheme ucs = (UserColourScheme) ColourSchemeProperty |
146 |
|
.getColourScheme(null, al, |
147 |
|
"R,G=red;C=blue;c=green;Q=10,20,30;S,T=11ffdd"); |
148 |
0 |
assertEquals(ucs.findColour('H'), Color.white); |
149 |
0 |
assertEquals(ucs.findColour('R'), Color.red); |
150 |
0 |
assertEquals(ucs.findColour('r'), Color.red); |
151 |
0 |
assertEquals(ucs.findColour('G'), Color.red); |
152 |
0 |
assertEquals(ucs.findColour('C'), Color.blue); |
153 |
0 |
assertEquals(ucs.findColour('c'), Color.green); |
154 |
0 |
assertEquals(ucs.findColour('Q'), new Color(10, 20, 30)); |
155 |
0 |
assertEquals(ucs.findColour('S'), new Color(0x11ffdd)); |
156 |
0 |
assertEquals(ucs.findColour('T'), new Color(0x11ffdd)); |
157 |
|
} |
158 |
|
} |