summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-25 09:33:01 +0200
committerSven Gothel <[email protected]>2013-06-25 09:33:01 +0200
commit7e0e2ea04e619b2731c55fa86f1af42df920de65 (patch)
treecddd1834e7052474e2930f3cba5ace7593458496
parentcc64ad2b1f7904af4e7bd27e927e0bb331db782b (diff)
AWTRobotUtil.*KeyPress/Release: Remove waitForIdle(robot), but call per use case instead.
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java1
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java8
6 files changed, 18 insertions, 14 deletions
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<loops; i++) {
System.err.println("+++ KEY Event Auto-Repeat START Input Loop: "+i);
- AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_A, pressDurationMS);
AWTRobotUtil.waitForIdle(robot);
+ AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_A, pressDurationMS);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_A, 500); // 1s .. no AR anymore
AWTRobotUtil.waitForIdle(robot);
final int minCodeCount = firstIdx + 2;
@@ -182,8 +182,8 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
// add a pair of normal press/release in between auto-repeat!
firstIdx = keyEvents.size();
- AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_B, 10);
AWTRobotUtil.waitForIdle(robot);
+ AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_B, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_B, 250);
AWTRobotUtil.waitForIdle(robot);
for(int j=0; j < 20 && keyAdapter.getQueueSize() < firstIdx+3; j++) { // wait until events are collected
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
index 961b4969e..aeb9f4b25 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
@@ -163,26 +163,27 @@ public class TestNewtKeyEventOrderAWT extends UITestCase {
keyAdapter.reset();
for(int i=0; i<loops; i++) {
// 1
+ AWTRobotUtil.waitForIdle(robot);
AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_A, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_A, 100);
- AWTRobotUtil.waitForIdle(robot);
// 2
+ AWTRobotUtil.waitForIdle(robot);
AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_B, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_B, 100);
- AWTRobotUtil.waitForIdle(robot);
// 3 + 4
+ AWTRobotUtil.waitForIdle(robot);
AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_A, 10);
AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_B, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_A, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_B, 10);
- AWTRobotUtil.waitForIdle(robot);
// 5 + 6
+ AWTRobotUtil.waitForIdle(robot);
AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_A, 10);
AWTRobotUtil.keyPress(0, robot, true, java.awt.event.KeyEvent.VK_B, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_B, 10);
AWTRobotUtil.keyPress(0, robot, false, java.awt.event.KeyEvent.VK_A, 10);
- AWTRobotUtil.waitForIdle(robot);
}
+ AWTRobotUtil.waitForIdle(robot);
robot.delay(250);
// dumpKeyEvents(keyAdapter.getQueued());
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index 49c56bee1..a760bbb27 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -450,21 +450,17 @@ public class AWTRobotUtil {
}
private static void awtRobotKeyPress(final Robot robot, final int keyCode, final int msDelay) {
- waitForIdle(robot);
robot.keyPress(keyCode);
robot.delay(msDelay);
- waitForIdle(robot);
}
private static void awtRobotKeyRelease(final Robot robot, final int keyCode, final int msDelay) {
- waitForIdle(robot);
robot.keyRelease(keyCode);
robot.delay(msDelay);
- waitForIdle(robot);
}
public static int keyType(int i, Robot robot, int keyCode,
Object obj, KeyEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
- {
+ {
int tc = 0;
int j;
final long t0 = System.currentTimeMillis();
@@ -476,10 +472,12 @@ public class AWTRobotUtil {
if(DEBUG) { System.err.println(i+":"+j+" KC1.0: "+counter+" - regain focus on thread "+Thread.currentThread().getName()); }
requestFocus(null, obj);
}
+ waitForIdle(robot);
if(DEBUG) { System.err.println(i+":"+j+" KC1.1: "+counter+" on thread "+Thread.currentThread().getName()); }
awtRobotKeyPress(robot, keyCode, 50);
if(DEBUG) { System.err.println(i+":"+j+" KC1.2: "+counter+" on thread "+Thread.currentThread().getName()); }
awtRobotKeyRelease(robot, keyCode, 100);
+ waitForIdle(robot);
if(DEBUG) { System.err.println(i+":"+j+" KC1.3: "+counter); }
tc = ( null!=counter ? counter.getCount() : 1 ) - c0;
for (int wait=0; wait<POLL_DIVIDER && 1 > tc; wait++) {