diff options
author | Sven Gothel <[email protected]> | 2012-02-22 22:25:01 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-02-22 22:25:01 +0100 |
commit | 352013de5564013fe2b6444e6469ef2886f1adb9 (patch) | |
tree | 20216d1da7297c5add100e2b9fdcff878f9fdcc3 /src/test/com/jogamp/opengl | |
parent | 52b596b1340c90a57948a81467f61ce98a2c2a66 (diff) |
Fine tune unit tests for ES platforms
Diffstat (limited to 'src/test/com/jogamp/opengl')
13 files changed, 134 insertions, 49 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java index dc08229c4..b3035ff41 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java @@ -33,6 +33,8 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLPbuffer; import javax.media.opengl.GLProfile; import javax.media.opengl.awt.GLCanvas; + +import com.jogamp.common.os.Platform; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -56,12 +58,22 @@ public class TestSharedContextListAWT extends UITestCase { @BeforeClass public static void initClass() { - glp = GLProfile.getDefault(); - Assert.assertNotNull(glp); - caps = new GLCapabilities(glp); - Assert.assertNotNull(caps); - width = 256; - height = 256; + if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + // Turns out on some platforms (Linux ARM), + // Mesa3D software impl. freezes when shared context is used. + setTestSupported(false); + return; + } + if(GLProfile.isAvailable(GLProfile.GL2)) { + glp = GLProfile.get(GLProfile.GL2); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + width = 256; + height = 256; + } else { + setTestSupported(false); + } } private void initShared() { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java index 308094720..8beb7a0c8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java @@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; +import com.jogamp.common.os.Platform; import com.jogamp.newt.opengl.GLWindow; import javax.media.nativewindow.util.InsetsImmutable; @@ -56,12 +57,22 @@ public class TestSharedContextListNEWT extends UITestCase { @BeforeClass public static void initClass() { - glp = GLProfile.getDefault(); - Assert.assertNotNull(glp); - caps = new GLCapabilities(glp); - Assert.assertNotNull(caps); - width = 256; - height = 256; + if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + // Turns out on some platforms (Linux ARM), + // Mesa3D software impl. freezes when shared context is used. + setTestSupported(false); + return; + } + if(GLProfile.isAvailable(GLProfile.GL2)) { + glp = GLProfile.get(GLProfile.GL2); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + width = 256; + height = 256; + } else { + setTestSupported(false); + } } private void initShared() { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java index 4281572d7..89617fc78 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java @@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; +import com.jogamp.common.os.Platform; import com.jogamp.newt.opengl.GLWindow; import javax.media.nativewindow.util.InsetsImmutable; @@ -54,12 +55,22 @@ public class TestSharedContextListNEWT2 extends UITestCase { @BeforeClass public static void initClass() { - glp = GLProfile.get(GLProfile.GL2); - Assert.assertNotNull(glp); - caps = new GLCapabilities(glp); - Assert.assertNotNull(caps); - width = 256; - height = 256; + if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + // Turns out on some platforms (Linux ARM), + // Mesa3D software impl. freezes when shared context is used. + setTestSupported(false); + return; + } + if(GLProfile.isAvailable(GLProfile.GL2)) { + glp = GLProfile.get(GLProfile.GL2); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + width = 256; + height = 256; + } else { + setTestSupported(false); + } } private void initShared() { @@ -108,7 +119,7 @@ public class TestSharedContextListNEWT2 extends UITestCase { return glWindow; } - @Test + @Test(timeout=10000) public void test01() throws InterruptedException { initShared(); GLWindow f1 = runTestGL(new Animator(), 0, 0, true, false); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java index 60f46fe9e..3e68643a9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java @@ -60,9 +60,11 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; import com.jogamp.common.nio.Buffers; +import com.jogamp.common.os.Platform; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; @@ -114,6 +116,19 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { private static FloatBuffer sharedVertexBuffer; private static IntBuffer sharedIndexBuffer; + @BeforeClass + public static void initClass() { + if(Platform.CPUFamily.X86 != Platform.CPU_ARCH.family) { // FIXME + // Turns out on some platforms (Linux ARM), + // Mesa3D software impl. freezes when shared context is used. + setTestSupported(false); + return; + } + if(!GLProfile.isAvailable(GLProfile.GL2)) { + setTestSupported(false); + } + } + static private GLPbuffer initShared(GLCapabilities caps) { GLPbuffer sharedDrawable = GLDrawableFactory.getFactory(caps.getGLProfile()).createGLPbuffer(null, caps, null, 64, 64, null); Assert.assertNotNull(sharedDrawable); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java index 6e48e44fe..ff46347ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.acore; +import com.jogamp.common.os.Platform; import com.jogamp.newt.opengl.GLWindow; import javax.media.nativewindow.util.InsetsImmutable; @@ -54,12 +55,16 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { @BeforeClass public static void initClass() { - glp = GLProfile.getDefault(); - Assert.assertNotNull(glp); - caps = new GLCapabilities(glp); - Assert.assertNotNull(caps); - width = 256; - height = 256; + if(GLProfile.isAvailable(GLProfile.GL2ES1)) { + glp = GLProfile.get(GLProfile.GL2ES1); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + width = 256; + height = 256; + } else { + setTestSupported(false); + } } private void initShared() { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java index 022ef2142..1286560bb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java @@ -54,12 +54,16 @@ public class TestSharedContextVBOES2NEWT extends UITestCase { @BeforeClass public static void initClass() { - glp = GLProfile.getDefault(); - Assert.assertNotNull(glp); - caps = new GLCapabilities(glp); - Assert.assertNotNull(caps); - width = 256; - height = 256; + if(GLProfile.isAvailable(GLProfile.GL2ES2)) { + glp = GLProfile.get(GLProfile.GL2ES2); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + width = 256; + height = 256; + } else { + setTestSupported(false); + } } private void initShared() { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java index 5b2cb25b3..c4752bb30 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java @@ -54,12 +54,16 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { @BeforeClass public static void initClass() { - glp = GLProfile.get(GLProfile.GL2); - Assert.assertNotNull(glp); - caps = new GLCapabilities(glp); - Assert.assertNotNull(caps); - width = 256; - height = 256; + if(GLProfile.isAvailable(GLProfile.GL2ES2)) { + glp = GLProfile.get(GLProfile.GL2ES2); + Assert.assertNotNull(glp); + caps = new GLCapabilities(glp); + Assert.assertNotNull(caps); + width = 256; + height = 256; + } else { + setTestSupported(false); + } } private void initShared() { 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 322ce36c4..075aca74b 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 @@ -39,7 +39,7 @@ import javax.media.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.Test; -import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; +import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; @@ -56,7 +56,7 @@ public class TestShutdownCompleteAWT extends UITestCase { frame.add(glCanvas); frame.setSize(256, 256); - glCanvas.addGLEventListener(new Gears(1)); + glCanvas.addGLEventListener(new GearsES2(1)); Animator animator = new Animator(glCanvas); 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 1abac1094..470ba078e 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 @@ -39,7 +39,7 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; +import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; @@ -52,7 +52,7 @@ public class TestShutdownCompleteNEWT extends UITestCase { Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test"); - glWindow.addGLEventListener(new Gears()); + glWindow.addGLEventListener(new GearsES2()); Animator animator = new Animator(glWindow); 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 a12ef2327..8149e2429 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 @@ -39,7 +39,7 @@ import javax.media.opengl.awt.GLCanvas; import org.junit.Assert; import org.junit.Test; -import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; +import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; @@ -56,7 +56,7 @@ public class TestShutdownSharedAWT extends UITestCase { frame.add(glCanvas); frame.setSize(256, 256); - glCanvas.addGLEventListener(new Gears(1)); + glCanvas.addGLEventListener(new GearsES2(1)); Animator animator = new Animator(glCanvas); 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 99b5a6c48..e1289ba79 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 @@ -39,7 +39,7 @@ import org.junit.Assert; import org.junit.Test; import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; +import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; @@ -52,7 +52,7 @@ public class TestShutdownSharedNEWT extends UITestCase { Assert.assertNotNull(glWindow); glWindow.setTitle("Gears NEWT Test"); - glWindow.addGLEventListener(new Gears()); + glWindow.addGLEventListener(new GearsES2()); Animator animator = new Animator(glWindow); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java index fb6359093..ed308bdfd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.newt; +import com.jogamp.common.os.Platform; import com.jogamp.newt.event.KeyAdapter; import com.jogamp.newt.event.KeyEvent; import com.jogamp.newt.event.TraceWindowAdapter; @@ -65,10 +66,16 @@ public class TestElektronenMultipliziererNEWT extends UITestCase { static int startFrame = 1700; static long duration = 5000; // ms - @AfterClass - public static void releaseClass() { + @BeforeClass + public static void initClass() { + GLProfile glp = GLProfile.getDefault(); + if( ! ( glp.isHardwareRasterizer() && glp.isGL2GL3() ) ) { + // Sorry .. mobile is too slow for this one. + setTestSupported(false); + return; + } } - + protected void run() throws InterruptedException { final ElektronenMultiplizierer demo = new ElektronenMultiplizierer( tRoutineClassName, diff --git a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java index 1ef778090..879c8b161 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java +++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java @@ -28,6 +28,7 @@ package com.jogamp.opengl.test.junit.util; +import com.jogamp.common.os.Platform; import com.jogamp.common.util.locks.SingletonInstance; import org.junit.Before; @@ -36,6 +37,7 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.Rule; import org.junit.rules.TestName; +import org.junit.runner.manipulation.NoTestsRemainException; public abstract class UITestCase { @@ -48,6 +50,8 @@ public abstract class UITestCase { public static final long SINGLE_INSTANCE_LOCK_POLL = 1000; // poll every 1s static volatile SingletonInstance singletonInstance; + + static volatile boolean testSupported = true; private static final synchronized void initSingletonInstance() { if( null == singletonInstance ) { @@ -58,6 +62,11 @@ public abstract class UITestCase { } } } + + public static void setTestSupported(boolean v) { + System.err.println("setTestSupported: "+v); + testSupported = v; + } public final String getTestMethodName() { return _unitTestName.getMethodName(); @@ -86,13 +95,20 @@ public abstract class UITestCase { @Before public void setUp() { - System.err.println("++++ UITestCase.setUp: "+getFullTestName(" - ")); + System.err.print("++++ UITestCase.setUp: "+getFullTestName(" - ")); + if(!testSupported) { + System.err.println(" - "+unsupportedTestMsg); + throw new UnsupportedOperationException(unsupportedTestMsg); + } + System.err.println(); } @After public void tearDown() { System.err.println("++++ UITestCase.tearDown: "+getFullTestName(" - ")); } + + static final String unsupportedTestMsg = "Test not supported on this platform."; } |