diff options
author | Michael Bien <[email protected]> | 2010-06-01 04:34:17 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-06-01 04:34:17 +0200 |
commit | dcc946e925ec73740e2985e5febf5fbb732ad1d9 (patch) | |
tree | f30712d3075caf1c2b0266fa603c286f4cec2072 /src/junit/com/jogamp/test | |
parent | 5cde948df47ecf435eda95b846a1b5c7afd6f5f9 (diff) |
swing on edt only, awt off edt. cleaned up the test a bit.
Diffstat (limited to 'src/junit/com/jogamp/test')
-rwxr-xr-x | src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java index d9edfd674..291fa6ad9 100755 --- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java +++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java @@ -45,7 +45,6 @@ import javax.swing.JFrame; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.After; import org.junit.Test; import static org.junit.Assume.*; @@ -66,33 +65,11 @@ public class TestAWT01GLn { public void init() { windows = new Window[]{ new Window(null), - new Frame("JFrame GL test"), - new JFrame("Frame GL test") + new Frame("Frame GL test"), + new JFrame("JFrame GL test") }; } - @After - public void release() throws InterruptedException, InvocationTargetException { - invokeAndWait(new Runnable() { - public void run() { - boolean allReleased = true; - for (final Window window : windows) { - window.setVisible(false); - try { - window.removeAll(); - } catch (Throwable t) { - allReleased = false; - t.printStackTrace(); - } - window.dispose(); - } - assumeTrue(allReleased); - } - }); - } - - - protected void runTestGL(final GLCapabilities caps) throws InterruptedException, InvocationTargetException { for (final Window window : windows) { @@ -102,27 +79,49 @@ public class TestAWT01GLn { // final array as mutable container hack final GLCanvas[] glCanvas = new GLCanvas[1]; - invokeAndWait(new Runnable() { + Runnable test = new Runnable() { public void run() { - glCanvas[0] = new GLCanvas(caps); glCanvas[0].addGLEventListener(new Gears()); - window.add(glCanvas[0]); window.setSize(512, 512); - glCanvas[0].display(); // one in process display - + glCanvas[0].display(); window.setVisible(true); + } + }; + Runnable cleanup = new Runnable() { + public void run() { + System.out.println("cleaning up..."); + window.setVisible(false); + try { + window.removeAll(); + } catch (Throwable t) { + assumeNoException(t); + t.printStackTrace(); + } + window.dispose(); } - }); + }; + + //swing on EDT.. + if(window instanceof JFrame) { + invokeAndWait(test); + }else{ + test.run(); + } Animator animator = new Animator(glCanvas[0]); animator.start(); Thread.sleep(500); animator.stop(); + if(window instanceof JFrame) { + invokeAndWait(cleanup); + }else{ + cleanup.run(); + } } } |