summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java124
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java127
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java2
7 files changed, 20 insertions, 277 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
index 9f2820a37..976885de4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java
@@ -93,12 +93,12 @@ public class TestShutdownCompleteAWT extends UITestCase {
long t1 = System.nanoTime();
runTestGL();
long t2 = System.nanoTime();
- GLProfile.shutdown(GLProfile.ShutdownType.COMPLETE);
+ GLProfile.shutdown();
long t3 = System.nanoTime();
System.err.println("Total: "+ (t3-t0)/1e6 +"ms");
System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e6 +"ms");
System.err.println(" Demo Code: "+ (t2-t1)/1e6 +"ms");
- System.err.println(" GLProfile.shutdown(COMPLETE): "+ (t3-t2)/1e6 +"ms");
+ System.err.println(" GLProfile.shutdown(): "+ (t3-t2)/1e6 +"ms");
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
index b21ad5b5b..f376cd6d4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java
@@ -48,8 +48,12 @@ public class TestShutdownCompleteNEWT extends UITestCase {
static long duration = 300; // ms
- protected void runTestGL() throws InterruptedException {
- GLWindow glWindow = GLWindow.create(new GLCapabilities(GLProfile.getGL2ES2()));
+ protected void runTestGL(boolean onscreen) throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
+ caps.setOnscreen(onscreen);
+ caps.setPBuffer(!onscreen);
+
+ GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test");
@@ -82,19 +86,19 @@ public class TestShutdownCompleteNEWT extends UITestCase {
GLProfile.initSingleton();
long t1 = System.nanoTime();
if(!initOnly) {
- runTestGL();
+ runTestGL(true);
}
long t2 = System.nanoTime();
if(glInfo) {
System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, false).toString());
}
long t3 = System.nanoTime();
- GLProfile.shutdown(GLProfile.ShutdownType.COMPLETE);
+ GLProfile.shutdown();
long t4 = System.nanoTime();
System.err.println("Total: "+ (t3-t0)/1e6 +"ms");
System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e6 +"ms");
System.err.println(" Demo Code: "+ (t2-t1)/1e6 +"ms");
- System.err.println(" GLProfile.shutdown(COMPLETE): "+ (t4-t3)/1e6 +"ms");
+ System.err.println(" GLProfile.shutdown(): "+ (t4-t3)/1e6 +"ms");
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java
deleted file mode 100644
index 3274ea820..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.opengl.test.junit.jogl.acore;
-
-import java.awt.Frame;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.awt.GLCanvas;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
-import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.util.Animator;
-
-public class TestShutdownSharedAWT extends UITestCase {
-
- static long duration = 300; // ms
-
- protected void runTestGL() throws InterruptedException, InvocationTargetException {
- final Frame frame = new Frame("Gears AWT Test");
- Assert.assertNotNull(frame);
-
- final GLCanvas glCanvas = new GLCanvas(new GLCapabilities(GLProfile.getGL2ES2()));
- Assert.assertNotNull(glCanvas);
- frame.add(glCanvas);
- frame.setSize(256, 256);
-
- glCanvas.addGLEventListener(new GearsES2(1));
-
- Animator animator = new Animator(glCanvas);
-
- javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame.setVisible(true);
- }});
- animator.setUpdateFPSFrames(60, System.err);
- animator.start();
- Assert.assertEquals(true, animator.isAnimating());
- Assert.assertEquals(true, glCanvas.isVisible());
- Assert.assertEquals(true, glCanvas.isDisplayable());
-
- while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
- Thread.sleep(100);
- }
- Assert.assertEquals(true, glCanvas.isRealized());
-
- animator.stop();
- Assert.assertEquals(false, animator.isAnimating());
- frame.setVisible(false);
- Assert.assertEquals(false, frame.isVisible());
- javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame.remove(glCanvas);
- frame.dispose();
- }});
- }
-
- protected void oneLife() throws InterruptedException, InvocationTargetException {
- long t0 = System.nanoTime();
- GLProfile.initSingleton();
- long t1 = System.nanoTime();
- runTestGL();
- long t2 = System.nanoTime();
- GLProfile.shutdown(GLProfile.ShutdownType.SHARED_ONLY);
- long t3 = System.nanoTime();
- System.err.println("Total: "+ (t3-t0)/1e6 +"ms");
- System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e6 +"ms");
- System.err.println(" Demo Code: "+ (t2-t1)/1e6 +"ms");
- System.err.println(" GLProfile.shutdown(SHARED): "+ (t3-t2)/1e6 +"ms");
- }
-
- @Test
- public void test01OneLife() throws InterruptedException, InvocationTargetException {
- oneLife();
- }
-
- @Test
- public void test01AnotherLife() throws InterruptedException, InvocationTargetException {
- oneLife();
- }
-
- @Test
- public void test01TwoLifes() throws InterruptedException, InvocationTargetException {
- oneLife();
- oneLife();
- }
-
- public static void main(String args[]) throws IOException {
- String tstname = TestShutdownSharedAWT.class.getName();
- org.junit.runner.JUnitCore.main(tstname);
- }
-
-}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
deleted file mode 100644
index 8db7dff9b..000000000
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Copyright 2010 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.opengl.test.junit.jogl.acore;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
-import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.util.Animator;
-
-public class TestShutdownSharedNEWT extends UITestCase {
-
- static long duration = 300; // ms
-
- protected void runTestGL() throws InterruptedException {
- GLWindow glWindow = GLWindow.create(new GLCapabilities(GLProfile.getGL2ES2()));
- Assert.assertNotNull(glWindow);
- glWindow.setTitle("Gears NEWT Test");
-
- glWindow.addGLEventListener(new GearsES2());
-
- Animator animator = new Animator(glWindow);
-
- glWindow.setSize(256, 256);
- glWindow.setVisible(true);
- animator.setUpdateFPSFrames(60, System.err);
- animator.start();
- Assert.assertEquals(true, animator.isAnimating());
- Assert.assertEquals(true, glWindow.isVisible());
- Assert.assertEquals(true, glWindow.isNativeValid());
- Assert.assertEquals(true, glWindow.isRealized());
-
- while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
- Thread.sleep(100);
- }
-
- animator.stop();
- glWindow.destroy();
- }
-
- protected void oneLife() throws InterruptedException {
- long t0 = System.nanoTime();
- GLProfile.initSingleton();
- long t1 = System.nanoTime();
- runTestGL();
- long t2 = System.nanoTime();
- GLProfile.shutdown(GLProfile.ShutdownType.SHARED_ONLY);
- long t3 = System.nanoTime();
- System.err.println("Total: "+ (t3-t0)/1e6 +"ms");
- System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/1e6 +"ms");
- System.err.println(" Demo Code: "+ (t2-t1)/1e6 +"ms");
- System.err.println(" GLProfile.shutdown(SHARED): "+ (t3-t2)/1e6 +"ms");
- }
-
- @Test
- public void test01OneLife() throws InterruptedException {
- oneLife();
- }
-
- @Test
- public void test01AnotherLife() throws InterruptedException {
- oneLife();
- }
-
- @Test
- public void test01TwoLifes() throws InterruptedException {
- oneLife();
- oneLife();
- }
-
- public static void main(String args[]) throws IOException {
- boolean waitForKey = false;
-
- for(int i=0; i<args.length; i++) {
- if(args[i].equals("-wait")) {
- waitForKey = true;
- }
- }
-
- if(waitForKey) {
- BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
- System.err.println("Press enter to continue");
- try {
- System.err.println(stdin.readLine());
- } catch (IOException e) { }
- }
-
- String tstname = TestShutdownSharedNEWT.class.getName();
- org.junit.runner.JUnitCore.main(tstname);
- }
-
-}
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 fab5bf99b..a79c924d6 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
@@ -85,7 +85,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 loop_shutdown = false;
static boolean forceES2 = false;
@BeforeClass
@@ -258,8 +258,8 @@ public class TestGearsES2NEWT extends UITestCase {
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);
+ if(loop_shutdown) {
+ GLProfile.shutdown();
}
}
}
@@ -316,12 +316,7 @@ public class TestGearsES2NEWT extends UITestCase {
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");
- }
+ loop_shutdown = true;
}
}
wsize = new Dimension(w, h);
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 ff231ef91..f0c3bb684 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
@@ -51,7 +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 loop_shutdown = false;
static boolean vsync = false;
static boolean forceES2 = false;
static boolean doRotate = true;
@@ -129,8 +129,8 @@ public class TestRedSquareES2NEWT extends UITestCase {
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);
+ if(loop_shutdown) {
+ GLProfile.shutdown();
}
}
}
@@ -152,12 +152,7 @@ public class TestRedSquareES2NEWT extends UITestCase {
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");
- }
+ loop_shutdown = true;
}
}
System.err.println("loops "+loops);
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 c3c68e46c..b9f3e67dc 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestScreenMode01NEWT.java
@@ -111,7 +111,7 @@ public class TestScreenMode01NEWT extends UITestCase {
*/
@After
public void cleanupGL() throws InterruptedException {
- GLProfile.shutdown(GLProfile.ShutdownType.COMPLETE);
+ GLProfile.shutdown();
GLProfile.initSingleton();
}