From 9a2034b4f493465f93386c6462cbd0e2b68db19d Mon Sep 17 00:00:00 2001 From: Steve Vaughan Date: Tue, 31 Aug 2010 14:29:23 -0400 Subject: Ensure that receiving focus is passed on to any NEWT child. --- .../com/jogamp/test/junit/newt/TestFocus01SwingAWT.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/junit/com/jogamp') diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java index 1cf25bb6d..a0039106e 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWT.java @@ -78,25 +78,26 @@ public class TestFocus01SwingAWT { frame1.setSize(width, height); frame1.setVisible(true); + // Request the focus, which should automatically provide the window + // with focus. + newtCanvasAWT.requestFocus(); + Animator animator = new Animator(glWindow1); animator.start(); - Robot robot = new Robot(); - - // Wait for the window to initialize. + // Wait for the window to initialize and receive focus. // TODO Eliminate the need for this delay. while (glWindow1.getDuration() < durationPerTest) { Thread.sleep(100); } - // Request the focus, which should automatically provide the window - // with focus. - newtCanvasAWT.requestFocus(); + // Verify focus status. assertFalse("AWT parent canvas has focus", newtCanvasAWT.hasFocus()); // TODO No test for NEWT hasFocus. // assertTrue(newtCanvasAWT.getNEWTChild().hasFocus()); // Type two keys, which should be directed to the focused window. + Robot robot = new Robot(); robot.keyPress(java.awt.event.KeyEvent.VK_A); robot.keyRelease(java.awt.event.KeyEvent.VK_A); robot.keyPress(java.awt.event.KeyEvent.VK_B); -- cgit v1.2.3