From 85c3bcac2ef65aa7c6a5a4990f1e2559d691a361 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 1 Apr 2011 16:15:21 +0200 Subject: Graph Unit tests must have NEWT in the name / Also added UI locking --- make/scripts/tests.sh | 6 +- .../test/junit/graph/TestRegionRenderer01.java | 156 ------------------- .../test/junit/graph/TestRegionRendererNEWT01.java | 157 +++++++++++++++++++ .../test/junit/graph/TestTextRenderer01.java | 169 -------------------- .../test/junit/graph/TestTextRendererNEWT01.java | 170 +++++++++++++++++++++ 5 files changed, 330 insertions(+), 328 deletions(-) delete mode 100644 src/test/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java create mode 100644 src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java delete mode 100755 src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java create mode 100755 src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index f288d5602..53919ae54 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -196,9 +196,9 @@ function testawtmt() { #testawt com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot #testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $* -#testnoawt com.jogamp.opengl.test.junit.graph.TestRegionRenderer01 $* -#testnoawt com.jogamp.opengl.test.junit.graph.TestTextRenderer01 $* -testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo01 $* +#testnoawt com.jogamp.opengl.test.junit.graph.TestRegionRendererNEWT01 $* +testnoawt com.jogamp.opengl.test.junit.graph.TestTextRendererNEWT01 $* +#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo02 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo01 $* #testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo02 $* diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java deleted file mode 100644 index 9ad4eb41a..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRenderer01.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.jogamp.opengl.test.junit.graph; - -import java.io.IOException; - -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLEventListener; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.jogamp.graph.curve.Region; -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener01; -import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener02; -import com.jogamp.opengl.test.junit.graph.demos.GPURegionRendererListenerBase01; - - -public class TestRegionRenderer01 { - - public static void main(String args[]) throws IOException { - String tstname = TestRegionRenderer01.class.getName(); - org.junit.runner.JUnitCore.main(tstname); - } - - @BeforeClass - public static void initClass() { - GLProfile.initSingleton(true); - NativeWindowFactory.initSingleton(true); - } - - static void destroyWindow(GLWindow window) { - if(null!=window) { - window.destroy(); - } - } - - static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { - Assert.assertNotNull(caps); - - GLWindow window = GLWindow.create(caps); - window.setSize(width, height); - window.setPosition(10, 10); - window.setTitle(title); - Assert.assertNotNull(window); - window.setVisible(true); - - return window; - } - - @Test - public void testRegionRendererR2T01() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); - - GLCapabilities caps = new GLCapabilities(glp); - //caps.setOnscreen(false); - caps.setAlphaBits(4); - - GLWindow window = createWindow("shape-r2t1-msaa0", caps, 800,400); - - GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (Region.TWO_PASS, 1140, false, false); - demo02Listener.attachInputListenerTo(window); - window.addGLEventListener(demo02Listener); - - RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02"); - window.addGLEventListener(listener); - - listener.setTech(-20, 00, 0f, -300, 400); - window.display(); - - listener.setTech(-20, 00, 0f, -150, 800); - window.display(); - - listener.setTech(-20, 00, 0f, -50, 1000); - window.display(); - - destroyWindow(window); - } - - @Test - public void testRegionRendererMSAA01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); - // caps.setOnscreen(false); - caps.setAlphaBits(4); - caps.setSampleBuffers(true); - caps.setNumSamples(4); - - GLWindow window = createWindow("shape-r2t0-msaa1", caps, 800, 400); - - GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.SINGLE_PASS, 0, false, false); - demo01Listener.attachInputListenerTo(window); - window.addGLEventListener(demo01Listener); - - RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01"); - window.addGLEventListener(listener); - - listener.setTech(-20, 00, 0f, -300, 400); - window.display(); - - listener.setTech(-20, 00, 0f, -150, 800); - window.display(); - - listener.setTech(-20, 00, 0f, -50, 1000); - window.display(); - - destroyWindow(window); - } - - private class RegionGLListener implements GLEventListener { - String winTitle; - String name; - GPURegionRendererListenerBase01 impl; - - public RegionGLListener(GPURegionRendererListenerBase01 impl, String title, String name) { - this.impl = impl; - this.winTitle = title; - this.name = name; - } - - public void setTech(float xt, float yt, float angle, int zoom, int fboSize){ - impl.setMatrix(xt, yt, angle, zoom, fboSize); - } - - public void init(GLAutoDrawable drawable) { - impl.init(drawable); - } - - public void display(GLAutoDrawable drawable) { - impl.display(drawable); - - try { - impl.printScreen(drawable, "./", winTitle, name, false); - } catch (GLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void dispose(GLAutoDrawable drawable) { - impl.dispose(drawable); - - } - - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - impl.reshape(drawable, x, y, width, height); - - } - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java new file mode 100644 index 000000000..bb7af25ae --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -0,0 +1,157 @@ +package com.jogamp.opengl.test.junit.graph; + +import java.io.IOException; + +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLCapabilitiesImmutable; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLException; +import javax.media.opengl.GLProfile; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.jogamp.graph.curve.Region; +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener01; +import com.jogamp.opengl.test.junit.graph.demos.GPURegionGLListener02; +import com.jogamp.opengl.test.junit.graph.demos.GPURegionRendererListenerBase01; +import com.jogamp.opengl.test.junit.util.UITestCase; + + +public class TestRegionRendererNEWT01 extends UITestCase { + + public static void main(String args[]) throws IOException { + String tstname = TestRegionRendererNEWT01.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } + + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + NativeWindowFactory.initSingleton(true); + } + + static void destroyWindow(GLWindow window) { + if(null!=window) { + window.destroy(); + } + } + + static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { + Assert.assertNotNull(caps); + + GLWindow window = GLWindow.create(caps); + window.setSize(width, height); + window.setPosition(10, 10); + window.setTitle(title); + Assert.assertNotNull(window); + window.setVisible(true); + + return window; + } + + @Test + public void testRegionRendererR2T01() throws InterruptedException { + GLProfile glp = GLProfile.getGL2ES2(); + + GLCapabilities caps = new GLCapabilities(glp); + //caps.setOnscreen(false); + caps.setAlphaBits(4); + + GLWindow window = createWindow("shape-r2t1-msaa0", caps, 800,400); + + GPURegionGLListener02 demo02Listener = new GPURegionGLListener02 (Region.TWO_PASS, 1140, false, false); + demo02Listener.attachInputListenerTo(window); + window.addGLEventListener(demo02Listener); + + RegionGLListener listener = new RegionGLListener(demo02Listener, window.getTitle(), "GPURegionNewtDemo02"); + window.addGLEventListener(listener); + + listener.setTech(-20, 00, 0f, -300, 400); + window.display(); + + listener.setTech(-20, 00, 0f, -150, 800); + window.display(); + + listener.setTech(-20, 00, 0f, -50, 1000); + window.display(); + + destroyWindow(window); + } + + @Test + public void testRegionRendererMSAA01() throws InterruptedException { + GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + GLCapabilities caps = new GLCapabilities(glp); + // caps.setOnscreen(false); + caps.setAlphaBits(4); + caps.setSampleBuffers(true); + caps.setNumSamples(4); + + GLWindow window = createWindow("shape-r2t0-msaa1", caps, 800, 400); + + GPURegionGLListener01 demo01Listener = new GPURegionGLListener01 (Region.SINGLE_PASS, 0, false, false); + demo01Listener.attachInputListenerTo(window); + window.addGLEventListener(demo01Listener); + + RegionGLListener listener = new RegionGLListener(demo01Listener, window.getTitle(), "GPURegion01"); + window.addGLEventListener(listener); + + listener.setTech(-20, 00, 0f, -300, 400); + window.display(); + + listener.setTech(-20, 00, 0f, -150, 800); + window.display(); + + listener.setTech(-20, 00, 0f, -50, 1000); + window.display(); + + destroyWindow(window); + } + + private class RegionGLListener implements GLEventListener { + String winTitle; + String name; + GPURegionRendererListenerBase01 impl; + + public RegionGLListener(GPURegionRendererListenerBase01 impl, String title, String name) { + this.impl = impl; + this.winTitle = title; + this.name = name; + } + + public void setTech(float xt, float yt, float angle, int zoom, int fboSize){ + impl.setMatrix(xt, yt, angle, zoom, fboSize); + } + + public void init(GLAutoDrawable drawable) { + impl.init(drawable); + } + + public void display(GLAutoDrawable drawable) { + impl.display(drawable); + + try { + impl.printScreen(drawable, "./", winTitle, name, false); + } catch (GLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void dispose(GLAutoDrawable drawable) { + impl.dispose(drawable); + + } + + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + impl.reshape(drawable, x, y, width, height); + + } + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java deleted file mode 100755 index c954c6aa7..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java +++ /dev/null @@ -1,169 +0,0 @@ -package com.jogamp.opengl.test.junit.graph; - -import java.io.IOException; - -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.jogamp.graph.curve.Region; -import com.jogamp.graph.curve.opengl.TextRenderer; -import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.geom.opengl.SVertex; -import com.jogamp.newt.opengl.GLWindow; -import com.jogamp.opengl.test.junit.graph.demos.GPUTextRendererListenerBase01; - - -public class TestTextRenderer01 { - - public static void main(String args[]) throws IOException { - String tstname = TestTextRenderer01.class.getName(); - org.junit.runner.JUnitCore.main(tstname); - } - - @BeforeClass - public static void initClass() { - GLProfile.initSingleton(true); - NativeWindowFactory.initSingleton(true); - } - - static void destroyWindow(GLWindow window) { - if(null!=window) { - window.destroy(); - } - } - - static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { - Assert.assertNotNull(caps); - - GLWindow window = GLWindow.create(caps); - window.setSize(width, height); - window.setPosition(10, 10); - window.setTitle(title); - Assert.assertNotNull(window); - window.setVisible(true); - - return window; - } - - @Test - public void testTextRendererR2T01() throws InterruptedException { - GLProfile glp = GLProfile.getGL2ES2(); - - GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits(4); - - GLWindow window = createWindow("text-r2t1-msaa0", caps, 800,400); - TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS); - textGLListener.attachInputListenerTo(window); - window.addGLEventListener(textGLListener); - - textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, window.getWidth()*2); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4); - window.display(); - - textGLListener.setFontSet(FontFactory.JAVA, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, window.getWidth()*2); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4); - window.display(); - - destroyWindow(window); - } - - @Test - public void testTextRendererMSAA01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); - caps.setAlphaBits(4); - caps.setSampleBuffers(true); - caps.setNumSamples(4); - - GLWindow window = createWindow("text-r2t0-msaa1", caps, 800, 400); - TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS); - textGLListener.attachInputListenerTo(window); - window.addGLEventListener(textGLListener); - - textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, 0); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, 0); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, 0); - window.display(); - - textGLListener.setFontSet(FontFactory.JAVA, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, 0); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, 0); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, 0); - window.display(); - - destroyWindow(window); - } - - private class TextGLListener extends GPUTextRendererListenerBase01 { - String winTitle; - - public TextGLListener(int type) { - super(SVertex.factory(), type, false, false); - } - - public void attachInputListenerTo(GLWindow window) { - super.attachInputListenerTo(window); - winTitle = window.getTitle(); - } - public void setTech(float xt, float yt, float angle, int zoom, int fboSize){ - setMatrix(xt, yt, angle, zoom, fboSize); - } - - public void init(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); - super.init(drawable); - gl.setSwapInterval(1); - gl.glEnable(GL.GL_DEPTH_TEST); - - final TextRenderer textRenderer = (TextRenderer) getRenderer(); - - textRenderer.init(gl); - textRenderer.setAlpha(gl, 1.0f); - textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f); - } - - public void display(GLAutoDrawable drawable) { - super.display(drawable); - - try { - printScreen(drawable, "./", winTitle, false); - } catch (GLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java new file mode 100755 index 000000000..cdf54796b --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT01.java @@ -0,0 +1,170 @@ +package com.jogamp.opengl.test.junit.graph; + +import java.io.IOException; + +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.opengl.GL; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLCapabilitiesImmutable; +import javax.media.opengl.GLException; +import javax.media.opengl.GLProfile; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.jogamp.graph.curve.Region; +import com.jogamp.graph.curve.opengl.TextRenderer; +import com.jogamp.graph.font.FontFactory; +import com.jogamp.graph.geom.opengl.SVertex; +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.test.junit.graph.demos.GPUTextRendererListenerBase01; +import com.jogamp.opengl.test.junit.util.UITestCase; + + +public class TestTextRendererNEWT01 extends UITestCase { + + public static void main(String args[]) throws IOException { + String tstname = TestTextRendererNEWT01.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } + + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + NativeWindowFactory.initSingleton(true); + } + + static void destroyWindow(GLWindow window) { + if(null!=window) { + window.destroy(); + } + } + + static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { + Assert.assertNotNull(caps); + + GLWindow window = GLWindow.create(caps); + window.setSize(width, height); + window.setPosition(10, 10); + window.setTitle(title); + Assert.assertNotNull(window); + window.setVisible(true); + + return window; + } + + @Test + public void testTextRendererR2T01() throws InterruptedException { + GLProfile glp = GLProfile.getGL2ES2(); + + GLCapabilities caps = new GLCapabilities(glp); + caps.setAlphaBits(4); + + GLWindow window = createWindow("text-r2t1-msaa0", caps, 800,400); + TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS); + textGLListener.attachInputListenerTo(window); + window.addGLEventListener(textGLListener); + + textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, window.getWidth()*2); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4); + window.display(); + + textGLListener.setFontSet(FontFactory.JAVA, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, window.getWidth()*2); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, window.getWidth()*3); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, window.getWidth()*4); + window.display(); + + destroyWindow(window); + } + + @Test + public void testTextRendererMSAA01() throws InterruptedException { + GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + GLCapabilities caps = new GLCapabilities(glp); + caps.setAlphaBits(4); + caps.setSampleBuffers(true); + caps.setNumSamples(4); + + GLWindow window = createWindow("text-r2t0-msaa1", caps, 800, 400); + TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS); + textGLListener.attachInputListenerTo(window); + window.addGLEventListener(textGLListener); + + textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, 0); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, 0); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, 0); + window.display(); + + textGLListener.setFontSet(FontFactory.JAVA, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, 0); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, 0); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, 0); + window.display(); + + destroyWindow(window); + } + + private class TextGLListener extends GPUTextRendererListenerBase01 { + String winTitle; + + public TextGLListener(int type) { + super(SVertex.factory(), type, false, false); + } + + public void attachInputListenerTo(GLWindow window) { + super.attachInputListenerTo(window); + winTitle = window.getTitle(); + } + public void setTech(float xt, float yt, float angle, int zoom, int fboSize){ + setMatrix(xt, yt, angle, zoom, fboSize); + } + + public void init(GLAutoDrawable drawable) { + GL2ES2 gl = drawable.getGL().getGL2ES2(); + super.init(drawable); + gl.setSwapInterval(1); + gl.glEnable(GL.GL_DEPTH_TEST); + + final TextRenderer textRenderer = (TextRenderer) getRenderer(); + + textRenderer.init(gl); + textRenderer.setAlpha(gl, 1.0f); + textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f); + } + + public void display(GLAutoDrawable drawable) { + super.display(drawable); + + try { + printScreen(drawable, "./", winTitle, false); + } catch (GLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} -- cgit v1.2.3