From 7e0e2ea04e619b2731c55fa86f1af42df920de65 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 25 Jun 2013 09:33:01 +0200 Subject: AWTRobotUtil.*KeyPress/Release: Remove waitForIdle(robot), but call per use case instead. --- .../junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java | 1 + .../test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java | 7 +++++-- .../jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java | 3 ++- .../test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java | 4 ++-- .../opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java | 9 +++++---- src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java | 8 +++----- 6 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src/test') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java index 0f9c50baa..e7037aaef 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java @@ -226,6 +226,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { { try { System.err.println("[K-"+_n+"]"); + AWTRobotUtil.waitForIdle(_robot); AWTRobotUtil.newtKeyPress(_n, _robot, true, KeyEvent.VK_0, 10); AWTRobotUtil.newtKeyPress(_n, _robot, false, KeyEvent.VK_0, 0); Thread.sleep( 40L ) ; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java index 19d739a75..226107000 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java @@ -162,6 +162,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { static void testKeyCodeModifier(Robot robot, NEWTKeyAdapter keyAdapter, short modifierKey, int modifierMask, short keyCode, char keyCharOnly, char keyCharMod) { keyAdapter.reset(); + AWTRobotUtil.waitForIdle(robot); AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 100); // release keyCode AWTRobotUtil.waitForIdle(robot); @@ -169,6 +170,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { robot.delay(100); } + AWTRobotUtil.waitForIdle(robot); AWTRobotUtil.newtKeyPress(0, robot, true, modifierKey, 10); // press MOD AWTRobotUtil.newtKeyPress(0, robot, true, keyCode, 10); // press keyCode AWTRobotUtil.newtKeyPress(0, robot, false, keyCode, 10); // release keyCode @@ -202,6 +204,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { final int m3m = InputEvent.SHIFT_MASK; keyAdapter.reset(); + AWTRobotUtil.waitForIdle(robot); AWTRobotUtil.newtKeyPress(0, robot, true, m1k, 10); // press MOD1 AWTRobotUtil.newtKeyPress(0, robot, true, m2k, 10); // press MOD2 AWTRobotUtil.newtKeyPress(0, robot, true, m3k, 10); // press MOD3 @@ -210,9 +213,9 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase { AWTRobotUtil.newtKeyPress(0, robot, false, KeyEvent.VK_1, 100); // release P AWTRobotUtil.newtKeyPress(0, robot, false, m3k, 10); // release MOD AWTRobotUtil.newtKeyPress(0, robot, false, m2k, 10); // release MOD - AWTRobotUtil.newtKeyPress(0, robot, false, m1k, 10); // release MOD - + AWTRobotUtil.newtKeyPress(0, robot, false, m1k, 10); // release MOD AWTRobotUtil.waitForIdle(robot); + for(int j=0; j < 100 && keyAdapter.getQueueSize() < 4+4; j++) { // wait until events are collected robot.delay(100); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java index e1254ae6d..c253bb79b 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java @@ -195,6 +195,7 @@ public class TestNewtKeyCodesAWT extends UITestCase { // System.err.println("*** Segment "+codeSeg.description); int eventCount = 0; for(short c=codeSeg.min; c<=codeSeg.max; c++) { + AWTRobotUtil.waitForIdle(robot); // System.err.println("*** KeyCode 0x"+Integer.toHexString(c)); try { AWTRobotUtil.newtKeyPress(0, robot, true, c, 10); @@ -210,8 +211,8 @@ public class TestNewtKeyCodesAWT extends UITestCase { break; } eventCount++; - AWTRobotUtil.waitForIdle(robot); } + AWTRobotUtil.waitForIdle(robot); for(int j=0; j < 20 && keyAdapter.getQueueSize() < eventCount; j++) { // wait until events are collected robot.delay(100); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java index 508ad2cbf..a131d6db5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java @@ -161,8 +161,8 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { int firstIdx = 0; for(int i=0; i tc; wait++) { -- cgit v1.2.3