From 65935d012d531c438ccca3bd07056c0e7327a28a Mon Sep 17 00:00:00 2001 From: kiramt Date: Fri, 14 Jul 2017 07:59:45 +0100 Subject: [PATCH] JAL-2611 More unit tests --- .../OverviewDimensionsHideHiddenTest.java | 22 +++++++++++ .../OverviewDimensionsShowHiddenTest.java | 39 ++++++++++++++++++++ 2 files changed, 61 insertions(+) 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)); } /* -- 1.7.10.2