diff options
author | Sven Gothel <[email protected]> | 2012-10-30 17:42:55 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-30 17:42:55 +0100 |
commit | 2db90cf4ffc2e821da8f13fd3057a63b59dc2fc7 (patch) | |
tree | 10119787b6784c1e69c64b50b2f8f1fc2d399722 /src | |
parent | f70e28c8f73c57eb8aa391ef26e1b2357878268a (diff) |
TestNewtKey*: Don't test TAB (focus traversal, duh!); Add AWTRobotUtil.requestFocus(robot, ..) for kbd input on Windows (some 'confusion' w/ prev unit test runs)
Diffstat (limited to 'src')
4 files changed, 15 insertions, 15 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyCodeAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyCodeAWT.java index baa735889..37debfcc2 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyCodeAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyCodeAWT.java @@ -142,7 +142,9 @@ public class TestNewtKeyCodeAWT extends UITestCase { } static CodeSeg[] codeSegments = new CodeSeg[] { - new CodeSeg(0x008, 0x00a, "bs, tab, cr"), + new CodeSeg(0x008, 0x008, "bs"), + // new CodeSeg(0x009, 0x009, "tab"), // TAB functions as focus traversal key + new CodeSeg(0x00a, 0x00a, "cr"), new CodeSeg(0x010, 0x011, "shift, ctrl"), // single alt n/a on windows new CodeSeg(0x01B, 0x01B, "esc"), new CodeSeg(0x020, 0x024, "space, up, down, end, home"), @@ -168,7 +170,8 @@ public class TestNewtKeyCodeAWT extends UITestCase { }; static void testKeyCode(Robot robot, NEWTKeyAdapter keyAdapter) { - List<List<EventObject>> cse = new ArrayList<List<EventObject>>(); + final List<List<EventObject>> cse = new ArrayList<List<EventObject>>(); + final List<EventObject> queue = keyAdapter.getQueued(); for(int i=0; i<codeSegments.length; i++) { keyAdapter.reset(); @@ -177,11 +180,10 @@ public class TestNewtKeyCodeAWT extends UITestCase { for(int c=codeSeg.min; c<=codeSeg.max; c++) { // System.err.println("*** KeyCode 0x"+Integer.toHexString(c)); AWTRobotUtil.keyPress(0, robot, true, c, 10); - AWTRobotUtil.keyPress(0, robot, false, c, 10); + AWTRobotUtil.keyPress(0, robot, false, c, 100); robot.waitForIdle(); } final int codeCount = codeSeg.max - codeSeg.min + 1; - final List<EventObject> queue = keyAdapter.getQueued(); for(int j=0; j < 10 && queue.size() < 3 * codeCount; j++) { // wait until events are collected robot.delay(100); } @@ -199,12 +201,13 @@ public class TestNewtKeyCodeAWT extends UITestCase { TestListenerCom01AWT.setDemoFields(demo1, glWindow, false); glWindow.addGLEventListener(demo1); + // NEWTFocusAdapter glWindow1FA = new NEWTFocusAdapter("GLWindow1"); + // glWindow.addWindowListener(glWindow1FA); NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1"); glWindow1KA.setVerbose(false); glWindow.addKeyListener(glWindow1KA); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); - AWTRobotUtil.clearAWTFocus(robot); // Continuous animation .. Animator animator = new Animator(glWindow); @@ -212,9 +215,9 @@ public class TestNewtKeyCodeAWT extends UITestCase { Thread.sleep(durationPerTest); // manual testing - glWindow1KA.reset(); AWTRobotUtil.assertRequestFocusAndWait(null, glWindow, glWindow, null, null); // programmatic - // AWTRobotUtil.assertRequestFocusAndWait(robot, glWindow, glWindow, null, null); // by mouse click + AWTRobotUtil.requestFocus(robot, glWindow); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input + glWindow1KA.reset(); // // Test the key event order w/o auto-repeat diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventAutoRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventAutoRepeatAWT.java index d373f1486..6816863da 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventAutoRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventAutoRepeatAWT.java @@ -258,7 +258,6 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { glWindow.addKeyListener(glWindow1KA); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); - AWTRobotUtil.clearAWTFocus(robot); // Continuous animation .. Animator animator = new Animator(glWindow); @@ -266,9 +265,9 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase { Thread.sleep(durationPerTest); // manual testing - glWindow1KA.reset(); AWTRobotUtil.assertRequestFocusAndWait(null, glWindow, glWindow, null, null); // programmatic - // AWTRobotUtil.assertRequestFocusAndWait(robot, glWindow, glWindow, null, null); // by mouse click + AWTRobotUtil.requestFocus(robot, glWindow); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input + glWindow1KA.reset(); // // Test the key event order w/ auto-repeat diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventOrderAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventOrderAWT.java index 5f55fbf97..11f552ecb 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventOrderAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyEventOrderAWT.java @@ -183,7 +183,6 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { glWindow.addKeyListener(glWindow1KA); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); - AWTRobotUtil.clearAWTFocus(robot); // Continuous animation .. Animator animator = new Animator(glWindow); @@ -191,9 +190,9 @@ public class TestNewtKeyEventOrderAWT extends UITestCase { Thread.sleep(durationPerTest); // manual testing - glWindow1KA.reset(); AWTRobotUtil.assertRequestFocusAndWait(null, glWindow, glWindow, null, null); // programmatic - // AWTRobotUtil.assertRequestFocusAndWait(robot, glWindow, glWindow, null, null); // by mouse click + AWTRobotUtil.requestFocus(robot, glWindow); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input + glWindow1KA.reset(); // // Test the key event order w/o auto-repeat diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyPressReleaseUnmaskRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyPressReleaseUnmaskRepeatAWT.java index c4dc5a8ad..6ebaf2707 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyPressReleaseUnmaskRepeatAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestNewtKeyPressReleaseUnmaskRepeatAWT.java @@ -143,7 +143,6 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase { glWindow.addKeyListener(simpleKeyPressRelease); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true)); - AWTRobotUtil.clearAWTFocus(robot); // Continuous animation .. Animator animator = new Animator(glWindow); @@ -152,7 +151,7 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase { Thread.sleep(durationPerTest); // manual testing AWTRobotUtil.assertRequestFocusAndWait(null, glWindow, glWindow, null, null); // programmatic - // AWTRobotUtil.assertRequestFocusAndWait(robot, glWindow, glWindow, null, null); // by mouse click + AWTRobotUtil.requestFocus(robot, glWindow); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input // Remove listeners to avoid logging during dispose/destroy. glWindow.removeKeyListener(simpleKeyPressRelease); |