From: kiramt Date: Tue, 26 Sep 2017 12:56:12 +0000 (+0100) Subject: JAL-2674 Unit test for new copy constructor. X-Git-Tag: Release_2_10_4~55^2~1^2~106 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6fbb7c8b997e7f5b57ca4bf0861ddb4ad629620b;p=jalview.git JAL-2674 Unit test for new copy constructor. --- diff --git a/test/jalview/datamodel/HiddenColumnsTest.java b/test/jalview/datamodel/HiddenColumnsTest.java index 295ad9f..8aee615 100644 --- a/test/jalview/datamodel/HiddenColumnsTest.java +++ b/test/jalview/datamodel/HiddenColumnsTest.java @@ -261,6 +261,33 @@ public class HiddenColumnsTest Arrays.toString(cs2.getHiddenColumnsCopy().get(1))); } + @Test(groups = "Functional") + public void testCopyConstructor2() + { + HiddenColumns cs = new HiddenColumns(); + cs.hideColumns(10, 11); + cs.hideColumns(5, 7); + + HiddenColumns cs2 = new HiddenColumns(cs, 3, 9, 1); + assertTrue(cs2.hasHiddenColumns()); + + // only [5,7] returned, offset by 1 + assertEquals("[4, 6]", + Arrays.toString(cs2.getHiddenColumnsCopy().get(0))); + assertEquals(3, cs2.getSize()); + + cs2 = new HiddenColumns(cs, 8, 15, 4); + assertTrue(cs2.hasHiddenColumns()); + + // only [10,11] returned, offset by 4 + assertEquals("[6, 7]", + Arrays.toString(cs2.getHiddenColumnsCopy().get(0))); + assertEquals(2, cs2.getSize()); + + cs2 = new HiddenColumns(cs, 6, 10, 4); + assertFalse(cs2.hasHiddenColumns()); + } + /** * Test the code used to locate the reference sequence ruler origin */ diff --git a/test/jalview/io/JSONFileTest.java b/test/jalview/io/JSONFileTest.java index bfb714d..158c901 100644 --- a/test/jalview/io/JSONFileTest.java +++ b/test/jalview/io/JSONFileTest.java @@ -205,7 +205,7 @@ public class JSONFileTest TEST_SEQ_HEIGHT = expectedSeqs.size(); TEST_GRP_HEIGHT = expectedGrps.size(); TEST_ANOT_HEIGHT = expectedAnnots.size(); - TEST_CS_HEIGHT = expectedColSel.getSize(); + TEST_CS_HEIGHT = expectedColSel.getHiddenColumnsCopy().size(); exportSettings = new AlignExportSettingI() {