aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-01-19 01:20:07 +0100
committerSven Gothel <[email protected]>2012-01-19 01:20:07 +0100
commit249351d96e22999db2ac83ad60eaa5c5c6120bd7 (patch)
tree14ddcd8a4f57c36579006642e6819425a94c8a9a /src/test
parent60d91b002fa941ab971ff9ed5ad6002f72c92af1 (diff)
UI Test AWTRobotUtil's toFront*(): retry requestFocus() within loop.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java25
1 files changed, 14 insertions, 11 deletions
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 b626ed282..35a2d9669 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -130,19 +130,22 @@ public class AWTRobotUtil {
robot.mouseMove( (int) p0.getX(), (int) p0.getY() );
robot.delay(ROBOT_DELAY);
- javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- window.setVisible(true);
- window.toFront();
- window.requestFocus();
- }});
- robot.delay(ROBOT_DELAY);
-
- int wait;
- for (wait=0; wait<POLL_DIVIDER && !window.hasFocus(); wait++) {
+ int wait=0;
+ do {
+ final int _wait = wait;
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if(0==_wait) {
+ window.setVisible(true);
+ window.toFront();
+ }
+ window.requestFocus();
+ }});
Thread.sleep(TIME_SLICE);
- }
+ wait++;
+ } while (wait<POLL_DIVIDER && !window.hasFocus());
final boolean success = wait<POLL_DIVIDER;
+
window.removeWindowFocusListener(winFA);
if(!success) {
System.err.println("*** AWTRobotUtil.toFrontAndRequestFocus() UI failure");