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