JAL-2611 Tidies, initial unit tests
[jalview.git] / test / jalview / viewmodel / OverviewDimensionsShowHiddenTest.java
index 0c975cb..716659c 100644 (file)
@@ -991,6 +991,26 @@ public class OverviewDimensionsShowHiddenTest
     assertTrue(od.isPositionInBox(47, 10));
   }
 
+  /**
+   * Test the dragging functionality
+   */
+  @Test(groups = { "Functional" })
+  public void testDragging()
+  {
+    od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
+    od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols);
+    od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols);
+
+    // updates require an OverviewPanel to exist which it doesn't here
+    // so call setBoxPosition() as it would be called by the AlignmentPanel
+    // normally
+    od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
+
+    // corner moves 16 (20-4) right and 6 (22-16) up
+    assertEquals(od.getBoxX(), 16);
+    assertEquals(od.getBoxY(), 6);
+  }
+
   /*
    * Move viewport horizontally: startRes + previous width gives new horizontal extent. Vertical extent stays the same.
    */