aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
parent3567e7e8519f82720f98b0b2ac30456cbfeddc0d (diff)
Refine unit test for Bug 691: Add onscreen/offscreen tests [if available] ; Move tests to 'acore'.
Diffstat (limited to 'src')
-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
2 files changed, 59 insertions, 16 deletions
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());
}
}