From: gmungoc Date: Fri, 28 Jul 2017 10:06:39 +0000 (+0200) Subject: JAL-147 unit test for no vertical move of Overview box in wrapped mode X-Git-Tag: Release_2_10_3b1~132^2~35 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4db8e85ade2bb6c1bedb8a13ff4932c2a052a357;p=jalview.git JAL-147 unit test for no vertical move of Overview box in wrapped mode --- diff --git a/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java b/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java index 1bc3bfa..66480c9 100644 --- a/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java +++ b/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java @@ -1022,4 +1022,53 @@ public class OverviewDimensionsShowHiddenTest hiddenRepSequences.put(allseqs[start], theseSeqs); } + + /** + * Test setting of the box position, when there are hidden rows at the start + * of the alignment + */ + @Test(groups = { "Functional" }) + public void testFromMouseWithHiddenRowsAtStartWrapped() + { + vpranges.setWrappedMode(true); + od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); + assertEquals(od.getBoxX(), 0); + assertEquals(od.getBoxY(), 0); + assertEquals(od.getBoxHeight(), boxHeight); + assertEquals(od.getBoxWidth(), boxWidth); + assertEquals(vpranges.getStartRes(), 0); + assertEquals(vpranges.getStartSeq(), 0); + + // hide rows at start and check updated box position is correct + // changes boxY but not boxheight + int lastHiddenRow = 30; + hideSequences(0, lastHiddenRow); + + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); + assertEquals(od.getBoxX(), 0); + assertEquals(od.getBoxY(), + Math.round((float) (lastHiddenRow + 1) + * od.getSequencesHeight() / alheight)); + assertEquals(od.getBoxWidth(), boxWidth); + assertEquals(od.getBoxHeight(), boxHeight); + + // click in hidden rows - same result + mouseClick(od, 0, 0); + assertEquals(od.getBoxX(), 0); + int boxY = od.getBoxY(); + assertEquals( + boxY, + Math.round((float) (lastHiddenRow + 1) + * od.getSequencesHeight() / alheight)); + assertEquals(od.getBoxWidth(), boxWidth); + assertEquals(od.getBoxHeight(), boxHeight); + + // click below hidden rows + // vertical move of overview box is suppressed in wrapped mode + mouseClick(od, 0, 150); + assertEquals(od.getBoxX(), 0); + assertEquals(od.getBoxY(), boxY); // unchanged + assertEquals(od.getBoxWidth(), boxWidth); + assertEquals(od.getBoxHeight(), boxHeight); + } }