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.datamodel.AlignmentAnnotation; |
26 |
|
|
27 |
|
import org.testng.annotations.Test; |
28 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (31) |
Complexity: 1 |
Complexity Density: 0.03 |
|
29 |
|
public class AnnotationPanelTest |
30 |
|
{ |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (30) |
Complexity: 1 |
Complexity Density: 0.03 |
1PASS
|
|
32 |
1 |
@Test(groups = "Functional")... |
33 |
|
public void testGetRowIndex() |
34 |
|
{ |
35 |
1 |
assertEquals(AnnotationPanel.getRowIndex(0, null), -1); |
36 |
|
|
37 |
1 |
AlignmentAnnotation[] anns = new AlignmentAnnotation[] {}; |
38 |
1 |
assertEquals(AnnotationPanel.getRowIndex(0, anns), -1); |
39 |
|
|
40 |
1 |
AlignmentAnnotation ann1 = new AlignmentAnnotation(null, null, null); |
41 |
1 |
AlignmentAnnotation ann2 = new AlignmentAnnotation(null, null, null); |
42 |
1 |
AlignmentAnnotation ann3 = new AlignmentAnnotation(null, null, null); |
43 |
1 |
ann1.visible = true; |
44 |
1 |
ann2.visible = true; |
45 |
1 |
ann3.visible = true; |
46 |
1 |
ann1.height = 10; |
47 |
1 |
ann2.height = 20; |
48 |
1 |
ann3.height = 30; |
49 |
1 |
anns = new AlignmentAnnotation[] { ann1, ann2, ann3 }; |
50 |
|
|
51 |
1 |
assertEquals(AnnotationPanel.getRowIndex(0, anns), 0); |
52 |
1 |
assertEquals(AnnotationPanel.getRowIndex(9, anns), 0); |
53 |
1 |
assertEquals(AnnotationPanel.getRowIndex(10, anns), 1); |
54 |
1 |
assertEquals(AnnotationPanel.getRowIndex(29, anns), 1); |
55 |
1 |
assertEquals(AnnotationPanel.getRowIndex(30, anns), 2); |
56 |
1 |
assertEquals(AnnotationPanel.getRowIndex(59, anns), 2); |
57 |
1 |
assertEquals(AnnotationPanel.getRowIndex(60, anns), -1); |
58 |
|
|
59 |
1 |
ann2.visible = false; |
60 |
1 |
assertEquals(AnnotationPanel.getRowIndex(0, anns), 0); |
61 |
1 |
assertEquals(AnnotationPanel.getRowIndex(9, anns), 0); |
62 |
1 |
assertEquals(AnnotationPanel.getRowIndex(10, anns), 2); |
63 |
1 |
assertEquals(AnnotationPanel.getRowIndex(39, anns), 2); |
64 |
1 |
assertEquals(AnnotationPanel.getRowIndex(40, anns), -1); |
65 |
|
|
66 |
1 |
ann1.visible = false; |
67 |
1 |
assertEquals(AnnotationPanel.getRowIndex(0, anns), 2); |
68 |
1 |
assertEquals(AnnotationPanel.getRowIndex(29, anns), 2); |
69 |
1 |
assertEquals(AnnotationPanel.getRowIndex(30, anns), -1); |
70 |
|
} |
71 |
|
} |