aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-06-28 21:59:00 +0200
committerSven Gothel <[email protected]>2012-06-28 21:59:00 +0200
commitc03ad260aea0b4a640a5eeb50a206688c531b591 (patch)
tree013c48b78856c78a7e657fb78c6161471c4f2954
parent4f27bcecf7484dc041551f52a5c49e2884cb3867 (diff)
Bug #589 - Enhance snapshot/textIO test: Add offscreen mode; Add AWT onscreen/offscreen-layer resize test.
-rwxr-xr-xmake/scripts/tests.sh7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java29
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java197
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java122
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java33
5 files changed, 301 insertions, 87 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 7a3e74558..646ff2249 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -86,7 +86,7 @@ function jrun() {
#D_ARGS="-Dnativewindow.debug.ToolkitLock.TraceLock -Dnativewindow.debug.X11Util.TraceDisplayLifecycle=true -Dnativewindow.debug.X11Util"
#D_ARGS="-Dnativewindow.debug.X11Util -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnewt.debug=all"
#D_ARGS="-Djogl.debug.GLDrawable -Djogl.debug.GLContext"
- D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=3000 -Djogamp.debug.Lock -Djogl.debug.GLContext.TraceSwitch"
+ #D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=3000 -Djogamp.debug.Lock -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock -Dnativewindow.debug.ToolkitLock.TraceLock"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Dnativewindow.debug.X11Util"
@@ -283,7 +283,7 @@ function testawtswt() {
# swt (testswt)
#
#testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTEclipseGLCanvas01GLn $*
-testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
+#testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testawt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor02GLn $*
#
@@ -332,7 +332,7 @@ testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileNEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite01AWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite01NEWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02AWT $*
+testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02AWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestGLReadBufferUtilTextureIOWrite02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.util.texture.TestTextureSequence01AWT $*
@@ -388,7 +388,6 @@ testswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testnoawt com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT $*
# osx:
-#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLnAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer02NewtCanvasAWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java
index 0abbd7edd..f79a73040 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java
@@ -38,9 +38,12 @@ import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
+import jogamp.nativewindow.jawt.JAWTUtil;
+
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLReadBufferUtil;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -72,9 +75,17 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase {
}
}
- @Test
- public void testOnscreenWritePNG() throws InterruptedException {
+ protected void testWritePNG_Impl(boolean offscreenLayer) throws InterruptedException {
+ if(!offscreenLayer && JAWTUtil.isOffscreenLayerRequired()) {
+ System.err.println("onscreen layer n/a");
+ return;
+ }
+ if(offscreenLayer && !JAWTUtil.isOffscreenLayerSupported()) {
+ System.err.println("offscreen layer n/a");
+ return;
+ }
final GLCanvas glc = new GLCanvas(caps);
+ glc.setShallUseOffscreenLayer(offscreenLayer); // trigger offscreen layer - if supported
Dimension glc_sz = new Dimension(width, height);
glc.setMinimumSize(glc_sz);
glc.setPreferredSize(glc_sz);
@@ -108,6 +119,10 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
}
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true));
+ Assert.assertEquals(JAWTUtil.isOffscreenLayerSupported() && offscreenLayer,
+ glc.isOffscreenLayerSurfaceEnabled());
animator.start();
while(animator.getTotalFPSFrames() < 2) {
@@ -128,6 +143,16 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase {
}
}
+ @Test
+ public void testOnscreenWritePNG() throws InterruptedException {
+ testWritePNG_Impl(false);
+ }
+
+ @Test
+ public void testOffscreenWritePNG() throws InterruptedException {
+ testWritePNG_Impl(true);
+ }
+
public static void main(String args[]) {
org.junit.runner.JUnitCore.main(TestGLReadBufferUtilTextureIOWrite01AWT.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java
new file mode 100644
index 000000000..10dd4ea70
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java
@@ -0,0 +1,197 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.util.texture;
+
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.Threading;
+import javax.media.opengl.awt.GLCanvas;
+
+import jogamp.nativewindow.jawt.JAWTUtil;
+
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLReadBufferUtil;
+
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase {
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+
+ @BeforeClass
+ public static void initClass() {
+ glp = GLProfile.getDefault();
+ Assert.assertNotNull(glp);
+ caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ caps.setAlphaBits(1); // req. alpha channel
+ width = 64;
+ height = 64;
+ }
+
+ protected void snapshot(GLAutoDrawable drawable, GLReadBufferUtil screenshot, int i) {
+ final StringWriter filename = new StringWriter();
+ {
+ final PrintWriter pw = new PrintWriter(filename);
+ final String pfmt = drawable.getChosenGLCapabilities().getAlphaBits() > 0 ? "rgba" : "rgb_";
+ pw.printf("%s-F_rgba-I_%s-%s-n%03d-%04dx%04d.png",
+ getSimpleTestName("."), pfmt, drawable.getGLProfile().getName(), i, drawable.getWidth(), drawable.getHeight());
+ }
+ drawable.getGL().glFinish(); // poor mans sync ..
+ if(screenshot.readPixels(drawable.getGL(), drawable, false)) {
+ screenshot.write(new File(filename.toString()));
+ }
+ }
+
+ protected void testWritePNGWithResizeImpl(boolean offscreenLayer) throws InterruptedException {
+ if(!offscreenLayer && JAWTUtil.isOffscreenLayerRequired()) {
+ System.err.println("onscreen layer n/a");
+ return;
+ }
+ if(offscreenLayer && !JAWTUtil.isOffscreenLayerSupported()) {
+ System.err.println("offscreen layer n/a");
+ return;
+ }
+ final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
+ final GLCanvas glc = new GLCanvas(caps);
+ glc.setShallUseOffscreenLayer(offscreenLayer); // trigger offscreen layer - if supported
+ Dimension glc_sz = new Dimension(width, height);
+ glc.setMinimumSize(glc_sz);
+ glc.setPreferredSize(glc_sz);
+ glc.setSize(glc_sz);
+ final Frame frame = new Frame(getSimpleTestName("."));
+ Assert.assertNotNull(frame);
+ frame.add(glc);
+
+ glc.addGLEventListener(new GearsES2(1));
+ glc.addGLEventListener(new GLEventListener() {
+ int i=0, fw_old=0, dw_old=0, c=0;
+ public void init(GLAutoDrawable drawable) {}
+ public void dispose(GLAutoDrawable drawable) {}
+ public void display(GLAutoDrawable drawable) {
+ final int fw = frame.getWidth();
+ final int fh = frame.getHeight();
+ final int dw = drawable.getWidth();
+ final int dh = drawable.getHeight();
+ final boolean sz_changed = fw_old != fw && dw_old != dw && dw <= 512; // need to check both sizes [frame + drawable], due to async resize of AWT!
+ final boolean snap;
+ if(sz_changed) {
+ c++;
+ snap = c>3; // only snap the 3rd image ..
+ } else {
+ snap = false;
+ }
+
+ if(snap) {
+ System.err.println("XXX: ["+fw_old+", "+dw_old+"], "+fw+"x"+fh+", "+dw+"x"+dh+", sz_changed "+sz_changed+", snap "+snap);
+ c=0;
+ snapshot(drawable, screenshot, i++);
+ dw_old = dw;
+ fw_old = fw;
+ Threading.invoke(true, new Runnable() {
+ public void run() {
+ final Dimension new_sz = new Dimension(2*dw, 2*dh);
+ glc.setMinimumSize(new_sz);
+ glc.setPreferredSize(new_sz);
+ glc.setSize(new_sz);
+ frame.pack();
+ frame.validate();
+ } }, glc.getTreeLock());
+ }
+ }
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+ });
+
+ Animator animator = new Animator(glc);
+ animator.setUpdateFPSFrames(60, null);
+
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ frame.setVisible(true);
+ }});
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true));
+ Assert.assertEquals(JAWTUtil.isOffscreenLayerSupported() && offscreenLayer,
+ glc.isOffscreenLayerSurfaceEnabled());
+ animator.start();
+
+ while(animator.getTotalFPSFrames() < 30) {
+ Thread.sleep(60);
+ }
+
+ animator.stop();
+ try {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ frame.remove(glc);
+ frame.dispose();
+ }});
+ } catch( Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ }
+
+ @Test
+ public void testOnscreenWritePNGWithResize() throws InterruptedException {
+ testWritePNGWithResizeImpl(false);
+ }
+
+ @Test
+ public void testOffscreenWritePNGWithResize() throws InterruptedException {
+ testWritePNGWithResizeImpl(true);
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestGLReadBufferUtilTextureIOWrite02AWT.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java
index 25a773c6a..ed0791f7c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java
@@ -38,10 +38,13 @@ import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLProfile;
+
+import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.jogl.offscreen.WindowUtilNEWT;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -59,86 +62,87 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase {
caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
caps.setAlphaBits(1); // req. alpha channel
- width = 256;
- height = 256;
+ width = 64;
+ height = 64;
}
- protected void snapshot(GLAutoDrawable drawable, GLReadBufferUtil screenshot, String filename) {
+ protected void snapshot(GLAutoDrawable drawable, GLReadBufferUtil screenshot, int i) {
+ final StringWriter filename = new StringWriter();
+ {
+ final PrintWriter pw = new PrintWriter(filename);
+ final String pfmt = drawable.getChosenGLCapabilities().getAlphaBits() > 0 ? "rgba" : "rgb_";
+ pw.printf("%s-F_rgba-I_%s-%s-n%03d-%04dx%04d.png",
+ getSimpleTestName("."), pfmt, drawable.getGLProfile().getName(), i, drawable.getWidth(), drawable.getHeight());
+ }
if(screenshot.readPixels(drawable.getGL(), drawable, false)) {
- screenshot.write(new File(filename));
+ screenshot.write(new File(filename.toString()));
}
}
- @Test
- public void testWriteTGAWithResize() throws InterruptedException {
+ private void testWritePNGWithResizeImpl(boolean offscreen) throws InterruptedException {
final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
- GLWindow glWindow = GLWindow.create(caps);
+ final GLCapabilities caps2 = offscreen ? WindowUtilNEWT.fixCaps(caps, false, true, false) : caps;
+ final GLWindow glWindow = GLWindow.create(caps2);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Shared Gears NEWT Test");
glWindow.setSize(width, height);
glWindow.addGLEventListener(new GearsES2(1));
glWindow.addGLEventListener(new GLEventListener() {
- int i=0;
- public void init(GLAutoDrawable drawable) {}
- public void dispose(GLAutoDrawable drawable) {}
+ int i=0, dw_old=0, c=0;
+ public void init(GLAutoDrawable drawable) {
+ System.err.println("XXX: init");
+ }
+ public void dispose(GLAutoDrawable drawable) {
+ System.err.println("XXX: dispose");
+ }
public void display(GLAutoDrawable drawable) {
- final StringWriter filename = new StringWriter();
- {
- final PrintWriter pw = new PrintWriter(filename);
- final String pfmt = drawable.getChosenGLCapabilities().getAlphaBits() > 0 ? "rgba" : "rgb_";
- pw.printf("%s-F_rgba-I_%s-%s-%03dx%03d-n%03d.tga",
- getSimpleTestName("."), pfmt, drawable.getGLProfile().getName(),
- drawable.getWidth(), drawable.getHeight(), i++);
+ final int dw = drawable.getWidth();
+ final int dh = drawable.getHeight();
+ final boolean sz_changed = dw_old != dw && dw <= 512;
+ final boolean snap;
+ if(sz_changed) {
+ c++;
+ snap = c>1; // only snap the 3rd image ..
+ } else {
+ snap = false;
+ }
+
+ if(snap) {
+ System.err.println("XXX: ["+dw_old+"], "+dw+"x"+dh+", sz_changed "+sz_changed+", snap "+snap);
+ c=0;
+ snapshot(drawable, screenshot, i++);
+ dw_old = dw;
+ new Thread() {
+ @Override
+ public void run() {
+ glWindow.setSize(2*dw, 2*dh);
+ } }.start();
}
- if(screenshot.readPixels(drawable.getGL(), drawable, false)) {
- screenshot.write(new File(filename.toString()));
- }
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
});
+ Animator animator = new Animator(glWindow);
+ animator.setUpdateFPSFrames(60, null);
+
glWindow.setVisible(true);
- Thread.sleep(60);
- glWindow.setSize(300, 300);
- Thread.sleep(60);
- glWindow.setSize(400, 400);
- Thread.sleep(60);
- glWindow.destroy();
+ animator.start();
+
+ while(animator.getTotalFPSFrames() < 50) {
+ Thread.sleep(60);
+ }
+
+ animator.stop();
+ glWindow.destroy();
+ }
+
+ @Test
+ public void testOnscreenWritePNGWithResize() throws InterruptedException {
+ testWritePNGWithResizeImpl(false);
}
@Test
- public void testWritePNGWithResize() throws InterruptedException {
- final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
- GLWindow glWindow = GLWindow.create(caps);
- Assert.assertNotNull(glWindow);
- glWindow.setTitle("Shared Gears NEWT Test");
- glWindow.setSize(width, height);
- glWindow.addGLEventListener(new GearsES2(1));
- glWindow.addGLEventListener(new GLEventListener() {
- int i=0;
- public void init(GLAutoDrawable drawable) {}
- public void dispose(GLAutoDrawable drawable) {}
- public void display(GLAutoDrawable drawable) {
- final StringWriter filename = new StringWriter();
- {
- final PrintWriter pw = new PrintWriter(filename);
- final String pfmt = drawable.getChosenGLCapabilities().getAlphaBits() > 0 ? "rgba" : "rgb_";
- pw.printf("%s-F_rgba-I_%s-%s-%03dx%03d-n%03d.png",
- getSimpleTestName("."), pfmt, drawable.getGLProfile().getName(),
- drawable.getWidth(), drawable.getHeight(), i++);
- }
- if(screenshot.readPixels(drawable.getGL(), drawable, false)) {
- screenshot.write(new File(filename.toString()));
- }
- }
- public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
- });
- glWindow.setVisible(true);
- Thread.sleep(60);
- glWindow.setSize(300, 300);
- Thread.sleep(60);
- glWindow.setSize(400, 400);
- Thread.sleep(60);
- glWindow.destroy();
+ public void testOffscreenWritePNGWithResize() throws InterruptedException {
+ testWritePNGWithResizeImpl(true);
}
public static void main(String args[]) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java
index 8ec65bf50..4542fa47e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingOffscreenLayer01GLCanvasAWT.java
@@ -115,37 +115,26 @@ public class TestParentingOffscreenLayer01GLCanvasAWT extends UITestCase {
@Test
public void testOnscreenLayerGLCanvas_Onscreen() throws InterruptedException, InvocationTargetException {
- if(!JAWTUtil.isOffscreenLayerRequired()) {
- testOffscreenLayerGLCanvas_Impl(false, false);
- } else {
- System.err.println("onscreen layer n/a");
- }
+ testOffscreenLayerGLCanvas_Impl(false);
}
- /** We have no GLCanvas OffscreenWindow as we have for NEWT .. test disabled.
- @Test
- public void testOffscreenLayerGLCanvas_OffscreenLayerWithOffscreenClass() throws InterruptedException, InvocationTargetException {
- testOffscreenLayerGLCanvas_Impl(true, true);
- } */
-
@Test
public void testOffscreenLayerGLCanvas_OffscreenLayerWithOnscreenClass() throws InterruptedException, InvocationTargetException {
- if(JAWTUtil.isOffscreenLayerSupported()) {
- testOffscreenLayerGLCanvas_Impl(true, false);
- } else {
- System.err.println("offscreen layer n/a");
- }
+ testOffscreenLayerGLCanvas_Impl(true);
}
- private void testOffscreenLayerGLCanvas_Impl(boolean offscreenLayer, boolean offscreenClass) throws InterruptedException, InvocationTargetException {
+ private void testOffscreenLayerGLCanvas_Impl(boolean offscreenLayer) throws InterruptedException, InvocationTargetException {
+ if(!offscreenLayer && JAWTUtil.isOffscreenLayerRequired()) {
+ System.err.println("onscreen layer n/a");
+ return;
+ }
+ if(offscreenLayer && !JAWTUtil.isOffscreenLayerSupported()) {
+ System.err.println("offscreen layer n/a");
+ return;
+ }
final Frame frame1 = new Frame("AWT Parent Frame");
GLCapabilities glCaps = new GLCapabilities(null);
- if(offscreenClass) {
- glCaps.setOnscreen(false);
- glCaps.setPBuffer(true);
- }
-
final GLCanvas glc = new GLCanvas(glCaps);
glc.setShallUseOffscreenLayer(offscreenLayer); // trigger offscreen layer - if supported
glc.setPreferredSize(preferredGLSize);