From: gmungoc Date: Tue, 7 Apr 2015 08:18:49 +0000 (+0100) Subject: JAL-1270 test added X-Git-Tag: Jalview_2_9~69^2~12 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=dfc0fa51c8c3305bb7a50a5dcde8d10e08430462;p=jalview.git JAL-1270 test added --- diff --git a/test/jalview/datamodel/ColumnSelectionTest.java b/test/jalview/datamodel/ColumnSelectionTest.java index 228156a..97ef079 100644 --- a/test/jalview/datamodel/ColumnSelectionTest.java +++ b/test/jalview/datamodel/ColumnSelectionTest.java @@ -45,4 +45,31 @@ public class ColumnSelectionTest assertEquals(1, sel.size()); assertEquals(new Integer(5), sel.get(0)); } + + /** + * Test the method that finds the visible column position of an alignment + * column, allowing for hidden columns. + */ + @Test + public void testFindColumnPosition() + { + ColumnSelection cs = new ColumnSelection(); + assertEquals(5, cs.findColumnPosition(5)); + + // hiding column 6 makes no difference + cs.hideColumns(6, 6); + assertEquals(5, cs.findColumnPosition(5)); + + // hiding column 5 makes no difference + cs.hideColumns(5, 5); + assertEquals(5, cs.findColumnPosition(5)); + + // hiding column 4 moves column 5 to column 4 + cs.hideColumns(4, 4); + assertEquals(4, cs.findColumnPosition(5)); + + // hiding columns 1 and 2 moves column 5 to column 2 + cs.hideColumns(1, 2); + assertEquals(2, cs.findColumnPosition(5)); + } }