diff options
author | Sven Gothel <[email protected]> | 2013-02-19 21:21:39 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-02-19 21:21:39 +0100 |
commit | be352d9b3bc2a6a5a5542a0f91f13c9e28fbb8e0 (patch) | |
tree | 81d561e6668a24f61590d2c4c21e8e2d1d78085e /src/test | |
parent | e7df5d65e83e07bf7e8474aebcf9fd09f3597527 (diff) |
Unit Tests NewtEventModifiers (2): Robostness
- clearKeyboadAndMouse(): Add _testMouseListener.clear(); to clear all logs!
- clearKeyboadAndMouse() after all tests
- use implicit 'clearKeyboadAndMouse()' in execOffThreadWithOnThreadEventDispatch()
Diffstat (limited to 'src/test')
5 files changed, 8 insertions, 9 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java index f5278a542..138d30823 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java @@ -33,6 +33,7 @@ import java.util.ArrayList ; import javax.media.opengl.GLProfile ; +import org.junit.After; import org.junit.Assert ; import org.junit.BeforeClass ; import org.junit.Test ; @@ -317,6 +318,11 @@ public abstract class BaseNewtEventModifiers extends UITestCase { _testMouseListener = new TestMouseListener() ; } + @After + public void afterTest() throws Exception { + clearKeyboadAndMouse(); + } + //////////////////////////////////////////////////////////////////////////// // Following both methods are mandatory to deal with SWT's requirement // to run the SWT event dispatch on the TK thread - which must be the main thread on OSX. @@ -340,6 +346,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { eventDispatch(); eventDispatch(); eventDispatch(); Thread.sleep( MS_ROBOT_POST_TEST_DELAY ) ; eventDispatch(); eventDispatch(); eventDispatch(); + _testMouseListener.clear(); } _testMouseListener.setModifierCheckEnabled( true ) ; @@ -685,6 +692,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase { _releaseModifiers() ; _escape() ; Thread.sleep( MS_ROBOT_POST_TEST_DELAY ) ; + _testMouseListener.clear(); } //////////////////////////////////////////////////////////////////////////// diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java index ee634e1c6..a847ca671 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java @@ -77,14 +77,12 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers { AWTRobotUtil.assertRequestFocusAndWait(null, canvas, canvas, null, null); // programmatic Assert.assertNotNull(_robot); AWTRobotUtil.requestFocus(_robot, canvas, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input - clearKeyboadAndMouse(); } //////////////////////////////////////////////////////////////////////////// @AfterClass public static void afterClass() throws Exception { - clearKeyboadAndMouse(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { _testFrame.dispose() ; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java index 880d378a4..71191c863 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java @@ -64,14 +64,12 @@ public class TestNewtEventModifiersNEWTWindowAWT extends BaseNewtEventModifiers AWTRobotUtil.assertRequestFocusAndWait(null, _glWindow, _glWindow, null, null); // programmatic Assert.assertNotNull(_robot); AWTRobotUtil.requestFocus(_robot, _glWindow, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input - clearKeyboadAndMouse(); } //////////////////////////////////////////////////////////////////////////// @AfterClass public static void afterClass() throws Exception { - clearKeyboadAndMouse(); _glWindow.destroy(); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java index 47826d127..968d1af79 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java @@ -90,14 +90,12 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers AWTRobotUtil.requestFocus(_robot, _glWindow, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input _glWindow.addMouseListener( _testMouseListener ) ; - clearKeyboadAndMouse(); } //////////////////////////////////////////////////////////////////////////// @AfterClass public static void afterClass() throws Exception { - clearKeyboadAndMouse(); SwingUtilities.invokeAndWait( new Runnable() { public void run() { _testFrame.dispose() ; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java index 0ac9328a6..002134216 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java @@ -133,15 +133,12 @@ public class TestNewtEventModifiersNewtCanvasSWT extends BaseNewtEventModifiers eventDispatch2xImpl(); _glWindow.addMouseListener( _testMouseListener ) ; - clearKeyboadAndMouse(); } //////////////////////////////////////////////////////////////////////////// @AfterClass public static void afterClass() throws Exception { - clearKeyboadAndMouse(); - _glWindow.destroy() ; try { |