From be352d9b3bc2a6a5a5542a0f91f13c9e28fbb8e0 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 19 Feb 2013 21:21:39 +0100 Subject: Unit Tests NewtEventModifiers (2): Robostness - clearKeyboadAndMouse(): Add _testMouseListener.clear(); to clear all logs! - clearKeyboadAndMouse() after all tests - use implicit 'clearKeyboadAndMouse()' in execOffThreadWithOnThreadEventDispatch() --- .../opengl/test/junit/newt/event/BaseNewtEventModifiers.java | 8 ++++++++ .../test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java | 2 -- .../junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java | 2 -- .../junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java | 2 -- .../junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java | 3 --- 5 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/test/com/jogamp/opengl') 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 { -- cgit v1.2.3