2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
23 import static org.testng.Assert.assertEquals;
25 import jalview.datamodel.AlignmentAnnotation;
27 import org.testng.annotations.Test;
29 public class AnnotationPanelTest
32 @Test(groups = "Functional")
33 public void testGetRowIndex()
35 assertEquals(AnnotationPanel.getRowIndex(0, null), -1);
37 AlignmentAnnotation[] anns = new AlignmentAnnotation[] {};
38 assertEquals(AnnotationPanel.getRowIndex(0, anns), -1);
40 AlignmentAnnotation ann1 = new AlignmentAnnotation(null, null, null);
41 AlignmentAnnotation ann2 = new AlignmentAnnotation(null, null, null);
42 AlignmentAnnotation ann3 = new AlignmentAnnotation(null, null, null);
49 anns = new AlignmentAnnotation[] { ann1, ann2, ann3 };
51 assertEquals(AnnotationPanel.getRowIndex(0, anns), 0);
52 assertEquals(AnnotationPanel.getRowIndex(9, anns), 0);
53 assertEquals(AnnotationPanel.getRowIndex(10, anns), 1);
54 assertEquals(AnnotationPanel.getRowIndex(29, anns), 1);
55 assertEquals(AnnotationPanel.getRowIndex(30, anns), 2);
56 assertEquals(AnnotationPanel.getRowIndex(59, anns), 2);
57 assertEquals(AnnotationPanel.getRowIndex(60, anns), -1);
60 assertEquals(AnnotationPanel.getRowIndex(0, anns), 0);
61 assertEquals(AnnotationPanel.getRowIndex(9, anns), 0);
62 assertEquals(AnnotationPanel.getRowIndex(10, anns), 2);
63 assertEquals(AnnotationPanel.getRowIndex(39, anns), 2);
64 assertEquals(AnnotationPanel.getRowIndex(40, anns), -1);
67 assertEquals(AnnotationPanel.getRowIndex(0, anns), 2);
68 assertEquals(AnnotationPanel.getRowIndex(29, anns), 2);
69 assertEquals(AnnotationPanel.getRowIndex(30, anns), -1);