*/
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;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+
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()
{