1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
|
25 |
|
import jalview.bin.Jalview; |
26 |
|
import jalview.datamodel.Alignment; |
27 |
|
import jalview.datamodel.AlignmentI; |
28 |
|
import jalview.datamodel.Sequence; |
29 |
|
import jalview.datamodel.SequenceGroup; |
30 |
|
import jalview.datamodel.SequenceI; |
31 |
|
import jalview.renderer.ResidueShader; |
32 |
|
import jalview.renderer.ResidueShaderI; |
33 |
|
import jalview.schemes.ZappoColourScheme; |
34 |
|
|
35 |
|
import java.awt.Color; |
36 |
|
|
37 |
|
import org.testng.annotations.BeforeClass; |
38 |
|
import org.testng.annotations.BeforeMethod; |
39 |
|
import org.testng.annotations.Test; |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 3 |
Complexity Density: 0.16 |
|
41 |
|
public class SequenceRendererTest |
42 |
|
{ |
43 |
|
AlignmentI al; |
44 |
|
|
45 |
|
AlignViewport av; |
46 |
|
|
47 |
|
SequenceI seq1; |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
1 |
@BeforeClass(alwaysRun = true)... |
50 |
|
public static void setUpBeforeClass() throws Exception |
51 |
|
{ |
52 |
1 |
Jalview.main( |
53 |
|
new String[] |
54 |
|
{ "--nonews", "--props", "test/jalview/testProps.jvprops" }); |
55 |
|
} |
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
57 |
1 |
@BeforeMethod(alwaysRun = true)... |
58 |
|
public void setUp() |
59 |
|
{ |
60 |
1 |
seq1 = new Sequence("Seq1", "ABCEEEABCABC"); |
61 |
1 |
SequenceI seq2 = new Sequence("Seq2", "ABCABCABCABC"); |
62 |
1 |
SequenceI seq3 = new Sequence("Seq3", "ABCABCABCABC"); |
63 |
1 |
SequenceI[] seqs = new SequenceI[] { seq1, seq2, seq3 }; |
64 |
1 |
al = new Alignment(seqs); |
65 |
1 |
al.setDataset(null); |
66 |
1 |
av = new AlignViewport(al); |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
69 |
1 |
@Test(groups = "Functional")... |
70 |
|
public void testGetResidueColour_WithGroup() |
71 |
|
{ |
72 |
1 |
SequenceRenderer sr = new SequenceRenderer(av); |
73 |
1 |
SequenceGroup sg = new SequenceGroup(); |
74 |
1 |
sg.addSequence(seq1, false); |
75 |
1 |
sg.setStartRes(3); |
76 |
1 |
sg.setEndRes(5); |
77 |
|
|
78 |
1 |
ResidueShaderI rs = new ResidueShader(); |
79 |
1 |
rs.setColourScheme(new ZappoColourScheme()); |
80 |
1 |
sg.setGroupColourScheme(rs); |
81 |
|
|
82 |
1 |
av.getAlignment().addGroup(sg); |
83 |
|
|
84 |
|
|
85 |
1 |
assertEquals(Color.white, sr.getResidueColour(seq1, 1, null)); |
86 |
|
|
87 |
|
|
88 |
1 |
assertEquals(Color.red, sr.getResidueColour(seq1, 3, null)); |
89 |
|
} |
90 |
|
} |