summaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit')
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java95
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java106
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java39
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java2
4 files changed, 228 insertions, 14 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java
new file mode 100755
index 000000000..a1ff0d860
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01CORE.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution 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.
+ *
+ * Neither the name Sven Gothel or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.acore;
+
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+import javax.media.opengl.*;
+
+import com.jogamp.newt.*;
+import java.io.IOException;
+
+public class TestGLProfile01CORE {
+ static GLProfile glp;
+ static GLDrawableFactory factory;
+
+ @BeforeClass
+ public static void initClass() {
+ glp = GLProfile.getDefault();
+ Assert.assertNotNull(glp);
+ factory = GLDrawableFactory.getFactory(glp);
+ Assert.assertNotNull(factory);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ factory.shutdown();
+ factory=null;
+ }
+
+ @Test
+ public void test01GLProfileDefault() {
+ System.out.println("GLProfile <static> "+GLProfile.glAvailabilityToString());
+ }
+
+ @Test
+ public void test02GLProfileMaxFixedFunc() {
+ System.out.println("GLProfile <static> getMaxFixedFunc(): "+GLProfile.getMaxFixedFunc());
+ }
+
+ @Test
+ public void test02GLProfileMaxProgrammable() {
+ System.out.println("GLProfile <static> getMaxProgrammable(): "+GLProfile.getMaxProgrammable());
+ }
+
+ public static void main(String args[]) throws IOException {
+ String tstname = TestGLProfile01CORE.class.getName();
+ org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
+ tstname,
+ "filtertrace=true",
+ "haltOnError=false",
+ "haltOnFailure=false",
+ "showoutput=true",
+ "outputtoformatters=true",
+ "logfailedtests=true",
+ "logtestlistenerevents=true",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
+ "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
new file mode 100755
index 000000000..ac34b46b5
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution 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.
+ *
+ * Neither the name Sven Gothel or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+package com.jogamp.test.junit.jogl.awt;
+
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.GLCanvas;
+import com.jogamp.opengl.util.Animator;
+
+import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
+import java.awt.Frame;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.After;
+import org.junit.Test;
+
+public class TestAWT01GLn {
+ Frame frame=null;
+ GLCanvas glCanvas=null;
+
+ @Before
+ public void init() {
+ frame = new Frame("Texture Test");
+ Assert.assertNotNull(frame);
+ }
+
+ @After
+ public void release() {
+ Assert.assertNotNull(frame);
+ Assert.assertNotNull(glCanvas);
+ frame.setVisible(false);
+ frame.remove(glCanvas);
+ frame.dispose();
+ frame=null;
+ glCanvas=null;
+ }
+
+ protected void runTestGL(GLCapabilities caps) throws InterruptedException {
+ glCanvas = new GLCanvas(caps);
+ Assert.assertNotNull(glCanvas);
+ frame.add(glCanvas);
+ frame.setSize(512, 512);
+
+ glCanvas.addGLEventListener(new Gears());
+
+ Animator animator = new Animator(glCanvas);
+ frame.setVisible(true);
+ animator.start();
+
+ Thread.sleep(500); // 500 ms
+
+ animator.stop();
+ }
+
+ @Test
+ public void test01GLDefault() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ runTestGL(caps);
+ }
+
+ /** Both fail on ATI .. if GLn n>2
+ public void test02GL3bc() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL3bc));
+ runTestGL(caps);
+ }
+
+ public void test03GLMaxFixed() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(GLProfile.getMaxFixedFunc());
+ runTestGL(caps);
+ } */
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestAWT01GLn.class.getName());
+ }
+}
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
index ec03bec95..459b41f16 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -55,16 +55,16 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import java.io.IOException;
public class TestOffscreen01NEWT {
- static GLProfile glp;
+ static GLProfile glpDefault;
static GLDrawableFactory factory;
static int width, height;
- GLCapabilities caps;
+ GLCapabilities capsDefault;
@BeforeClass
public static void initClass() {
- glp = GLProfile.getDefault();
- Assert.assertNotNull(glp);
- factory = GLDrawableFactory.getFactory(glp);
+ glpDefault = GLProfile.getDefault();
+ Assert.assertNotNull(glpDefault);
+ factory = GLDrawableFactory.getFactory(glpDefault);
Assert.assertNotNull(factory);
width = 640;
height = 480;
@@ -78,7 +78,8 @@ public class TestOffscreen01NEWT {
@Before
public void init() {
- caps = new GLCapabilities(glp);
+ capsDefault = new GLCapabilities(glpDefault);
+ Assert.assertNotNull(capsDefault);
}
private void do01OffscreenWindowPBuffer(GLCapabilities caps) {
@@ -115,20 +116,20 @@ public class TestOffscreen01NEWT {
@Test
public void test01aOffscreenWindowPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
do01OffscreenWindowPBuffer(caps2);
}
@Test
public void test01bOffscreenWindowPBufferStencil() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
caps2.setStencilBits(8);
do01OffscreenWindowPBuffer(caps2);
}
@Test
public void test01cOffscreenWindowPBufferStencilAlpha() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
caps2.setStencilBits(8);
caps2.setAlphaBits(8);
do01OffscreenWindowPBuffer(caps2);
@@ -136,7 +137,7 @@ public class TestOffscreen01NEWT {
@Test
public void test01cOffscreenWindowPBuffer555() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
caps2.setRedBits(5);
caps2.setGreenBits(5);
caps2.setBlueBits(5);
@@ -145,7 +146,7 @@ public class TestOffscreen01NEWT {
@Test
public void test02Offscreen3Windows1DisplayPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
int winnum = 3, i;
Window windows[] = new Window[winnum];
GLWindow glWindows[] = new GLWindow[winnum];
@@ -192,7 +193,7 @@ public class TestOffscreen01NEWT {
@Test
public void test03Offscreen3Windows3DisplaysPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
int winnum = 3, i;
Display displays[] = new Display[winnum];
Screen screens[] = new Screen[winnum];
@@ -240,7 +241,7 @@ public class TestOffscreen01NEWT {
@Test
public void test04OffscreenSnapshotWithDemoPBuffer() {
- GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, true, false);
+ GLCapabilities caps2 = WindowUtilNEWT.fixCaps(capsDefault, false, true, false);
System.out.println("Create Window 1");
Display display = NewtFactory.createDisplay(null); // local display
@@ -283,6 +284,12 @@ public class TestOffscreen01NEWT {
@Test
public void test11OffscreenWindowPixmap() {
+ // Offscreen doesn't work on >= GL3 (ATI)
+ GLProfile glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+
GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false);
Display display = NewtFactory.createDisplay(null); // local display
@@ -318,6 +325,12 @@ public class TestOffscreen01NEWT {
@Test
public void test14OffscreenSnapshotWithDemoPixmap() {
+ // Offscreen doesn't work on >= GL3 (ATI)
+ GLProfile glp = GLProfile.get(GLProfile.GL2);
+ Assert.assertNotNull(glp);
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+
GLCapabilities caps2 = WindowUtilNEWT.fixCaps(caps, false, false, false);
System.out.println("Create Window 1");
diff --git a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
index 563c7f88e..4bbbaa271 100755
--- a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -93,7 +93,7 @@ public class TestTexture01AWT {
frame.setVisible(true);
animator.start();
- Thread.sleep(1000); // 1000 ms
+ Thread.sleep(500); // 500 ms
animator.stop();
frame.setVisible(false);