}
else
{
- int widthInRes = (canvasWidth / av.getCharWidth()) - 1;
+ int widthInRes = (canvasWidth / av.getCharWidth());
int heightInSeq = (getSeqPanel().seqCanvas.getHeight()
- / av.getCharHeight()) - 1;
+ / av.getCharHeight());
vpRanges.setViewportWidth(widthInRes);
vpRanges.setViewportHeight(heightInSeq);
package jalview.gui;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotEquals;
import jalview.bin.Cache;
import jalview.bin.Jalview;
.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);
+
+ // unwrap
+ af.alignPanel.getAlignViewport().setWrapAlignment(false);
+ af.alignPanel.updateLayout();
+
+ // endRes and endSeq back to original values
+ assertEquals(ranges.getEndRes(), endres);
+
+ }
}