Clover icon

Coverage Report

  1. Project Clover database Tue Mar 10 2026 14:58:44 GMT
  2. Package jalview.gui

File AnnotationPanelTest.java

 

Code metrics

0
30
1
1
71
41
1
0.03
30
1
1

Classes

Class Line # Actions
AnnotationPanelTest 29 30 1
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

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  0 toggle @Test(groups = "Functional")
33    public void testGetRowIndex()
34    {
35  0 assertEquals(AnnotationPanel.getRowIndex(0, null), -1);
36   
37  0 AlignmentAnnotation[] anns = new AlignmentAnnotation[] {};
38  0 assertEquals(AnnotationPanel.getRowIndex(0, anns), -1);
39   
40  0 AlignmentAnnotation ann1 = new AlignmentAnnotation(null, null, null);
41  0 AlignmentAnnotation ann2 = new AlignmentAnnotation(null, null, null);
42  0 AlignmentAnnotation ann3 = new AlignmentAnnotation(null, null, null);
43  0 ann1.visible = true;
44  0 ann2.visible = true;
45  0 ann3.visible = true;
46  0 ann1.height = 10;
47  0 ann2.height = 20;
48  0 ann3.height = 30;
49  0 anns = new AlignmentAnnotation[] { ann1, ann2, ann3 };
50   
51  0 assertEquals(AnnotationPanel.getRowIndex(0, anns), 0);
52  0 assertEquals(AnnotationPanel.getRowIndex(9, anns), 0);
53  0 assertEquals(AnnotationPanel.getRowIndex(10, anns), 1);
54  0 assertEquals(AnnotationPanel.getRowIndex(29, anns), 1);
55  0 assertEquals(AnnotationPanel.getRowIndex(30, anns), 2);
56  0 assertEquals(AnnotationPanel.getRowIndex(59, anns), 2);
57  0 assertEquals(AnnotationPanel.getRowIndex(60, anns), -1);
58   
59  0 ann2.visible = false;
60  0 assertEquals(AnnotationPanel.getRowIndex(0, anns), 0);
61  0 assertEquals(AnnotationPanel.getRowIndex(9, anns), 0);
62  0 assertEquals(AnnotationPanel.getRowIndex(10, anns), 2);
63  0 assertEquals(AnnotationPanel.getRowIndex(39, anns), 2);
64  0 assertEquals(AnnotationPanel.getRowIndex(40, anns), -1);
65   
66  0 ann1.visible = false;
67  0 assertEquals(AnnotationPanel.getRowIndex(0, anns), 2);
68  0 assertEquals(AnnotationPanel.getRowIndex(29, anns), 2);
69  0 assertEquals(AnnotationPanel.getRowIndex(30, anns), -1);
70    }
71    }