aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-09-02 03:06:23 +0200
committerSven Gothel <[email protected]>2011-09-02 03:06:23 +0200
commita14998effa6b071b79b04a5e72622aff09be8911 (patch)
tree9cee887aeaf2500726ad12ab936ab0bfe77b9d27 /src/test/com
parent800747a6f474966e77cc717aac71a34a3b009d20 (diff)
Test Gears ES1/ES2: Fix lifecycle check (shared gears)
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java12
2 files changed, 14 insertions, 10 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
index bcbb9f57c..4bb584865 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
@@ -25,7 +25,6 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import org.junit.Assert;
@@ -50,6 +49,7 @@ public class GearsES1 implements GLEventListener {
private GearsObject gear1=null, gear2=null, gear3=null;
private float angle = 0.0f;
private int swapInterval;
+ private boolean initialized = false;
private int prevMouseX, prevMouseY;
@@ -84,7 +84,8 @@ public class GearsES1 implements GLEventListener {
public void init(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES1.init ...");
- Assert.assertNull("Gear1 object is not null -> already init", gear1);
+ Assert.assertEquals("already init", false, initialized);
+ initialized = true;
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
@@ -147,7 +148,7 @@ public class GearsES1 implements GLEventListener {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
System.err.println(Thread.currentThread()+" GearsES1.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval);
- Assert.assertNotNull("Gear1 object is null -> not init or already disposed", gear1);
+ Assert.assertEquals("not init or already disposed", true, initialized);
GL2ES1 gl = drawable.getGL().getGL2ES1();
gl.setSwapInterval(swapInterval);
@@ -166,7 +167,8 @@ public class GearsES1 implements GLEventListener {
public void dispose(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES1.dispose ... ");
- Assert.assertNotNull("Gear1 object is null -> not init or already disposed", gear1);
+ Assert.assertEquals("not init or already disposed", true, initialized);
+ initialized = false;
GL gl = drawable.getGL();
gear1.destroy(gl);
gear1 = null;
@@ -178,7 +180,7 @@ public class GearsES1 implements GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- Assert.assertNotNull("Gear1 object is null -> not init or already disposed", gear1);
+ Assert.assertEquals("not init or already disposed", true, initialized);
// Turn the gears' teeth
angle += 2.0f;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index d9e58dded..7567679d4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -38,7 +38,6 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLUniformData;
@@ -59,6 +58,7 @@ public class GearsES2 implements GLEventListener {
private GearsObjectES2 gear1=null, gear2=null, gear3=null;
private float angle = 0.0f;
private int swapInterval = 0;
+ private boolean initialized = false;
private int prevMouseX, prevMouseY;
@@ -94,7 +94,8 @@ public class GearsES2 implements GLEventListener {
public void init(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES2.init ...");
- Assert.assertNull("ShaderState object is not null -> already init", st);
+ Assert.assertEquals("already init", false, initialized);
+ initialized = true;
GL2ES2 gl = drawable.getGL().getGL2ES2();
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
@@ -177,7 +178,7 @@ public class GearsES2 implements GLEventListener {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
System.err.println(Thread.currentThread()+" GearsES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval);
- Assert.assertNotNull("ShaderState object is null -> not init or already disposed", st);
+ Assert.assertEquals("not init or already disposed", true, initialized);
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.setSwapInterval(swapInterval);
@@ -199,7 +200,8 @@ public class GearsES2 implements GLEventListener {
public void dispose(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES2.dispose ... ");
- Assert.assertNotNull("ShaderState object is null -> not init or already disposed", st);
+ Assert.assertEquals("not init or already disposed", true, initialized);
+ initialized = false;
GL2ES2 gl = drawable.getGL().getGL2ES2();
st.useProgram(gl, false);
gear1.destroy(gl);
@@ -216,7 +218,7 @@ public class GearsES2 implements GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- Assert.assertNotNull("ShaderState object is null -> not init or already disposed", st);
+ Assert.assertEquals("not init or already disposed", true, initialized);
// Turn the gears' teeth
angle += 2.0f;