diff options
author | Sven Gothel <[email protected]> | 2013-02-16 20:10:23 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-02-16 20:10:23 +0100 |
commit | 674004cd67105b27b63c7ac2f05738f21864bdc0 (patch) | |
tree | dbc37d032b052acadc6bbf6211437d9d0ca7ddd5 /src/test | |
parent | 87b5d10bc6d9025de410bcd23b8d33ccdb13901d (diff) |
TestWindowClosingProtocol01AWT: More relaxed timing reducing false positives
Diffstat (limited to 'src/test')
3 files changed, 15 insertions, 1 deletions
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 3a923d435..6aedb8433 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java @@ -87,10 +87,16 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { glCanvas.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE); op = glCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op); + + Thread.sleep(300); - Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // no frame close + Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // no frame close, but GLCanvas's GL resources will be destroyed + Thread.sleep(100); Assert.assertEquals(true, frame.isDisplayable()); Assert.assertEquals(true, frame.isVisible()); + for (int wait=0; wait<AWTRobotUtil.POLL_DIVIDER && glCanvas.isRealized(); wait++) { + Thread.sleep(AWTRobotUtil.TIME_SLICE); + } Assert.assertEquals(false, glCanvas.isRealized()); SwingUtilities.invokeAndWait(new Runnable() { @@ -125,6 +131,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { WindowClosingMode op = glCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op); + Thread.sleep(300); + Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); // nop Thread.sleep(100); Assert.assertEquals(true, frame.isDisplayable()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java index 1657fcbe9..8cd44b82c 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java @@ -69,6 +69,8 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase { glWindow.setDefaultCloseOperation(WindowClosingMode.DO_NOTHING_ON_CLOSE); op = glWindow.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op); + + Thread.sleep(300); Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, false)); // nop Assert.assertEquals(true, glWindow.isNativeValid()); 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 65068e9e8..be3c48fb6 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java @@ -85,6 +85,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { WindowClosingMode op = newtCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op); + Thread.sleep(300); + Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false)); Assert.assertEquals(true, frame.isDisplayable()); Assert.assertEquals(false, frame.isVisible()); @@ -109,6 +111,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { Assert.assertEquals(JFrame.DISPOSE_ON_CLOSE, frame.getDefaultCloseOperation()); op = newtCanvas.getDefaultCloseOperation(); Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op); + + Thread.sleep(300); Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true)); Assert.assertEquals(false, frame.isDisplayable()); |