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