aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-09 06:08:19 +0200
committerSven Gothel <[email protected]>2013-06-09 06:08:19 +0200
commit70087b3067df7bfe6612af7388f8e86f77b150b4 (patch)
treef17bb312cc4524d353c866b9b1d206be2637e6f9 /src/test
parenta60e3b1a894c53abe7ab3a19f1f30cfa96886464 (diff)
ScreenMode Unit Tests: Add wait for screen destroy (off-thread)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java7
4 files changed, 12 insertions, 1 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java
index f4eaec5fa..fe5dd93cb 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode00bNEWT.java
@@ -42,6 +42,7 @@ import com.jogamp.newt.Screen;
import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -110,6 +111,7 @@ public class TestScreenMode00bNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
index 2dd16b9d2..a2ce7cec0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
@@ -261,6 +261,7 @@ public class TestScreenMode01NEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
@@ -363,6 +364,7 @@ public class TestScreenMode01NEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java
index 542297209..58bce4cc9 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode02NEWT.java
@@ -49,6 +49,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
import javax.media.nativewindow.util.Dimension;
@@ -167,6 +168,7 @@ public class TestScreenMode02NEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
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 e128123ed..b5f8def3c 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -633,7 +633,12 @@ public class AWTRobotUtil {
*/
public static boolean waitForRealized(Object obj, boolean realized) throws InterruptedException {
int wait;
- if(obj instanceof com.jogamp.newt.Window) {
+ if(obj instanceof com.jogamp.newt.Screen) {
+ com.jogamp.newt.Screen screen = (com.jogamp.newt.Screen) obj;
+ for (wait=0; wait<POLL_DIVIDER && realized != screen.isNativeValid(); wait++) {
+ Thread.sleep(TIME_SLICE);
+ }
+ } else if(obj instanceof com.jogamp.newt.Window) {
com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj;
for (wait=0; wait<POLL_DIVIDER && realized != win.isNativeValid(); wait++) {
Thread.sleep(TIME_SLICE);