1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.renderer; |
22 |
|
|
23 |
|
import static org.testng.Assert.assertEquals; |
24 |
|
|
25 |
|
import jalview.datamodel.Alignment; |
26 |
|
import jalview.datamodel.AlignmentI; |
27 |
|
import jalview.datamodel.Sequence; |
28 |
|
import jalview.datamodel.SequenceFeature; |
29 |
|
import jalview.datamodel.SequenceI; |
30 |
|
import jalview.gui.AlignViewport; |
31 |
|
import jalview.renderer.seqfeatures.FeatureRenderer; |
32 |
|
import jalview.schemes.FeatureColour; |
33 |
|
import jalview.schemes.ZappoColourScheme; |
34 |
|
import jalview.viewmodel.AlignmentViewport; |
35 |
|
import jalview.viewmodel.OverviewDimensions; |
36 |
|
import jalview.viewmodel.OverviewDimensionsShowHidden; |
37 |
|
import jalview.viewmodel.ViewportRanges; |
38 |
|
|
39 |
|
import java.awt.Color; |
40 |
|
|
41 |
|
import org.testng.annotations.Test; |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 1 |
Complexity Density: 0.05 |
|
43 |
|
public class OverviewRendererTest |
44 |
|
{ |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 22 (22) |
Complexity: 1 |
Complexity Density: 0.05 |
4-
|
|
46 |
0 |
@Test... |
47 |
|
public void testGetColumnColourFromSequence() |
48 |
|
{ |
49 |
|
|
50 |
0 |
OverviewResColourFinder cf = new OverviewResColourFinder(Color.PINK, |
51 |
|
Color.white, Color.green); |
52 |
0 |
Sequence seq1 = new Sequence("seq1", "PQ-RL-"); |
53 |
0 |
Sequence seq2 = new Sequence("seq2", "FVE"); |
54 |
0 |
AlignmentI al = new Alignment(new SequenceI[] { seq1, seq2 }); |
55 |
0 |
AlignmentViewport av = new AlignViewport(al); |
56 |
0 |
OverviewDimensions od = new OverviewDimensionsShowHidden( |
57 |
|
new ViewportRanges(al), false); |
58 |
0 |
ResidueShaderI rs = new ResidueShader(new ZappoColourScheme()); |
59 |
0 |
FeatureRenderer fr = new FeatureRenderer(av); |
60 |
0 |
OverviewRenderer or = new OverviewRenderer(fr, od, al, rs, cf); |
61 |
|
|
62 |
|
|
63 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq1, 0), |
64 |
|
Color.magenta.getRGB()); |
65 |
|
|
66 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq1, 1), |
67 |
|
Color.green.getRGB()); |
68 |
|
|
69 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq1, 2), |
70 |
|
Color.pink.getRGB()); |
71 |
|
|
72 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq2, 0), |
73 |
|
Color.orange.getRGB()); |
74 |
|
|
75 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq2, 2), |
76 |
|
Color.red.getRGB()); |
77 |
|
|
78 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq2, 3), |
79 |
|
Color.pink.getRGB()); |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
0 |
seq1.addSequenceFeature( |
85 |
|
new SequenceFeature("Pfam", "desc", 1, 4, null)); |
86 |
0 |
fr.findAllFeatures(true); |
87 |
0 |
av.setShowSequenceFeatures(true); |
88 |
0 |
fr.setColour("Pfam", new FeatureColour(Color.yellow)); |
89 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq1, 0), |
90 |
|
Color.yellow.getRGB()); |
91 |
|
|
92 |
|
|
93 |
0 |
av.setShowSequenceFeatures(false); |
94 |
0 |
assertEquals(or.getColumnColourFromSequence(null, seq1, 0), |
95 |
|
Color.magenta.getRGB()); |
96 |
|
} |
97 |
|
} |