summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-02-15 18:01:20 +0100
committerSven Gothel <[email protected]>2013-02-15 18:01:20 +0100
commitd178475967536f4d1e58fd6e0be49b03fe4cd4b7 (patch)
tree1e18d9b2d6c099db7297de1957374bba2e39569a
parent3567e7e8519f82720f98b0b2ac30456cbfeddc0d (diff)
Refine unit test for Bug 691: Add onscreen/offscreen tests [if available] ; Move tests to 'acore'.
-rwxr-xr-xmake/scripts/tests.sh6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAddRemove01SwingAWT.java)36
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAddRemove02NewtCanvasAWT.java)39
3 files changed, 62 insertions, 19 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index ca337e431..559c2aa6a 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -301,8 +301,8 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext12FPSAnimNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAddRemove01SwingAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAddRemove02NewtCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove01GLCanvasSwingAWT $*
+testawt com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove02GLWindowNewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryOffscrnCapsNEWT $*
@@ -360,7 +360,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug611AWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAddRemove01SwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java
index 5e879d7ed..2038124b5 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAddRemove01SwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.opengl.test.junit.jogl.awt;
+package com.jogamp.opengl.test.junit.jogl.acore;
import java.awt.AWTException;
import java.awt.BorderLayout;
@@ -43,6 +43,8 @@ import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
+import jogamp.nativewindow.jawt.JAWTUtil;
+
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -51,7 +53,7 @@ import org.junit.Test;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.UITestCase;
-public class TestGLCanvasAddRemove01SwingAWT extends UITestCase {
+public class TestAddRemove01GLCanvasSwingAWT extends UITestCase {
static long durationPerTest = 50;
static int addRemoveCount = 15;
static boolean shallUseOffscreenFBOLayer = false;
@@ -152,14 +154,14 @@ public class TestGLCanvasAddRemove01SwingAWT extends UITestCase {
} } ) ;
}
- protected void runTestGL(GLCapabilities caps, int addRemoveOpCount)
+ protected void runTestGL(boolean onscreen, GLCapabilities caps, int addRemoveOpCount)
throws AWTException, InterruptedException, InvocationTargetException
{
for(int i=0; i<addRemoveOpCount; i++) {
final GLCanvas glc = new GLCanvas(caps);
Assert.assertNotNull(glc);
- if(shallUseOffscreenFBOLayer || shallUseOffscreenPBufferLayer) {
+ if( !onscreen ) {
glc.setShallUseOffscreenLayer(true);
}
Dimension glc_sz = new Dimension(width, height);
@@ -187,17 +189,37 @@ public class TestGLCanvasAddRemove01SwingAWT extends UITestCase {
}
@Test
- public void test01()
+ public void test01Onscreen()
throws AWTException, InterruptedException, InvocationTargetException
{
+ if( shallUseOffscreenFBOLayer || shallUseOffscreenPBufferLayer || JAWTUtil.isOffscreenLayerRequired() ) {
+ System.err.println("Offscreen test requested or platform requires it.");
+ return;
+ }
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
if(shallUseOffscreenPBufferLayer) {
caps.setPBuffer(true);
caps.setOnscreen(true); // simulate normal behavior ..
}
- runTestGL(caps, addRemoveCount);
+ runTestGL(true, caps, addRemoveCount);
}
+ @Test
+ public void test02Offscreen()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( !JAWTUtil.isOffscreenLayerSupported() ) {
+ System.err.println("Platform doesn't support offscreen test.");
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ if(shallUseOffscreenPBufferLayer) {
+ caps.setPBuffer(true);
+ caps.setOnscreen(true); // simulate normal behavior ..
+ }
+ runTestGL(false, caps, addRemoveCount);
+ }
+
public static void main(String args[]) throws IOException {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -227,6 +249,6 @@ public class TestGLCanvasAddRemove01SwingAWT extends UITestCase {
if(waitForKey) {
UITestCase.waitForKey("Start");
}
- org.junit.runner.JUnitCore.main(TestGLCanvasAddRemove01SwingAWT.class.getName());
+ org.junit.runner.JUnitCore.main(TestAddRemove01GLCanvasSwingAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAddRemove02NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java
index 3f9d677f9..0f12f967a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLCanvasAddRemove02NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java
@@ -26,7 +26,7 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.opengl.test.junit.jogl.awt;
+package com.jogamp.opengl.test.junit.jogl.acore;
import java.awt.AWTException;
import java.awt.BorderLayout;
@@ -43,6 +43,8 @@ import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
+import jogamp.nativewindow.jawt.JAWTUtil;
+
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -53,7 +55,7 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.UITestCase;
-public class TestGLCanvasAddRemove02NewtCanvasAWT extends UITestCase {
+public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase {
static long durationPerTest = 50;
static int addRemoveCount = 15;
static boolean shallUseOffscreenFBOLayer = false;
@@ -154,7 +156,7 @@ public class TestGLCanvasAddRemove02NewtCanvasAWT extends UITestCase {
} } ) ;
}
- protected void runTestGL(GLCapabilities caps, int addRemoveOpCount)
+ protected void runTestGL(boolean onscreen, GLCapabilities caps, int addRemoveOpCount)
throws AWTException, InterruptedException, InvocationTargetException
{
@@ -163,7 +165,7 @@ public class TestGLCanvasAddRemove02NewtCanvasAWT extends UITestCase {
final NewtCanvasAWT glc = new NewtCanvasAWT(glw);
Assert.assertNotNull(glc);
- if(shallUseOffscreenFBOLayer || shallUseOffscreenPBufferLayer) {
+ if( !onscreen ) {
glc.setShallUseOffscreenLayer(true);
}
Dimension glc_sz = new Dimension(width, height);
@@ -192,18 +194,37 @@ public class TestGLCanvasAddRemove02NewtCanvasAWT extends UITestCase {
}
@Test
- public void test01()
+ public void test01Onscreen()
throws AWTException, InterruptedException, InvocationTargetException
{
+ if( shallUseOffscreenFBOLayer || shallUseOffscreenPBufferLayer || JAWTUtil.isOffscreenLayerRequired() ) {
+ System.err.println("Offscreen test requested or platform requires it.");
+ return;
+ }
GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
if(shallUseOffscreenPBufferLayer) {
caps.setPBuffer(true);
- caps.setOnscreen(true); // get native NEWT Window, not OffscreenWindow
+ caps.setOnscreen(true); // simulate normal behavior ..
}
-
- runTestGL(caps, addRemoveCount);
+ runTestGL(true, caps, addRemoveCount);
}
+ @Test
+ public void test02Offscreen()
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ if( !JAWTUtil.isOffscreenLayerSupported() ) {
+ System.err.println("Platform doesn't support offscreen test.");
+ return;
+ }
+ GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ if(shallUseOffscreenPBufferLayer) {
+ caps.setPBuffer(true);
+ caps.setOnscreen(true); // simulate normal behavior ..
+ }
+ runTestGL(false, caps, addRemoveCount);
+ }
+
public static void main(String args[]) throws IOException {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -233,6 +254,6 @@ public class TestGLCanvasAddRemove02NewtCanvasAWT extends UITestCase {
if(waitForKey) {
UITestCase.waitForKey("Start");
}
- org.junit.runner.JUnitCore.main(TestGLCanvasAddRemove02NewtCanvasAWT.class.getName());
+ org.junit.runner.JUnitCore.main(TestAddRemove02GLWindowNewtCanvasAWT.class.getName());
}
}