Class |
Line # |
Actions |
|||
---|---|---|---|---|---|
AnnotationPanelTest | 29 | 30 | 1 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
7 | * Jalview is free software: you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License | |
9 | * as published by the Free Software Foundation, either version 3 | |
10 | * of the License, or (at your option) any later version. | |
11 | * | |
12 | * Jalview is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty | |
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR | |
15 | * PURPOSE. See the GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with Jalview. If not, see <http://www.gnu.org/licenses/>. | |
19 | * The Jalview Authors are detailed in the 'AUTHORS' file. | |
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 | ||
29 | public class AnnotationPanelTest | |
30 | { | |
31 | ||
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 | } |