changeset 4081:b1567059e4fe

6956646: Test: MouseWheelEvent/InfiniteRecursion test receives more MouseWheelEvents than expected Reviewed-by: serb, dcherepanov
author dav
date Thu, 28 Apr 2011 20:14:30 +0400
parents 03d764676479
children 5b001da8768e
files test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java
diffstat 5 files changed, 41 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java	Thu Apr 28 13:26:18 2011 +0400
+++ b/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java	Thu Apr 28 20:14:30 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,11 @@
 public class InfiniteRecursion {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
+
     static int actualEvents = 0;
 
     public static void main(String []s)
@@ -96,8 +101,10 @@
 
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }
 }
--- a/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java	Thu Apr 28 13:26:18 2011 +0400
+++ b/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java	Thu Apr 28 20:14:30 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,9 @@
 public class InfiniteRecursion_1 {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
     static int actualEvents = 0;
 
     public static void main(String []s)
@@ -95,8 +98,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }
 }
--- a/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java	Thu Apr 28 13:26:18 2011 +0400
+++ b/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_2.java	Thu Apr 28 20:14:30 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,6 +56,9 @@
 public class InfiniteRecursion_2 extends Applet {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
     static int actualEvents = 0;
 
     public void init()
@@ -107,8 +110,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }// start()
 }
--- a/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java	Thu Apr 28 13:26:18 2011 +0400
+++ b/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_3.java	Thu Apr 28 20:14:30 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,9 @@
 public class InfiniteRecursion_3 extends Applet {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions,
+    //*2 as Java sends the wheel event to every for nested component in hierarchy under cursor
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2 * 2;
     static int actualEvents = 0;
 
     public void init()
@@ -91,8 +94,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }// start()
 }
--- a/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java	Thu Apr 28 13:26:18 2011 +0400
+++ b/test/java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_4.java	Thu Apr 28 20:14:30 2011 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,8 @@
 public class InfiniteRecursion_4 {
     final static Robot robot = Util.createRobot();
     final static int MOVE_COUNT = 5;
+    //*2 for both rotation directions over a single frame without any siblings
+    final static int EXPECTED_COUNT = MOVE_COUNT * 2;
     static int actualEvents = 0;
 
     public static void main(String []s)
@@ -80,8 +82,10 @@
         }
 
         Util.waitForIdle(robot);
-        if (actualEvents != MOVE_COUNT * 2) {
-            AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents);
+        //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
+        //result in a single wheel rotation.
+        if (actualEvents != EXPECTED_COUNT) {
+            AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
         }
     }
 }