summaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-23 22:40:00 +0200
committerSven Gothel <[email protected]>2011-10-23 22:40:00 +0200
commit6edde99f98ee91db06731be9395377ed91aba215 (patch)
treeb61e7f0de6a3a7878969eddba2dabaaf3f4111a4 /src/test/com
parentb586ed1f8d4d38809693f94c7754d1de1aefff7d (diff)
Tests: AWT EDT: invokeLater(..) -> invokeAndWait(..) for a more predictable workflow
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java101
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java17
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java35
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java5
10 files changed, 120 insertions, 72 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java
index 69f9da052..adc885191 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java
@@ -97,7 +97,7 @@ public class TestCloseNewtAWT extends UITestCase {
newtWindow = GLWindow.create(new GLCapabilities(GLProfile.getDefault()));
newtCanvas = new MyCanvas(newtWindow);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame = new JFrame("NEWT Close Test");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
@@ -107,7 +107,7 @@ public class TestCloseNewtAWT extends UITestCase {
frame.setVisible(true);
}
});
- Thread.sleep(1000);
+ Thread.sleep(500);
Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true));
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java
index e6f3f0ac9..7956e22e6 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestEventSourceNotAWTBug.java
@@ -32,6 +32,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
@@ -54,7 +55,7 @@ public class TestEventSourceNotAWTBug extends UITestCase {
}
@Test
- public void testEventSourceNotNewtBug() throws InterruptedException {
+ public void testEventSourceNotNewtBug() throws InterruptedException, InvocationTargetException {
JFrame jf = new JFrame();
jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
@@ -69,7 +70,7 @@ public class TestEventSourceNotAWTBug extends UITestCase {
final JFrame f_jf = jf;
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
f_jf.setSize(800, 600);
f_jf.setVisible(true);
@@ -78,7 +79,7 @@ public class TestEventSourceNotAWTBug extends UITestCase {
Thread.sleep(500);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
f_jf.dispose();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
index 710681779..be824c2c4 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java
@@ -57,7 +57,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
GLCapabilities caps = new GLCapabilities(glp);
final GLCanvas glCanvas = new GLCanvas(caps);
glCanvas.addGLEventListener(new GearsES2());
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.add(glCanvas);
frame.pack();
@@ -94,7 +94,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
Assert.assertEquals(true, frame.isVisible());
Assert.assertEquals(false, glCanvas.isRealized());
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.dispose();
} });
@@ -112,7 +112,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
frame.pack();
frame.setSize(512, 512);
frame.validate();
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
} });
@@ -132,7 +132,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
Assert.assertEquals(true, glCanvas.isValid());
Assert.assertEquals(true, glCanvas.isDisplayable());
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
} });
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
index c14c461f7..19b2bbbf6 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java
@@ -62,7 +62,7 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
final NewtCanvasAWT newtCanvas = new NewtCanvasAWT(glWindow);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.getContentPane().add(newtCanvas);
frame.pack();
@@ -94,7 +94,7 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
Assert.assertEquals(true, windowClosingListener.isWindowClosing());
windowClosingListener.reset();
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
} });
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
index e1a9cd51c..674cf4a06 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -45,6 +45,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.RedSquareES2;
@@ -64,8 +65,8 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException {
- GLWindow glWindow1 = GLWindow.create(glCaps);
+ public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ final GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
Assert.assertEquals(false, glWindow1.isNativeValid());
@@ -75,7 +76,7 @@ public class TestParenting01aAWT extends UITestCase {
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
- NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
+ final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow1.isVisible());
Assert.assertEquals(false, glWindow1.isNativeValid());
@@ -88,7 +89,7 @@ public class TestParenting01aAWT extends UITestCase {
frame1.add(new Button("East"), BorderLayout.EAST);
frame1.add(new Button("West"), BorderLayout.WEST);
- Container container1 = new Container();
+ final Container container1 = new Container();
container1.setLayout(new BorderLayout());
container1.add(new Button("north"), BorderLayout.NORTH);
container1.add(new Button("south"), BorderLayout.SOUTH);
@@ -100,33 +101,48 @@ public class TestParenting01aAWT extends UITestCase {
frame1.setSize(width, height);
// visible test
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
}
});
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
- Animator animator1 = new Animator(glWindow1);
+ final Animator animator1 = new Animator(glWindow1);
animator1.setUpdateFPSFrames(1, null);
animator1.start();
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, true));
+
while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) {
Thread.sleep(100);
}
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
- frame1.setVisible(false);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.setVisible(false);
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
- frame1.setVisible(true);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.setVisible(true);
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
- frame1.remove(newtCanvasAWT);
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.remove(newtCanvasAWT);
+ } } );
// Assert.assertNull(glWindow1.getParent());
Assert.assertEquals(true, glWindow1.isNativeValid());
- frame1.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.dispose();
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
glWindow1.destroy();
@@ -134,8 +150,8 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting02CreateVisibleDestroy2Defered() throws InterruptedException {
- GLWindow glWindow1 = GLWindow.create(glCaps);
+ public void testWindowParenting02CreateVisibleDestroy2Defered() throws InterruptedException, InvocationTargetException {
+ final GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
Assert.assertEquals(false, glWindow1.isNativeValid());
@@ -155,13 +171,13 @@ public class TestParenting01aAWT extends UITestCase {
frame.setSize(width, height);
// visible test
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
}
});
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.add(newtCanvasAWT);
frame.validate();
@@ -178,12 +194,15 @@ public class TestParenting01aAWT extends UITestCase {
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
- frame.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ } } );
glWindow1.destroy();
}
@Test
- public void testWindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException {
+ public void testWindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -196,13 +215,13 @@ public class TestParenting01aAWT extends UITestCase {
frame.setSize(width, height);
// visible test
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
}
});
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.add(newtCanvasAWT);
frame.validate();
@@ -220,12 +239,15 @@ public class TestParenting01aAWT extends UITestCase {
Assert.assertEquals(true, animator1.isAnimating()); // !!!
- frame.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ } } );
glWindow1.destroy();
}
@Test
- public void testWindowParenting03ReparentNewtWin2Top() throws InterruptedException {
+ public void testWindowParenting03ReparentNewtWin2Top() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -236,13 +258,13 @@ public class TestParenting01aAWT extends UITestCase {
final Frame frame = new Frame("AWT Parent Frame");
frame.setSize(width, height);
frame.setLocation(640, 480);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
}
});
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.add(newtCanvasAWT);
frame.validate();
@@ -276,12 +298,15 @@ public class TestParenting01aAWT extends UITestCase {
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
- frame.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ } } );
glWindow1.destroy();
}
@Test
- public void testWindowParenting04ReparentNewtWin2TopLayouted() throws InterruptedException {
+ public void testWindowParenting04ReparentNewtWin2TopLayouted() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -298,13 +323,13 @@ public class TestParenting01aAWT extends UITestCase {
frame.setSize(width, height);
frame.setLocation(640, 480);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setVisible(true);
}
});
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.add(newtCanvasAWT, BorderLayout.CENTER);
frame.validate();
@@ -338,12 +363,15 @@ public class TestParenting01aAWT extends UITestCase {
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
- frame.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ } } );
glWindow1.destroy();
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException {
+ public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
@@ -360,7 +388,7 @@ public class TestParenting01aAWT extends UITestCase {
frame1.add(new Button("West"), BorderLayout.WEST);
frame1.setSize(width, height);
frame1.setLocation(0, 0);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
}
@@ -374,13 +402,13 @@ public class TestParenting01aAWT extends UITestCase {
frame2.add(new Button("West"), BorderLayout.WEST);
frame2.setSize(width, height);
frame2.setLocation(640, 480);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame2.setVisible(true);
}
});
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
frame1.validate();
@@ -398,7 +426,7 @@ public class TestParenting01aAWT extends UITestCase {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.remove(newtCanvasAWT);
frame2.add(newtCanvasAWT, BorderLayout.CENTER);
@@ -408,7 +436,7 @@ public class TestParenting01aAWT extends UITestCase {
});
break;
case 1:
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame2.remove(newtCanvasAWT);
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
@@ -424,8 +452,11 @@ public class TestParenting01aAWT extends UITestCase {
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
- frame1.dispose();
- frame2.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.dispose();
+ frame2.dispose();
+ } } );
glWindow1.destroy();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
index 0a0486558..8571609a8 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
@@ -91,7 +91,7 @@ public class TestParenting01bAWT extends UITestCase {
frame1.add(new Button("West"), BorderLayout.WEST);
frame1.setSize(width, height);
frame1.setLocation(0, 0);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
}
@@ -105,13 +105,13 @@ public class TestParenting01bAWT extends UITestCase {
frame2.add(new Button("West"), BorderLayout.WEST);
frame2.setSize(width, height);
frame2.setLocation(640, 480);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame2.setVisible(true);
}
});
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
frame1.validate();
@@ -132,7 +132,7 @@ public class TestParenting01bAWT extends UITestCase {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.remove(newtCanvasAWT);
frame2.add(newtCanvasAWT, BorderLayout.CENTER);
@@ -142,7 +142,7 @@ public class TestParenting01bAWT extends UITestCase {
});
break;
case 1:
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame2.remove(newtCanvasAWT);
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
@@ -162,8 +162,11 @@ public class TestParenting01bAWT extends UITestCase {
Assert.assertEquals(false, animator1.isPaused());
Assert.assertEquals(null, animator1.getThread());
- frame1.dispose();
- frame2.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.dispose();
+ frame2.dispose();
+ } } );
glWindow1.destroy();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
index fa88415e4..3b40554d2 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -45,6 +45,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.RedSquareES2;
@@ -62,7 +63,7 @@ public class TestParenting01cAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException {
+ public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
int i;
GLWindow glWindow1 = GLWindow.create(glCaps);
@@ -100,7 +101,7 @@ public class TestParenting01cAWT extends UITestCase {
frame1.setSize(width, height);
// visible test
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
}
@@ -111,21 +112,21 @@ public class TestParenting01cAWT extends UITestCase {
Thread.sleep(100);
}
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(false);
}
});
Assert.assertEquals(true, glWindow1.isNativeValid());
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
}
});
Assert.assertEquals(true, glWindow1.isNativeValid());
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.remove(newtCanvasAWT);
}
@@ -133,7 +134,10 @@ public class TestParenting01cAWT extends UITestCase {
// Assert.assertNull(glWindow1.getParent());
Assert.assertEquals(true, glWindow1.isNativeValid());
- frame1.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.dispose();
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
glWindow1.destroy();
@@ -141,7 +145,7 @@ public class TestParenting01cAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException {
+ public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
@@ -158,7 +162,7 @@ public class TestParenting01cAWT extends UITestCase {
frame1.add(new Button("West"), BorderLayout.WEST);
frame1.setSize(width, height);
frame1.setLocation(0, 0);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
}
@@ -172,13 +176,13 @@ public class TestParenting01cAWT extends UITestCase {
frame2.add(new Button("West"), BorderLayout.WEST);
frame2.setSize(width, height);
frame2.setLocation(640, 480);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame2.setVisible(true);
}
});
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
frame1.validate();
@@ -191,7 +195,7 @@ public class TestParenting01cAWT extends UITestCase {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.remove(newtCanvasAWT);
frame2.add(newtCanvasAWT, BorderLayout.CENTER);
@@ -201,7 +205,7 @@ public class TestParenting01cAWT extends UITestCase {
});
break;
case 1:
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame2.remove(newtCanvasAWT);
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
@@ -213,8 +217,11 @@ public class TestParenting01cAWT extends UITestCase {
}
}
- frame1.dispose();
- frame2.dispose();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.dispose();
+ frame2.dispose();
+ } } );
glWindow1.destroy();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index 5a324c647..f505547d4 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -129,7 +129,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
jFrame1.setContentPane(jPanel1);
jFrame1.setSize(width, height);
System.out.println("Demos: 1 - Visible");
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
jFrame1.setVisible(true);
}
@@ -241,7 +241,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
jFrame1.setContentPane(jPanel1);
jFrame1.setLocation(0, 0);
jFrame1.setSize(width, height);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
jFrame1.setVisible(true);
}
@@ -260,7 +260,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
jFrame2.setContentPane(jPanel2);
jFrame2.setLocation(640, 480);
jFrame2.setSize(width, height);
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
jFrame2.setVisible(true);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
index bd3e3f7ed..f01468c2a 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
@@ -224,7 +224,10 @@ public class TestParenting02AWT extends UITestCase {
frame.validate();
}});
}
- frame.dispose();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ } } );
}
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
index 8f578333e..780b1690e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
@@ -166,7 +166,10 @@ public class TestParenting03AWT extends UITestCase {
Assert.assertEquals(null, animator2.getThread());
}
- frame1.dispose();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame1.dispose();
+ } } );
glWindow1.destroy();
if(use2nd) {
glWindow2.destroy();