Clover icon

Coverage Report

  1. Project Clover database Thu Aug 13 2020 12:04:21 BST
  2. Package jalview.gui

File AnnotationPanelTest.java

 

Code metrics

0
30
1
1
51
41
1
0.03
30
1
1

Classes

Class Line # Actions
AnnotationPanelTest 9 30 1
1.0100%
 

Contributing tests

This file is covered by 1 test. .

Source view

1    package jalview.gui;
2   
3    import static org.testng.Assert.assertEquals;
4   
5    import jalview.datamodel.AlignmentAnnotation;
6   
7    import org.testng.annotations.Test;
8   
 
9    public class AnnotationPanelTest
10    {
11   
 
12  1 toggle @Test(groups = "Functional")
13    public void testGetRowIndex()
14    {
15  1 assertEquals(AnnotationPanel.getRowIndex(0, null), -1);
16   
17  1 AlignmentAnnotation[] anns = new AlignmentAnnotation[] {};
18  1 assertEquals(AnnotationPanel.getRowIndex(0, anns), -1);
19   
20  1 AlignmentAnnotation ann1 = new AlignmentAnnotation(null, null, null);
21  1 AlignmentAnnotation ann2 = new AlignmentAnnotation(null, null, null);
22  1 AlignmentAnnotation ann3 = new AlignmentAnnotation(null, null, null);
23  1 ann1.visible = true;
24  1 ann2.visible = true;
25  1 ann3.visible = true;
26  1 ann1.height = 10;
27  1 ann2.height = 20;
28  1 ann3.height = 30;
29  1 anns = new AlignmentAnnotation[] { ann1, ann2, ann3 };
30   
31  1 assertEquals(AnnotationPanel.getRowIndex(0, anns), 0);
32  1 assertEquals(AnnotationPanel.getRowIndex(9, anns), 0);
33  1 assertEquals(AnnotationPanel.getRowIndex(10, anns), 1);
34  1 assertEquals(AnnotationPanel.getRowIndex(29, anns), 1);
35  1 assertEquals(AnnotationPanel.getRowIndex(30, anns), 2);
36  1 assertEquals(AnnotationPanel.getRowIndex(59, anns), 2);
37  1 assertEquals(AnnotationPanel.getRowIndex(60, anns), -1);
38   
39  1 ann2.visible = false;
40  1 assertEquals(AnnotationPanel.getRowIndex(0, anns), 0);
41  1 assertEquals(AnnotationPanel.getRowIndex(9, anns), 0);
42  1 assertEquals(AnnotationPanel.getRowIndex(10, anns), 2);
43  1 assertEquals(AnnotationPanel.getRowIndex(39, anns), 2);
44  1 assertEquals(AnnotationPanel.getRowIndex(40, anns), -1);
45   
46  1 ann1.visible = false;
47  1 assertEquals(AnnotationPanel.getRowIndex(0, anns), 2);
48  1 assertEquals(AnnotationPanel.getRowIndex(29, anns), 2);
49  1 assertEquals(AnnotationPanel.getRowIndex(30, anns), -1);
50    }
51    }