diff options
author | Sven Gothel <[email protected]> | 2013-04-04 06:07:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-04 06:07:53 +0200 |
commit | ea87d0ce9a57762700b295f002bb544cef7223a3 (patch) | |
tree | d4f9bcd6cc516c6573b8a17ef729148a5f5a054f /src/test | |
parent | 57bf60b789d89d70a58583a9cc0119317f179c3a (diff) |
OSX CALayer Unit Tests: NEWT child is destroyed if NewtCanvasAWT is disposed/removed, due to offscreen/onscreen transition
Diffstat (limited to 'src/test')
4 files changed, 35 insertions, 8 deletions
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 21c737d8f..f8f97518e 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 @@ -132,18 +132,24 @@ public class TestParenting01aAWT extends UITestCase { } } ); Assert.assertEquals(true, glWindow1.isNativeValid()); + final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen(); + SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.remove(newtCanvasAWT); } } ); // Assert.assertNull(glWindow1.getParent()); - Assert.assertEquals(true, glWindow1.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow1.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.dispose(); } } ); - Assert.assertEquals(true, glWindow1.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow1.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition glWindow1.destroy(); Assert.assertEquals(false, glWindow1.isNativeValid()); 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 aade7f93a..baa4c4676 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 @@ -126,19 +126,25 @@ public class TestParenting01cAWT extends UITestCase { }); Assert.assertEquals(true, glWindow1.isNativeValid()); + final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen(); + SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.remove(newtCanvasAWT); } }); // Assert.assertNull(glWindow1.getParent()); - Assert.assertEquals(true, glWindow1.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow1.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame1.dispose(); } } ); - Assert.assertEquals(true, glWindow1.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow1.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition glWindow1.destroy(); Assert.assertEquals(false, glWindow1.isNativeValid()); 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 c84823a04..1dd80e313 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 @@ -169,6 +169,7 @@ public class TestParenting01cSwingAWT extends UITestCase { SwingUtilities.invokeAndWait(new Runnable() { public void run() { jFrame1.setSize(width, height); + jFrame1.validate(); jFrame1.setVisible(true); } }); @@ -199,6 +200,8 @@ public class TestParenting01cSwingAWT extends UITestCase { } }); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true)); + final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen(); + // Always recommended to remove our native parented Window // from the AWT resources before destruction, since it could lead // to a BadMatch X11 error w/o. @@ -208,14 +211,18 @@ public class TestParenting01cSwingAWT extends UITestCase { jPanel1.remove(container1); jFrame1.validate(); } }); - Assert.assertEquals(true, glWindow1.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow1.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition SwingUtilities.invokeAndWait(new Runnable() { public void run() { System.err.println("Demos: 6 - X Frame"); jFrame1.dispose(); } }); - Assert.assertEquals(true, glWindow1.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow1.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition System.err.println("Demos: 7 - X GLWindow"); glWindow1.destroy(); @@ -322,6 +329,8 @@ public class TestParenting01cSwingAWT extends UITestCase { // visible test Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); + final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen(); + int state = 0; while(animator1.isAnimating() && animator1.getTotalFPSDuration()<3*durationPerTest) { Thread.sleep(durationPerTest); @@ -385,7 +394,9 @@ public class TestParenting01cSwingAWT extends UITestCase { System.err.println("Demos: 5 - X frame"); jFrame2.dispose(); } }); - Assert.assertEquals(true, glWindow1.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow1.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition System.err.println("Demos: 6 - X GLWindow"); glWindow1.destroy(); 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 dc1c0ba57..204d98d5c 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 @@ -148,6 +148,8 @@ public class TestParenting02AWT extends UITestCase { glWindow.display(); } while(!glWindow.isNativeValid()) ; + final boolean wasOnscreen = glWindow.getChosenCapabilities().isOnscreen(); + Assert.assertEquals(true, glWindow.isNativeValid()); Assert.assertNotNull(glWindow.getParent()); if(verbose) { @@ -163,7 +165,9 @@ public class TestParenting02AWT extends UITestCase { frame.validate(); }}); Assert.assertEquals(false, glWindow.isVisible()); - Assert.assertEquals(true, glWindow.isNativeValid()); + if( wasOnscreen ) { + Assert.assertEquals(true, glWindow.isNativeValid()); + } // else OK to be destroyed - due to offscreen/onscreen transition Assert.assertNull(glWindow.getParent()); if(verbose) { System.out.println("+++++++++++++++++++ REMOVED!"); |