+ assertEquals(ranges.getEndRes(), oldres);
+
+ af.alignPanel.setScrollValues(5, 5);
+ // setting x value to 5 extends endRes by 5 residues
+ assertEquals(ranges.getEndRes(), oldres + 5);
+
+ // scroll to position after hidden columns sets endres to oldres (width) +
+ // position
+ int scrollpos = 60;
+ af.getViewport().hideColumns(30, 50);
+ af.alignPanel.setScrollValues(scrollpos, 5);
+ assertEquals(ranges.getEndRes(), oldres + scrollpos);
+
+ // scroll to position within hidden columns, still sets endres to oldres +
+ // position
+ // not sure if this is actually correct behaviour but this is what Jalview
+ // currently does
+ scrollpos = 40;
+ af.getViewport().showAllHiddenColumns();
+ af.getViewport().hideColumns(30, 50);
+ af.alignPanel.setScrollValues(scrollpos, 5);
+ assertEquals(ranges.getEndRes(), oldres + scrollpos);
+
+ // scroll to position within <width> distance of the end of the alignment
+ // endRes should be set to width of alignment - 1
+ scrollpos = 130;
+ af.getViewport().showAllHiddenColumns();
+ af.alignPanel.setScrollValues(scrollpos, 5);
+ assertEquals(ranges.getEndRes(), af.getViewport()
+ .getAlignment().getWidth() - 1);
+
+ // now hide some columns, and scroll to position within <width>
+ // distance of the end of the alignment
+ // endRes should be set to width of alignment - 1 - the number of hidden
+ // columns
+ af.getViewport().hideColumns(30, 50);
+ af.alignPanel.setScrollValues(scrollpos, 5);
+ assertEquals(ranges.getEndRes(), af.getViewport()
+ .getAlignment().getWidth() - 1 - 21); // 21 is the number of hidden
+ // columns
+ }
+
+ /**
+ * Test that update layout reverts to original (unwrapped) values for endRes
+ * and endSeq when switching from wrapped to unwrapped mode (JAL-2739)
+ */
+ @Test(groups = "Functional")
+ public void TestUpdateLayout_endRes()
+ {
+ // get details of original alignment dimensions
+ ViewportRanges ranges = af.getViewport().getRanges();
+ int endres = ranges.getEndRes();
+
+ // wrap
+ af.alignPanel.getAlignViewport().setWrapAlignment(true);
+ af.alignPanel.updateLayout();
+
+ // endRes changes
+ assertNotEquals(ranges.getEndRes(), endres);