diff options
author | Sven Gothel <[email protected]> | 2011-08-30 22:05:19 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-08-30 22:05:19 +0200 |
commit | f3c58e61ad9b1ad1d1c193d6f538776fb4de1dac (patch) | |
tree | 8e79fcf56e2be9c35999badbced1a83fe01ecfc2 /src/test/com/jogamp/opengl | |
parent | 71b7087455fc23ec640d9d64342aaaaff42d3c7e (diff) |
TestFocus01SwingAWTRobot: Run AWT destruction on AWT-EDT
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java index e23510e25..4a8be69ba 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestFocus01SwingAWTRobot.java @@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.newt; import org.junit.Assert; import org.junit.AfterClass; +import org.junit.Assume; import java.awt.AWTException; import java.awt.BorderLayout; @@ -88,7 +89,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase { private void testFocus01ProgrFocusImpl(Robot robot) throws AWTException, InvocationTargetException, InterruptedException { - ArrayList eventCountAdapters = new ArrayList(); + ArrayList<EventCountAdapter> eventCountAdapters = new ArrayList<EventCountAdapter>(); // Create a window. GLWindow glWindow1 = GLWindow.create(glCaps); @@ -117,8 +118,8 @@ public class TestFocus01SwingAWTRobot extends UITestCase { eventCountAdapters.add(newtCanvasAWTFA); // Add the canvas to a frame, and make it all visible. - JFrame frame1 = new JFrame("Swing AWT Parent Frame: " - + glWindow1.getTitle()); + final JFrame frame1 = new JFrame("Swing AWT Parent Frame: " + + glWindow1.getTitle()); AWTFocusAdapter frame1FA = new AWTFocusAdapter("frame1"); frame1.addFocusListener(frame1FA); frame1.getContentPane().add(newtCanvasAWT, BorderLayout.CENTER); @@ -178,7 +179,16 @@ public class TestFocus01SwingAWTRobot extends UITestCase { // Shutdown the test. animator.stop(); - frame1.dispose(); + try { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame1.setVisible(false); + frame1.dispose(); + }}); + } catch( Throwable throwable ) { + throwable.printStackTrace(); + Assume.assumeNoException( throwable ); + } glWindow1.destroy(); } |