提交 ef18ca7c 编写于 作者: D dav

6956646: Test: MouseWheelEvent/InfiniteRecursion test receives more MouseWheelEvents than expected

Reviewed-by: serb, dcherepanov
上级 01bdbf04
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -50,6 +50,11 @@ import test.java.awt.regtesthelpers.Sysout; ...@@ -50,6 +50,11 @@ import test.java.awt.regtesthelpers.Sysout;
public class InfiniteRecursion { public class InfiniteRecursion {
final static Robot robot = Util.createRobot(); final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5; 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; static int actualEvents = 0;
public static void main(String []s) public static void main(String []s)
...@@ -96,8 +101,10 @@ public class InfiniteRecursion { ...@@ -96,8 +101,10 @@ public class InfiniteRecursion {
Util.waitForIdle(robot); Util.waitForIdle(robot);
if (actualEvents != MOVE_COUNT * 2) { //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); //result in a single wheel rotation.
if (actualEvents != EXPECTED_COUNT) {
AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
} }
} }
} }
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -50,6 +50,9 @@ import test.java.awt.regtesthelpers.Sysout; ...@@ -50,6 +50,9 @@ import test.java.awt.regtesthelpers.Sysout;
public class InfiniteRecursion_1 { public class InfiniteRecursion_1 {
final static Robot robot = Util.createRobot(); final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5; 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; static int actualEvents = 0;
public static void main(String []s) public static void main(String []s)
...@@ -95,8 +98,10 @@ public class InfiniteRecursion_1 { ...@@ -95,8 +98,10 @@ public class InfiniteRecursion_1 {
} }
Util.waitForIdle(robot); Util.waitForIdle(robot);
if (actualEvents != MOVE_COUNT * 2) { //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); //result in a single wheel rotation.
if (actualEvents != EXPECTED_COUNT) {
AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
} }
} }
} }
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -56,6 +56,9 @@ import java.applet.Applet; ...@@ -56,6 +56,9 @@ import java.applet.Applet;
public class InfiniteRecursion_2 extends Applet { public class InfiniteRecursion_2 extends Applet {
final static Robot robot = Util.createRobot(); final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5; 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; static int actualEvents = 0;
public void init() public void init()
...@@ -107,8 +110,10 @@ public class InfiniteRecursion_2 extends Applet { ...@@ -107,8 +110,10 @@ public class InfiniteRecursion_2 extends Applet {
} }
Util.waitForIdle(robot); Util.waitForIdle(robot);
if (actualEvents != MOVE_COUNT * 2) { //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); //result in a single wheel rotation.
if (actualEvents != EXPECTED_COUNT) {
AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
} }
}// start() }// start()
} }
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -50,6 +50,9 @@ import java.applet.Applet; ...@@ -50,6 +50,9 @@ import java.applet.Applet;
public class InfiniteRecursion_3 extends Applet { public class InfiniteRecursion_3 extends Applet {
final static Robot robot = Util.createRobot(); final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5; 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; static int actualEvents = 0;
public void init() public void init()
...@@ -91,8 +94,10 @@ public class InfiniteRecursion_3 extends Applet { ...@@ -91,8 +94,10 @@ public class InfiniteRecursion_3 extends Applet {
} }
Util.waitForIdle(robot); Util.waitForIdle(robot);
if (actualEvents != MOVE_COUNT * 2) { //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); //result in a single wheel rotation.
if (actualEvents != EXPECTED_COUNT) {
AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
} }
}// start() }// start()
} }
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -47,6 +47,8 @@ import test.java.awt.regtesthelpers.Sysout; ...@@ -47,6 +47,8 @@ import test.java.awt.regtesthelpers.Sysout;
public class InfiniteRecursion_4 { public class InfiniteRecursion_4 {
final static Robot robot = Util.createRobot(); final static Robot robot = Util.createRobot();
final static int MOVE_COUNT = 5; 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; static int actualEvents = 0;
public static void main(String []s) public static void main(String []s)
...@@ -80,8 +82,10 @@ public class InfiniteRecursion_4 { ...@@ -80,8 +82,10 @@ public class InfiniteRecursion_4 {
} }
Util.waitForIdle(robot); Util.waitForIdle(robot);
if (actualEvents != MOVE_COUNT * 2) { //Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
AbstractTest.fail("Expected events count: "+ MOVE_COUNT+" Actual events count: "+ actualEvents); //result in a single wheel rotation.
if (actualEvents != EXPECTED_COUNT) {
AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
} }
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册