From 30f552046feaba47955d5ffdcec6d0fc67a7e13b Mon Sep 17 00:00:00 2001 From: kiramt Date: Tue, 18 Jul 2017 15:44:30 +0100 Subject: [PATCH] JAL-2611 unit tests --- .../OverviewDimensionsHideHiddenTest.java | 23 +++++++++++++++++ .../OverviewDimensionsShowHiddenTest.java | 27 ++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java b/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java index 32d0ab8..f6a9d32 100644 --- a/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java +++ b/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java @@ -974,6 +974,29 @@ public class OverviewDimensionsHideHiddenTest // corner moves 16 (20-4) right and 6 (22-16) up assertEquals(od.getBoxX(), 16); assertEquals(od.getBoxY(), 6); + + // hide columns - makes no difference + hiddenCols.hideColumns(1, 4); + od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); + od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols); + od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); + + // corner moves 16 (20-4) right and 6 (22-16) up + assertEquals(od.getBoxX(), 16); + assertEquals(od.getBoxY(), 6); + + // hide sequences in box area + // makes absolutely no difference + hideSequences(1, 3); + od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); + od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols); + od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); + + // corner moves 16 (20-4) right and 6 (22-16) up + assertEquals(od.getBoxX(), 16); + assertEquals(od.getBoxY(), 6); } /* diff --git a/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java b/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java index 716659c..df8c162 100644 --- a/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java +++ b/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java @@ -1009,6 +1009,33 @@ public class OverviewDimensionsShowHiddenTest // corner moves 16 (20-4) right and 6 (22-16) up assertEquals(od.getBoxX(), 16); assertEquals(od.getBoxY(), 6); + + // hide columns - box moves drag distance + hidden cols, vertically makes no + // difference + hiddenCols.hideColumns(1, 4); + od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); + od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols); + od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); + + // corner moves 16 (20-4) + hiddenCols right and 6 (22-16) down + assertEquals(od.getBoxX(), + 16 + Math.round((float) 4 * od.getWidth() / alwidth)); + assertEquals(od.getBoxY(), 6); + + // hide sequences in box area + // makes absolutely no difference + hideSequences(1, 3); + od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); + od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols); + od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); + + // corner moves 16 (20-4) + hiddenCols right and 6 (22-16) + hiddenRows down + assertEquals(od.getBoxX(), + 16 + Math.round((float) 4 * od.getWidth() / alwidth)); + assertEquals(od.getBoxY(), + 6 + Math.round((float) 3 * od.getHeight() / alheight)); } /* -- 1.7.10.2