summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-12-13 02:30:47 +0100
committerSven Gothel <[email protected]>2011-12-13 02:30:47 +0100
commit84f50c99cf125e906555acd11e9375d693978d86 (patch)
tree6c3a918f5e53c9e6a2a9b879cae9959bd90c360c /src/test
parent567bc6a7266ca782051e052b8bab732fc8f92671 (diff)
Fix GLDrawableFactory lack of GLProfile initialization in case get*Factory() is called 1st, add tests. Add performance numbers of init/shutdown in tests.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java52
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java50
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteAWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java11
7 files changed, 145 insertions, 0 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java
new file mode 100644
index 000000000..5523ce5ce
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLCanvasAWT.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2011 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.IOException;
+
+import javax.media.opengl.awt.GLCanvas;
+
+import org.junit.Test;
+
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+public class TestMainVersionGLCanvasAWT extends UITestCase {
+
+ @Test
+ public void testMain() throws InterruptedException {
+ GLCanvas.main(null);
+ }
+
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestMainVersionGLCanvasAWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java
new file mode 100644
index 000000000..d178e34f4
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestMainVersionGLWindowNEWT.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2011 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.IOException;
+import org.junit.Test;
+
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+public class TestMainVersionGLWindowNEWT extends UITestCase {
+
+ @Test
+ public void testMain() throws InterruptedException {
+ GLWindow.main(null);
+ }
+
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestMainVersionGLWindowNEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
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 72ed5742e..1713f4ad6 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
@@ -88,9 +88,17 @@ public class TestShutdownCompleteAWT extends UITestCase {
}
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.COMPLETE);
+ long t3 = System.nanoTime();
+ System.err.println("Total: "+ (t3-t0)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(COMPLETE): "+ (t3-t2)/10e6 +"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 113448e4f..15fe5b3fd 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
@@ -72,9 +72,17 @@ public class TestShutdownCompleteNEWT extends UITestCase {
}
protected void oneLife() throws InterruptedException {
+ long t0 = System.nanoTime();
GLProfile.initSingleton();
+ long t1 = System.nanoTime();
runTestGL();
+ long t2 = System.nanoTime();
GLProfile.shutdown(GLProfile.ShutdownType.COMPLETE);
+ long t3 = System.nanoTime();
+ System.err.println("Total: "+ (t3-t0)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(COMPLETE): "+ (t3-t2)/10e6 +"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
index cf443073a..cc20a20e9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedAWT.java
@@ -87,9 +87,17 @@ public class TestShutdownSharedAWT extends UITestCase {
}
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)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(SHARED): "+ (t3-t2)/10e6 +"ms");
}
@Test
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
index f151aec04..8fc7f0db6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownSharedNEWT.java
@@ -72,9 +72,17 @@ public class TestShutdownSharedNEWT extends UITestCase {
}
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)/10e6 +"ms");
+ System.err.println(" GLProfile.initSingleton(): "+ (t1-t0)/10e6 +"ms");
+ System.err.println(" Demo Code: "+ (t2-t1)/10e6 +"ms");
+ System.err.println(" GLProfile.shutdown(SHARED): "+ (t3-t2)/10e6 +"ms");
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
index f0a77237b..255e5c051 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java
@@ -59,6 +59,9 @@ public class TestRulerNEWT01 extends UITestCase {
@Test
public void test01() throws InterruptedException {
+ long t0 = System.nanoTime();
+ GLProfile.initSingleton();
+ long t1 = System.nanoTime();
// preset ..
final NEWTGLContext.WindowContext winctx = NEWTGLContext.createOnscreenWindow(GLProfile.getGL2ES2(), 640, 480, true);
final GLDrawable drawable = winctx.context.getGLDrawable();
@@ -156,7 +159,15 @@ public class TestRulerNEWT01 extends UITestCase {
Thread.sleep(durationPerTest/10);
}
+ long t2 = System.nanoTime();
+
NEWTGLContext.destroyWindow(winctx);
+
+ long t3 = System.nanoTime();
+
+ System.err.println("t1-t0: "+ (t1-t0)/10e6 +"ms");
+ System.err.println("t3-t0: "+ (t3-t0)/10e6 +"ms");
+ System.err.println("t3-t2: "+ (t3-t2)/10e6 +"ms");
}
public static void main(String args[]) throws IOException {