From 6fbb7c8b997e7f5b57ca4bf0861ddb4ad629620b Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 26 Sep 2017 13:56:12 +0100 Subject: [PATCH] JAL-2674 Unit test for new copy constructor. --- test/jalview/datamodel/HiddenColumnsTest.java | 27 +++++++++++++++++++++++++ test/jalview/io/JSONFileTest.java | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) 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() { -- 1.7.10.2