diff options
author | Sven Gothel <[email protected]> | 2013-01-19 20:05:48 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-01-19 20:05:48 +0100 |
commit | c27f0b37024b8a991512ad8d0856821804bb3692 (patch) | |
tree | 31c17fc676cf1e6d2a9142cd7425c2d0bb078b61 /src/test/com/jogamp/opengl | |
parent | c59f78a4c3dbe9bb63119d1ece781d8f732b58e4 (diff) |
TestSwingAWTRobotUsageBeforeJOGLInitBug411: Fix 'chicken egg' init problem w/ AWTRobot, i.e. NativeWindow not yet initialized.
Regression since: 50f997557b91a2f014ef0c2ea848c5c326d0cfb2
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java index b165a9693..0e9b6cd88 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java @@ -33,6 +33,8 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.*; import java.lang.reflect.InvocationTargetException; + +import javax.media.nativewindow.NativeWindowFactory; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLProfile; import javax.media.opengl.GLCapabilities; @@ -157,7 +159,16 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { robot = new Robot(); robot.setAutoWaitForIdle(true); - Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); + // NativeWindow/JOGL is not initialized yet .. + for (int wait=0; wait<AWTRobotUtil.POLL_DIVIDER && !frame.isVisible(); wait++) { + Thread.sleep(AWTRobotUtil.TIME_SLICE); + } + Assert.assertEquals(true, frame.isVisible()); + + System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.setup(): Before NativeWindow init"); + + NativeWindowFactory.initSingleton(); + AWTRobotUtil.clearAWTFocus(robot); AWTRobotUtil.toFrontAndRequestFocus(robot, frame); AWTRobotUtil.requestFocus(robot, button); |