From: kiramt Date: Fri, 14 Jul 2017 06:59:45 +0000 (+0100) Subject: JAL-2611 More unit tests X-Git-Tag: Release_2_10_3b1~132^2~30^2~8 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=65935d012d531c438ccca3bd07056c0e7327a28a;p=jalview.git JAL-2611 More unit tests --- diff --git a/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java b/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java index 0c751e2..28b7029 100644 --- a/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java +++ b/test/jalview/viewmodel/OverviewDimensionsHideHiddenTest.java @@ -916,6 +916,28 @@ public class OverviewDimensionsHideHiddenTest @Test(groups = { "Functional" }) public void testPositionInBox() { + od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); + + assertFalse(od.isPositionInBox(0, 0)); + assertTrue(od.isPositionInBox(10, 9)); + assertFalse(od.isPositionInBox(0, 9)); + assertFalse(od.isPositionInBox(9, 0)); + assertFalse(od.isPositionInBox(75, 20)); + + // hide columns in the box area + // makes absolutely no difference + hiddenCols.hideColumns(1, 4); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); + assertFalse(od.isPositionInBox(0, 0)); + assertTrue(od.isPositionInBox(10, 9)); + assertFalse(od.isPositionInBox(0, 9)); + assertFalse(od.isPositionInBox(9, 0)); + assertFalse(od.isPositionInBox(75, 20)); + + // hide sequences in box area + // makes absolutely no difference + hideSequences(1, 3); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); assertFalse(od.isPositionInBox(0, 0)); assertTrue(od.isPositionInBox(10, 9)); assertFalse(od.isPositionInBox(0, 9)); diff --git a/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java b/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java index 21e3ed3..61f1619 100644 --- a/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java +++ b/test/jalview/viewmodel/OverviewDimensionsShowHiddenTest.java @@ -959,11 +959,50 @@ public class OverviewDimensionsShowHiddenTest @Test(groups = { "Functional" }) public void testPositionInBox() { + od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols); + + assertFalse(od.isPositionInBox(0, 0)); + assertTrue(od.isPositionInBox(10, 9)); + assertFalse(od.isPositionInBox(0, 9)); + assertFalse(od.isPositionInBox(9, 0)); + assertFalse(od.isPositionInBox(75, 20)); + + assertTrue(od.isPositionInBox(47, 6)); + assertFalse(od.isPositionInBox(48, 6)); + assertTrue(od.isPositionInBox(47, 9)); + assertFalse(od.isPositionInBox(47, 10)); + + // hide columns in the box area + // extends area where a point is considered to be in the box + hiddenCols.hideColumns(1, 4); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); assertFalse(od.isPositionInBox(0, 0)); assertTrue(od.isPositionInBox(10, 9)); assertFalse(od.isPositionInBox(0, 9)); assertFalse(od.isPositionInBox(9, 0)); assertFalse(od.isPositionInBox(75, 20)); + + assertTrue(od.isPositionInBox(47, 6)); + assertTrue(od.isPositionInBox(48, 6)); + assertTrue(od.isPositionInBox(47, 9)); + assertFalse(od.isPositionInBox(47, 10)); + + // hide sequences in box area + // extends area where a point is considered to be in the box + hideSequences(1, 3); + ColumnSelection cs = new ColumnSelection(); + hiddenCols.revealAllHiddenColumns(cs); + od.setBoxPosition(al.getHiddenSequences(), hiddenCols); + assertFalse(od.isPositionInBox(0, 0)); + assertTrue(od.isPositionInBox(10, 9)); + assertFalse(od.isPositionInBox(0, 9)); + assertFalse(od.isPositionInBox(9, 0)); + assertFalse(od.isPositionInBox(75, 20)); + + assertTrue(od.isPositionInBox(47, 6)); + assertFalse(od.isPositionInBox(48, 6)); + assertTrue(od.isPositionInBox(47, 9)); + assertTrue(od.isPositionInBox(47, 10)); } /*