From 980aad0b8c6ba60d1d8c64d4af95c156362a5beb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 31 Aug 2011 02:26:49 +0200 Subject: UnitTests NEWT: Place GLProfile.initSingleton(true) to @BeforeClass method, ensuring init after UI Lock --- .../opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java | 12 +++++++----- .../opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java | 12 +++++++----- .../jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java | 10 ++++++---- .../test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java | 10 ++++++---- .../test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java | 10 ++++++---- .../jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java | 10 ++++++---- .../com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java | 2 +- 7 files changed, 39 insertions(+), 27 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java index f305b3a4c..a42247b12 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java @@ -42,6 +42,7 @@ import javax.media.opengl.GLProfile; import org.junit.Assert; import org.junit.Test; +import org.junit.BeforeClass; import com.jogamp.newt.Display; import com.jogamp.newt.NewtFactory; @@ -51,13 +52,14 @@ import com.jogamp.opengl.test.junit.util.UITestCase; public class TestGLDebug00NEWT extends UITestCase { - static { - GLProfile.initSingleton(true); - } - static String dbgTstMsg0 = "Hello World"; static int dbgTstId0 = 42; + @BeforeClass + public static void initClass() { + // GLProfile.initSingleton(true); + } + public class WindowContext { public final Window window; public final GLContext context; @@ -230,4 +232,4 @@ public class TestGLDebug00NEWT extends UITestCase { } } } - \ No newline at end of file + diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java index 95dc5fe81..6ab6714dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java @@ -41,19 +41,21 @@ import javax.media.opengl.GLRunnable; import org.junit.Assert; import org.junit.Test; +import org.junit.BeforeClass; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.util.UITestCase; public class TestGLDebug01NEWT extends UITestCase { - static { - GLProfile.initSingleton(true); - } - static String dbgTstMsg0 = "Hello World"; static int dbgTstId0 = 42; + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + } + GLWindow createWindow(GLProfile glp, boolean debugGL) { GLCapabilities caps = new GLCapabilities(glp); // @@ -190,4 +192,4 @@ public class TestGLDebug01NEWT extends UITestCase { } } } - \ No newline at end of file + diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java index dd933ad3b..9dd92005f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestFBOMRTNEWT01.java @@ -49,14 +49,16 @@ import javax.media.opengl.GLUniformData; import org.junit.Assert; import org.junit.Test; +import org.junit.BeforeClass; public class TestFBOMRTNEWT01 extends UITestCase { - static { - GLProfile.initSingleton(true); - } - static long durationPerTest = 10; // ms + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + } + @Test public void test01() throws InterruptedException { // preset .. diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java index 838110b56..672938310 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java @@ -46,21 +46,23 @@ import javax.media.opengl.GLUniformData; import org.junit.Assert; import org.junit.Test; +import org.junit.BeforeClass; /** * Testing different vertex attribute (VA) data sets on one shader * and shader state in general. */ public class TestGLSLShaderState01NEWT extends UITestCase { - static { - GLProfile.initSingleton(true); - } - static long durationPerTest = 10; // ms static final int vertices0_loc = 0; // FIXME: AMD needs this to be location 0 ? hu ? static final int colors0_loc = 1; + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + } + @Test public void testShaderState01Validation() throws InterruptedException { // preset .. diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java index fb53794d2..2bb825649 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java @@ -46,21 +46,23 @@ import javax.media.opengl.GLUniformData; import org.junit.Assert; import org.junit.Test; +import org.junit.BeforeClass; /** * Testing different vertex attribute (VA) data sets on one shader * and shader state in general. */ public class TestGLSLShaderState02NEWT extends UITestCase { - static { - GLProfile.initSingleton(true); - } - static long durationPerTest = 10; // ms static final int vertices0_loc = 0; // FIXME: AMD needs this to be location 0 ? hu ? static final int colors0_loc = 5; + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + } + @Test public void testShaderState01ValidationSP1Linked() throws InterruptedException { testShaderState01Validation(true); 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 5019dcaa7..cc97efb43 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 @@ -51,14 +51,16 @@ import javax.media.opengl.GLUniformData; import org.junit.Assert; import org.junit.Test; +import org.junit.BeforeClass; public class TestRulerNEWT01 extends UITestCase { - static { - GLProfile.initSingleton(true); - } - static long durationPerTest = 10; // ms + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + } + @Test public void test01() throws InterruptedException { // preset .. diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java index 2fe99eaab..e6d937d0c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT01GLn.java @@ -73,7 +73,7 @@ public class TestSWT01GLn extends UITestCase { @BeforeClass public static void startup() { - GLProfile.initSingleton( true ); + GLProfile.initSingleton(true); System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() ); } -- cgit v1.2.3