From: Mateusz Warowny Date: Tue, 19 Sep 2023 12:09:37 +0000 (+0200) Subject: JAL-1601 Test getVisibleCongigMapFor X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8899690eec8b1e2b4c74da42ed02d0453c5b7141;p=jalview.git JAL-1601 Test getVisibleCongigMapFor --- diff --git a/test/jalview/datamodel/AlignmentViewTest.java b/test/jalview/datamodel/AlignmentViewTest.java index 9be344c..21c9b78 100644 --- a/test/jalview/datamodel/AlignmentViewTest.java +++ b/test/jalview/datamodel/AlignmentViewTest.java @@ -20,8 +20,14 @@ */ package jalview.datamodel; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.contains; +import org.hamcrest.Matchers; import static org.testng.Assert.assertEquals; +import java.util.Arrays; +import java.util.List; + import jalview.gui.AlignFrame; import jalview.gui.JvOptionPane; import jalview.io.DataSourceType; @@ -31,6 +37,7 @@ import jalview.viewmodel.AlignmentViewport; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; + public class AlignmentViewTest { @@ -55,6 +62,26 @@ public class AlignmentViewTest .getSequenceAsString(), "A$$CDE"); } + @Test + public void testGetVisibleContigMapFor() + { + AlignFrame af = new FileLoader() + .LoadFileWaitTillLoaded(">seq\nAAA-AAAA---AA--\n", + DataSourceType.PASTE); + var av = af.getViewport(); + var seq = av.getAlignment().getSequenceAt(0); + var gapMap = seq.gapMap(); + assertThat(Arrays.stream(gapMap).boxed().toArray(Integer[]::new), + Matchers.arrayContaining(0, 1, 2, 4, 5, 6, 7, 11, 12)); + + av.hideColumns(0, 1); + av.hideColumns(6, 7); + AlignmentView view = av.getAlignmentView(true); + var delMap = view.getVisibleContigMapFor(gapMap); + assertThat(Arrays.stream(delMap).boxed().toArray(Integer[]::new), + Matchers.arrayContaining(2, 3, 4, 7, 8)); + } + @Test(groups = { "Functional" }) public void testGetVisibleContigs() {