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 |
|
import static org.testng.Assert.assertFalse; |
25 |
|
import static org.testng.Assert.assertNull; |
26 |
|
import static org.testng.Assert.assertTrue; |
27 |
|
|
28 |
|
import jalview.gui.AlignFrame; |
29 |
|
import jalview.gui.AlignViewport; |
30 |
|
import jalview.io.DataSourceType; |
31 |
|
import jalview.io.FileLoader; |
32 |
|
import jalview.renderer.ScaleRenderer.ScaleMark; |
33 |
|
|
34 |
|
import java.util.List; |
35 |
|
|
36 |
|
import org.testng.annotations.Test; |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (40) |
Complexity: 1 |
Complexity Density: 0.03 |
|
38 |
|
public class ScaleRendererTest |
39 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (39) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
40 |
1 |
@Test(groups = "Functional")... |
41 |
|
public void testCalculateMarks() |
42 |
|
{ |
43 |
1 |
String data = ">Seq/20-45\nABCDEFGHIJKLMNOPQRSTUVWXYS\n"; |
44 |
1 |
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(data, |
45 |
|
DataSourceType.PASTE); |
46 |
1 |
AlignViewport av = af.getViewport(); |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
1 |
List<ScaleMark> marks = new ScaleRenderer().calculateMarks(av, 0, 25); |
53 |
1 |
assertEquals(marks.size(), 5); |
54 |
|
|
55 |
1 |
assertFalse(marks.get(0).major); |
56 |
1 |
assertEquals(marks.get(0).column, 4); |
57 |
1 |
assertNull(marks.get(0).text); |
58 |
|
|
59 |
1 |
assertTrue(marks.get(1).major); |
60 |
1 |
assertEquals(marks.get(1).column, 9); |
61 |
1 |
assertEquals(marks.get(1).text, "10"); |
62 |
|
|
63 |
1 |
assertFalse(marks.get(2).major); |
64 |
1 |
assertEquals(marks.get(2).column, 14); |
65 |
1 |
assertNull(marks.get(2).text); |
66 |
|
|
67 |
1 |
assertTrue(marks.get(3).major); |
68 |
1 |
assertEquals(marks.get(3).column, 19); |
69 |
1 |
assertEquals(marks.get(3).text, "20"); |
70 |
|
|
71 |
1 |
assertFalse(marks.get(4).major); |
72 |
1 |
assertEquals(marks.get(4).column, 24); |
73 |
1 |
assertNull(marks.get(4).text); |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
1 |
av.hideColumns(8, 10); |
81 |
1 |
av.hideColumns(17, 19); |
82 |
1 |
marks = new ScaleRenderer().calculateMarks(av, 0, 25); |
83 |
1 |
assertEquals(marks.size(), 5); |
84 |
1 |
assertFalse(marks.get(0).major); |
85 |
1 |
assertEquals(marks.get(0).column, 4); |
86 |
1 |
assertNull(marks.get(0).text); |
87 |
1 |
assertTrue(marks.get(1).major); |
88 |
1 |
assertEquals(marks.get(1).column, 9); |
89 |
1 |
assertEquals(marks.get(1).text, "13"); |
90 |
1 |
assertFalse(marks.get(2).major); |
91 |
1 |
assertEquals(marks.get(2).column, 14); |
92 |
1 |
assertNull(marks.get(2).text); |
93 |
1 |
assertTrue(marks.get(3).major); |
94 |
1 |
assertEquals(marks.get(3).column, 19); |
95 |
1 |
assertEquals(marks.get(3).text, "26"); |
96 |
1 |
assertFalse(marks.get(4).major); |
97 |
1 |
assertEquals(marks.get(4).column, 24); |
98 |
1 |
assertNull(marks.get(4).text); |
99 |
|
} |
100 |
|
} |