diff options
author | Sven Gothel <[email protected]> | 2011-12-02 02:51:53 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-02 02:51:53 +0100 |
commit | 65dc12ecbaa28f7643ce406860b3f47f53bc29d5 (patch) | |
tree | 76c6a4f8d094ee988c09b30a1adbf6cf09753015 | |
parent | b6aa455d21fbcfc256ae8f8f4d66493c17e23f4c (diff) |
More AWT-EDT invokeAndWait-wrapping for Frame show/dispose
5 files changed, 57 insertions, 56 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index dfb5076e9..f6e8da2b7 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -50,7 +50,7 @@ function jrun() { #D_ARGS="-Djogl.debug.ExtensionAvailabilityCache -Djogl.debug=all -Dnativewindow.debug=all -Djogamp.debug.ProcAddressHelper=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true" #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" - D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" + #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Dnewt.debug.MainThread" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.ExtensionAvailabilityCache" @@ -168,7 +168,7 @@ function testswt() { #testnoawt com.jogamp.newt.opengl.GLWindow $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $* -testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $* +#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $* #testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedAWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedNEWT $* @@ -223,7 +223,7 @@ testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWTAnalyzeBug455 $* #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsGLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.texture.TestTexture01AWT -#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461OffscreenSupersamplingSwingAWT +testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461OffscreenSupersamplingSwingAWT #testawt com.jogamp.opengl.test.junit.jogl.texture.TestGrayTextureFromFileAWTBug417 #testawt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAWT01GLn $* #testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug463ScaleImageMemoryAWT $* diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java index 55c9c6812..284122be3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug461OffscreenSupersamplingSwingAWT.java @@ -30,35 +30,9 @@ package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; -/** - * 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. - */ import java.awt.image.BufferedImage; +import java.lang.reflect.InvocationTargetException; import javax.media.opengl.GL; import javax.media.opengl.GL2; @@ -123,12 +97,19 @@ public class TestBug461OffscreenSupersamplingSwingAWT extends UITestCase impleme /* @Override */ public void dispose(GLAutoDrawable drawable) { - jframe.setVisible(false); - jframe.dispose(); + try { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + jframe.setVisible(false); + jframe.dispose(); + }}); + } catch (Exception e) { + e.printStackTrace(); + } } @Test - public void testOffscreenSupersampling() { + public void testOffscreenSupersampling() throws InterruptedException, InvocationTargetException { jframe = new JFrame("Offscreen Supersampling"); Assert.assertNotNull(jframe); jframe.setSize( 300, 300); @@ -163,7 +144,10 @@ public class TestBug461OffscreenSupersamplingSwingAWT extends UITestCase impleme Assert.assertNotNull(offScreenBuffer); offScreenBuffer.addGLEventListener(this); offScreenBuffer.display(); - jframe.setVisible( true ); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + jframe.setVisible(true); + }}); } public static void main(String args[]) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java index 6474bb5f6..3c6b3485f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java @@ -41,6 +41,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; import org.junit.Assert; import org.junit.BeforeClass; @@ -65,11 +66,11 @@ public class TestGearsAWT extends UITestCase { public static void releaseClass() { } - protected void runTestGL(GLCapabilities caps) throws InterruptedException { - Frame frame = new Frame("Gears AWT Test"); + protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { + final Frame frame = new Frame("Gears AWT Test"); Assert.assertNotNull(frame); - GLCanvas glCanvas = new GLCanvas(caps); + final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); frame.add(glCanvas); frame.setSize(512, 512); @@ -82,7 +83,10 @@ public class TestGearsAWT extends UITestCase { new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas); new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); - frame.setVisible(true); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(true); + }}); animator.setUpdateFPSFrames(60, System.err); animator.start(); @@ -98,14 +102,15 @@ public class TestGearsAWT extends UITestCase { Assert.assertEquals(false, animator.isAnimating()); frame.setVisible(false); Assert.assertEquals(false, frame.isVisible()); - frame.remove(glCanvas); - frame.dispose(); - frame=null; - glCanvas=null; + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.remove(glCanvas); + frame.dispose(); + }}); } @Test - public void test01() throws InterruptedException { + public void test01() throws InterruptedException, InvocationTargetException { GLCapabilities caps = new GLCapabilities(glp); runTestGL(caps); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java index bcc5bb250..4b670f0e1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java @@ -44,6 +44,7 @@ import java.awt.Frame; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.lang.reflect.InvocationTargetException; import org.junit.Assert; import org.junit.BeforeClass; @@ -92,11 +93,11 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase { int height) { } } - protected void runTestGL(GLCapabilities caps) throws InterruptedException { - Frame frame = new Frame("Gears AWT Test"); + protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException { + final Frame frame = new Frame("Gears AWT Test"); Assert.assertNotNull(frame); - GLCanvas glCanvas = new GLCanvas(caps); + final GLCanvas glCanvas = new GLCanvas(caps); Assert.assertNotNull(glCanvas); glCanvas.setAutoSwapBufferMode(!altSwap); frame.add(glCanvas); @@ -111,7 +112,10 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase { new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas); new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); - frame.setVisible(true); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(true); + }}); animator.setUpdateFPSFrames(60, System.err); animator.start(); @@ -127,14 +131,15 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase { Assert.assertEquals(false, animator.isAnimating()); frame.setVisible(false); Assert.assertEquals(false, frame.isVisible()); - frame.remove(glCanvas); - frame.dispose(); - frame=null; - glCanvas=null; + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.remove(glCanvas); + frame.dispose(); + }}); } @Test - public void test01() throws InterruptedException { + public void test01() throws InterruptedException, InvocationTargetException { GLCapabilities caps = new GLCapabilities(glp); caps.setDoubleBuffered(true); // code assumes dbl buffer setup runTestGL(caps); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java index 429ef59cd..fa7f0f915 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestListenerCom01AWT.java @@ -42,6 +42,7 @@ import com.jogamp.newt.opengl.*; import com.jogamp.newt.awt.NewtCanvasAWT; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import com.jogamp.opengl.test.junit.util.*; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -58,7 +59,7 @@ public class TestListenerCom01AWT extends UITestCase { } @Test - public void testListenerStringPassingAndOrder() throws InterruptedException { + public void testListenerStringPassingAndOrder() throws InterruptedException, InvocationTargetException { // setup NEWT GLWindow .. GLWindow glWindow = GLWindow.create(new GLCapabilities(null)); Assert.assertNotNull(glWindow); @@ -88,10 +89,13 @@ public class TestListenerCom01AWT extends UITestCase { // attach NEWT GLWindow to AWT Canvas NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow); - Frame frame = new Frame("AWT Parent Frame"); + final Frame frame = new Frame("AWT Parent Frame"); frame.add(newtCanvasAWT); frame.setSize(width, height); - frame.setVisible(true); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(true); + }}); Animator animator1 = new Animator(glWindow); animator1.setUpdateFPSFrames(1, null); @@ -104,7 +108,10 @@ public class TestListenerCom01AWT extends UITestCase { animator1.stop(); Assert.assertEquals(false, animator1.isAnimating()); - frame.dispose(); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.dispose(); + }}); glWindow.destroy(); } |