changeset 902:3ae1a875814f

Added test for mosue events delivered to nodes moving under still mouse.
author Pavel Safrata
date Thu, 26 Apr 2012 18:06:47 +0200
parents d7260037bad0
children 3fa9344823cf
files javafx-ui-common/test/unit/javafx/scene/MouseTest.java
diffstat 1 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/test/unit/javafx/scene/MouseTest.java	Thu Apr 26 17:16:02 2012 +0200
+++ b/javafx-ui-common/test/unit/javafx/scene/MouseTest.java	Thu Apr 26 18:06:47 2012 +0200
@@ -909,7 +909,31 @@
                 MouseEvent.MOUSE_RELEASED, 266, 266));
         assertTrue(scene.smallSquareTracker.wasLastStill());        
     }
-    
+
+    @Test
+    public void NodeMovementsWithStillMouseShouldFireEnteredExited() {
+        SimpleTestScene scene = new SimpleTestScene();
+        MouseEventGenerator generator = new MouseEventGenerator();
+
+        scene.processEvent(generator.generateMouseEvent(
+                MouseEvent.MOUSE_ENTERED, 250, 250));
+        scene.processEvent(generator.generateMouseEvent(
+                MouseEvent.MOUSE_MOVED, 250, 250));
+        scene.smallSquareTracker.clear();
+
+        assertFalse(scene.smallSquareTracker.exitedMe);
+        ((Rectangle) scene.smallSquareTracker.node).setX(400);
+        ((StubToolkit) Toolkit.getToolkit()).firePulse();
+        assertTrue(scene.smallSquareTracker.exitedMe);
+
+        scene.smallSquareTracker.clear();
+
+        assertFalse(scene.smallSquareTracker.enteredMe);
+        ((Rectangle) scene.smallSquareTracker.node).setX(200);
+        ((StubToolkit) Toolkit.getToolkit()).firePulse();
+        assertTrue(scene.smallSquareTracker.enteredMe);
+    }
+
     private static class SimpleTestScene {
 
         MouseEventTracker sceneTracker;