changeset 4930:6c9898b47f64

[TEST ONLY] slightly improved test infrastructure for virtualFlow controls and mouse event firing.
author jgiles
date Wed, 04 Sep 2013 14:11:01 +1200
parents 9dafb5c352f3
children 9257caffde99
files modules/controls/src/test/java/com/sun/javafx/scene/control/infrastructure/MouseEventFirer.java modules/controls/src/test/java/com/sun/javafx/scene/control/infrastructure/VirtualFlowTestUtils.java
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/test/java/com/sun/javafx/scene/control/infrastructure/MouseEventFirer.java	Wed Sep 04 14:10:32 2013 +1200
+++ b/modules/controls/src/test/java/com/sun/javafx/scene/control/infrastructure/MouseEventFirer.java	Wed Sep 04 14:11:01 2013 +1200
@@ -51,6 +51,11 @@
         fireMouseEvent(MouseEvent.MOUSE_PRESSED, modifiers);
         fireMouseEvent(MouseEvent.MOUSE_RELEASED, modifiers);
     }
+
+    public void fireMousePressAndRelease(int clickCount, KeyModifier... modifiers) {
+        fireMouseEvent(MouseEvent.MOUSE_PRESSED, MouseButton.PRIMARY, clickCount, 0, 0, modifiers);
+        fireMouseEvent(MouseEvent.MOUSE_RELEASED, MouseButton.PRIMARY, clickCount, 0, 0, modifiers);
+    }
     
     public void fireMouseClicked() {
         fireMouseEvent(MouseEvent.MOUSE_CLICKED);
@@ -83,6 +88,10 @@
     public void fireMousePressed(double deltaX, double deltaY, KeyModifier... modifiers) {
         fireMouseEvent(MouseEvent.MOUSE_PRESSED, deltaX, deltaY, modifiers);
     }
+
+    public void fireMousePressed(int clickCount, double deltaX, double deltaY, KeyModifier... modifiers) {
+        fireMouseEvent(MouseEvent.MOUSE_PRESSED, MouseButton.PRIMARY, clickCount, deltaX, deltaY, modifiers);
+    }
     
     public void fireMouseReleased() {
         fireMouseEvent(MouseEvent.MOUSE_RELEASED);
--- a/modules/controls/src/test/java/com/sun/javafx/scene/control/infrastructure/VirtualFlowTestUtils.java	Wed Sep 04 14:10:32 2013 +1200
+++ b/modules/controls/src/test/java/com/sun/javafx/scene/control/infrastructure/VirtualFlowTestUtils.java	Wed Sep 04 14:11:01 2013 +1200
@@ -51,12 +51,20 @@
     }
 
     public static void clickOnRow(final Control control, int row, KeyModifier... modifiers) {
-        clickOnRow(control, row, false, modifiers);
+        clickOnRow(control, row, 1, false, modifiers);
+    }
+
+    public static void clickOnRow(final Control control, int row, int clickCount, KeyModifier... modifiers) {
+        clickOnRow(control, row, clickCount, false, modifiers);
+    }
+
+    public static void clickOnRow(final Control control, int row, boolean ignoreChildren, KeyModifier... modifiers) {
+        clickOnRow(control, row, 1, ignoreChildren, modifiers);
     }
 
     // ignore children allows clicking on the row, rather than a child in that row.
     // This is good for testing, for example, TableRowBehavior
-    public static void clickOnRow(final Control control, int row, boolean ignoreChildren, KeyModifier... modifiers) {
+    public static void clickOnRow(final Control control, int row, int clickCount, boolean ignoreChildren, KeyModifier... modifiers) {
         IndexedCell cell = VirtualFlowTestUtils.getCell(control, row);
 
         if (! ignoreChildren && ((cell instanceof TableRow) || (cell instanceof TreeTableRow))) {
@@ -65,7 +73,7 @@
                     continue;
                 }
                 IndexedCell<?> childCell = (IndexedCell<?>)n;
-                new MouseEventFirer(childCell).fireMousePressAndRelease(modifiers);
+                new MouseEventFirer(childCell).fireMousePressAndRelease(clickCount, modifiers);
                 break;
             }
         } else {
@@ -76,7 +84,7 @@
                 mef.fireMousePressed(cell.getWidth(), cell.getHeight() / 2.0, modifiers);
                 mef.fireMouseReleased(cell.getWidth(), cell.getHeight() / 2.0, modifiers);
             } else {
-                new MouseEventFirer(cell).fireMousePressAndRelease(modifiers);
+                new MouseEventFirer(cell).fireMousePressAndRelease(clickCount, modifiers);
             }
         }
     }