diff options
author | Sven Gothel <[email protected]> | 2011-09-08 03:43:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-08 03:43:54 +0200 |
commit | 28b0df6c300494a2b54c07fdf43ef04f5f1b0073 (patch) | |
tree | 5548d07457fddd4390889c037b63ca20879fa353 /src/test | |
parent | f1c375df106f0f9f6c90772b61a501b4280997fa (diff) |
Destruction of GLAutoDrawable shall not remove them from AnimatorControl (due to recreation) ; NEWT/Window: Remove isValid() API entry - always true!
Destruction of GLAutoDrawable shall not remove them from AnimatorControl (due to recreation)
- Completes commit b65e1e76d413b70e5593173e6bd36d30675554a6
- WindowImpl:
- volatile: windowHandle/visible fields (memeory sync critical)
- destroy must set visible := false, to avoid immediate recreation via
a display call of another thread, ie an animator.
NEWT/Window: Remove isValid() API entry - always true!
- NEWT/Window's can always be recreated.
- redundancy in API is even worse than redundancy in impl. :)
Diffstat (limited to 'src/test')
4 files changed, 49 insertions, 15 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java index fb92e92ac..2809a138c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java @@ -50,7 +50,6 @@ import java.awt.Dimension; import java.awt.AWTException; import java.awt.Robot; import java.awt.Point; -import java.awt.Rectangle; import java.awt.event.InputEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -269,12 +268,13 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { Assert.assertEquals(true, anim.isAnimating()); // due to newtCanvasAWT/win1 newtCanvasAWT.destroy(); // destroys both newtCanvasAWT/win1 - Assert.assertEquals(false, win0.isNativeValid()); Assert.assertEquals(false, win1.isNativeValid()); + Assert.assertEquals(false, win0.isNativeValid()); + Assert.assertEquals(true, anim.isAnimating()); + + Assert.assertEquals(true, anim.stop()); Assert.assertEquals(false, anim.isAnimating()); - anim.stop(); - System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test01NewtCanvasAWT(): End"); } @@ -304,11 +304,15 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { anim.add(glCanvas); runTestGL(glCanvas, glCanvas); + Assert.assertEquals(true, anim.isAnimating()); + anim.remove(glCanvas); + Assert.assertEquals(false, anim.isAnimating()); + /** win0.destroy(); Assert.assertEquals(true, anim.isAnimating()); */ - anim.stop(); + Assert.assertEquals(true, anim.stop()); System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test02GLCanvas(): End"); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java index bfc3f43a7..3176d59e5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java @@ -124,7 +124,14 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) { Thread.sleep(100); } - destroyWindow(window); + destroyWindow(window); // destroy - but still in animator + Assert.assertEquals(false, window.isNativeValid()); + Assert.assertEquals(false, window.isVisible()); + Assert.assertEquals(true, animator.isAnimating()); + Assert.assertEquals(false, animator.isPaused()); + Assert.assertEquals(true, animator.isStarted()); + + animator.remove(window); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); Assert.assertEquals(true, animator.isStarted()); @@ -144,6 +151,10 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { } destroyWindow(window); destroyWindow(window); + Assert.assertEquals(true, animator.isAnimating()); + Assert.assertEquals(false, animator.isPaused()); + Assert.assertEquals(true, animator.isStarted()); + animator.remove(window); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); Assert.assertEquals(true, animator.isStarted()); @@ -193,6 +204,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Thread.sleep(100); } window1.destroy(); + animator.remove(window1); Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(true, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -201,6 +213,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Thread.sleep(100); } window2.destroy(); + animator.remove(window2); Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -255,6 +268,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Thread.sleep(100); } destroyWindow(window1); + animator.remove(window1); Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(true, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); @@ -263,6 +277,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Thread.sleep(100); } destroyWindow(window2); + animator.remove(window2); Assert.assertEquals(true, animator.isStarted()); Assert.assertEquals(false, animator.isAnimating()); Assert.assertEquals(false, animator.isPaused()); 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 3fc9b749a..710681779 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java @@ -77,6 +77,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // nop Thread.sleep(100); Assert.assertEquals(true, frame.isDisplayable()); + Assert.assertEquals(true, frame.isVisible()); Assert.assertEquals(true, glCanvas.isValid()); Assert.assertEquals(true, glCanvas.isDisplayable()); @@ -90,6 +91,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // no frame close Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, false)); Assert.assertEquals(true, frame.isDisplayable()); + Assert.assertEquals(true, frame.isVisible()); Assert.assertEquals(false, glCanvas.isRealized()); SwingUtilities.invokeLater(new Runnable() { 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 c8a2327a4..c14c461f7 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java @@ -60,14 +60,23 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { glWindow.addGLEventListener(new GearsES2()); - NewtCanvasAWT newtCanvas = new NewtCanvasAWT(glWindow); + final NewtCanvasAWT newtCanvas = new NewtCanvasAWT(glWindow); - frame.getContentPane().add(newtCanvas); - frame.pack(); - frame.setSize(512, 512); - frame.validate(); - frame.setVisible(true); - Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); + SwingUtilities.invokeLater(new Runnable() { + public void run() { + frame.getContentPane().add(newtCanvas); + frame.pack(); + frame.setSize(512, 512); + frame.validate(); + frame.setVisible(true); + } }); + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); + Assert.assertEquals(true, frame.isDisplayable()); + Assert.assertEquals(true, frame.isVisible()); + Assert.assertEquals(true, newtCanvas.isValid()); + Assert.assertEquals(true, newtCanvas.isDisplayable()); + Assert.assertEquals(true, glWindow.isNativeValid()); // // close with op: DO_NOTHING_ON_CLOSE -> NOP / HIDE (default) @@ -78,6 +87,7 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); Assert.assertEquals(true, frame.isDisplayable()); + Assert.assertEquals(false, frame.isVisible()); Assert.assertEquals(true, newtCanvas.isValid()); Assert.assertEquals(true, newtCanvas.isDisplayable()); Assert.assertEquals(true, glWindow.isNativeValid()); @@ -88,8 +98,10 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { public void run() { frame.setVisible(true); } }); - Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); + Assert.assertEquals(true, frame.isDisplayable()); + Assert.assertEquals(true, frame.isVisible()); + // // close with op (JFrame): DISPOSE_ON_CLOSE -- newtCanvas -- glWindow --> dispose // @@ -100,6 +112,7 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true)); Assert.assertEquals(false, frame.isDisplayable()); + Assert.assertEquals(false, frame.isVisible()); Assert.assertEquals(false, newtCanvas.isValid()); Assert.assertEquals(false, newtCanvas.isDisplayable()); Assert.assertEquals(false, glWindow.isNativeValid()); |