summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-05 16:33:46 +0100
committerSven Gothel <[email protected]>2012-03-05 16:33:46 +0100
commitc8c49283b1c373289564a88409dbab9629fc8247 (patch)
tree1af3d875857b3f91afb5bc64b1f6829d2b578ae6 /src
parentb67a89a364677732d0849780226972d7e40aa078 (diff)
Test*ES2Newt: Add shutdown w/ type to internal loop test
Diffstat (limited to 'src')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java20
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java19
2 files changed, 35 insertions, 4 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index 88da8db23..cab46b475 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -40,6 +40,7 @@ import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
@@ -82,6 +83,7 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean mouseConfined = false;
static boolean showFPS = false;
static int loops = 1;
+ static GLProfile.ShutdownType loop_shutdown = null;
static boolean forceES2 = false;
@BeforeClass
@@ -235,16 +237,22 @@ public class TestGearsES2NEWT extends UITestCase {
}
animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
glWindow.destroy();
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
}
@Test
public void test01GL2ES2() throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
- caps.setBackgroundOpaque(opaque);
for(int i=1; i<=loops; i++) {
System.err.println("Loop "+i+"/"+loops);
+ GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
+ caps.setBackgroundOpaque(opaque);
runTestGL(caps, undecorated);
+ if(null != loop_shutdown) {
+ GLProfile.shutdown(loop_shutdown);
+ }
}
}
@@ -301,6 +309,13 @@ public class TestGearsES2NEWT extends UITestCase {
} else if(args[i].equals("-loops")) {
i++;
loops = MiscUtils.atoi(args[i], 1);
+ } else if(args[i].equals("-loop-shutdown")) {
+ i++;
+ switch(MiscUtils.atoi(args[i], 0)) {
+ case 1: loop_shutdown = GLProfile.ShutdownType.SHARED_ONLY; break;
+ case 2: loop_shutdown = GLProfile.ShutdownType.COMPLETE; break;
+ default: throw new IllegalArgumentException("should be [0..2], 0-off, 1-shared, 2-complete");
+ }
}
}
if(useSize) {
@@ -321,6 +336,7 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("mouseVisible "+mouseVisible);
System.err.println("mouseConfined "+mouseConfined);
System.err.println("loops "+loops);
+ System.err.println("loop shutdown "+loop_shutdown);
System.err.println("forceES2 "+forceES2);
if(waitForKey) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
index f658b2b2b..74d52c352 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
@@ -31,13 +31,13 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
-import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
import javax.media.opengl.GLCapabilities;
@@ -51,6 +51,7 @@ import org.junit.Test;
public class TestRedSquareES2NEWT extends UITestCase {
static int width, height;
static int loops = 1;
+ static GLProfile.ShutdownType loop_shutdown = null;
static boolean vsync = false;
static boolean forceES2 = false;
@@ -113,15 +114,21 @@ public class TestRedSquareES2NEWT extends UITestCase {
}
animator.stop();
+ Assert.assertFalse(animator.isAnimating());
+ Assert.assertFalse(animator.isStarted());
glWindow.destroy();
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
}
@Test
public void test01GL2ES2() throws InterruptedException {
- GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
for(int i=1; i<=loops; i++) {
System.err.println("Loop "+i+"/"+loops);
+ GLCapabilities caps = new GLCapabilities(forceES2 ? GLProfile.get(GLProfile.GLES2) : GLProfile.getGL2ES2());
runTestGL(caps);
+ if(null != loop_shutdown) {
+ GLProfile.shutdown(loop_shutdown);
+ }
}
}
@@ -139,9 +146,17 @@ public class TestRedSquareES2NEWT extends UITestCase {
} else if(args[i].equals("-loops")) {
i++;
loops = MiscUtils.atoi(args[i], 1);
+ } else if(args[i].equals("-loop-shutdown")) {
+ i++;
+ switch(MiscUtils.atoi(args[i], 0)) {
+ case 1: loop_shutdown = GLProfile.ShutdownType.SHARED_ONLY; break;
+ case 2: loop_shutdown = GLProfile.ShutdownType.COMPLETE; break;
+ default: throw new IllegalArgumentException("should be [0..2], 0-off, 1-shared, 2-complete");
+ }
}
}
System.err.println("loops "+loops);
+ System.err.println("loop shutdown "+loop_shutdown);
System.err.println("forceES2 "+forceES2);
org.junit.runner.JUnitCore.main(TestRedSquareES2NEWT.class.getName());
}