+ /**
+ * Test that the box position is set correctly when there are hidden columns
+ * at the start
+ */
+ @Test(groups = { "Functional" })
+ public void testSetBoxFromViewportHiddenColsAtStart()
+ {
+ int firstHidden = 0;
+ int lastHidden = 20;
+ av.hideColumns(firstHidden, lastHidden);
+
+ // move viewport to start of alignment
+ moveViewport(av, od, 0, 0);
+ assertEquals(od.getBoxX(),
+ (int) ((lastHidden + 1) * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
+
+ // move viewport to end of alignment - need to make startRes by removing
+ // hidden cols because of how viewport/overview are implemented
+ moveViewport(av, od, 98 - lastHidden - 1, 0);
+ assertEquals(od.getBoxX(), 98 * scalew * av.getCharWidth(), 1.5);
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
+ }
+
+ /**
+ * Test that the box position is set correctly when there are hidden columns
+ * in the middle
+ */
+ @Test(groups = { "Functional" })
+ public void testSetBoxFromViewportHiddenColsInMiddle()
+ {
+ int firstHidden = 65;
+ int lastHidden = 75;
+ av.hideColumns(firstHidden, lastHidden);
+
+ // move viewport before hidden columns
+ moveViewport(av, od, 3, 0);
+ assertEquals(od.getBoxX(), (int) (3 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
+
+ // move viewport to left of hidden columns with overlap
+ moveViewport(av, od, 10, 0);
+ assertEquals(od.getBoxX(), (int) (10 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(
+ od.getBoxWidth(),
+ boxWidth
+ + (int) ((lastHidden - firstHidden + 1) * scalew * av
+ .getCharWidth()), 1.5);
+ assertEquals(od.getBoxHeight(), boxHeight);
+
+ // move viewport to straddle hidden columns
+ moveViewport(av, od, 60, 0);
+ assertEquals(od.getBoxX(), (int) (60 * scalew * av.getCharWidth()));
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(
+ od.getBoxWidth(),
+ boxWidth
+ + (int) ((lastHidden - firstHidden + 1) * scalew * av
+ .getCharWidth()), 1.5);
+ assertEquals(od.getBoxHeight(), boxHeight);
+
+ // move viewport to right of hidden columns, no overlap
+ moveViewport(av, od, 80 - (lastHidden - firstHidden + 1), 0);
+ assertEquals(od.getBoxX(), (int) (80 * scalew * av.getCharWidth()), 1.5);
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
+
+ }
+
+ /**
+ * Test that the box position is set correctly when there are hidden columns
+ * at the end
+ */
+ @Test(groups = { "Functional" })
+ public void testSetBoxFromViewportHiddenColsAtEnd()
+ {
+ int firstHidden = 145;
+ int lastHidden = 157;
+ av.hideColumns(firstHidden, lastHidden);
+
+ // move viewport before hidden columns
+ moveViewport(av, od, 3, 0);
+ assertEquals(od.getBoxX(), (int) (3 * scalew * av.getCharWidth()), 1.5);
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(od.getBoxWidth(), boxWidth);
+ assertEquals(od.getBoxHeight(), boxHeight);
+
+ // move viewport to hidden columns
+ // TODO boxwidth includes hidden in overview panel (why?)
+ moveViewport(av, od, 98, 0);
+ assertEquals(od.getBoxX(), (int) (98 * scalew * av.getCharWidth()), 1.5);
+ assertEquals(od.getBoxY(), 0);
+ assertEquals(
+ od.getBoxWidth(),
+ boxWidth
+ + (int) ((lastHidden - firstHidden + 1) * scalew * av
+ .getCharWidth()), 1.5);
+ assertEquals(od.getBoxHeight(), boxHeight);
+ }
+