mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-15 21:05:11 +00:00
7035459: [TEST_BUG] java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java failed
Reviewed-by: serb, arapte
This commit is contained in:
parent
91f78743d7
commit
026af5cb64
@ -23,12 +23,12 @@
|
||||
|
||||
/*
|
||||
@test
|
||||
@bug 6562853
|
||||
@summary Tests that focus transfered directy to window w/o transfering it to frame.
|
||||
@author Oleg Sukhodolsky: area=awt.focus
|
||||
@library ../../regtesthelpers
|
||||
@build Util
|
||||
@run main TranserFocusToWindow
|
||||
@bug 6562853 7035459
|
||||
@summary Tests that focus transfered directy to window w/o transfering it to frame.
|
||||
@author Oleg Sukhodolsky: area=awt.focus
|
||||
@library ../../regtesthelpers
|
||||
@build Util
|
||||
@run main TranserFocusToWindow
|
||||
*/
|
||||
|
||||
import java.awt.Button;
|
||||
@ -44,10 +44,13 @@ import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
public class TranserFocusToWindow
|
||||
{
|
||||
private static final int WIDTH = 300;
|
||||
private static final int HEIGHT = 200;
|
||||
|
||||
public static void main(String[] args) {
|
||||
Robot robot = Util.createRobot();
|
||||
Frame owner_frame = new Frame("Owner frame");
|
||||
owner_frame.setBounds(0, 0, 200, 200);
|
||||
owner_frame.setBounds(0, 0, WIDTH, HEIGHT);
|
||||
owner_frame.setVisible(true);
|
||||
Util.waitForIdle(robot);
|
||||
|
||||
@ -55,7 +58,7 @@ public class TranserFocusToWindow
|
||||
Button btn1 = new Button("button for focus");
|
||||
window.add(btn1);
|
||||
window.pack();
|
||||
window.setLocation(0, 300);
|
||||
window.setLocation(0, HEIGHT + 100);
|
||||
window.setVisible(true);
|
||||
Util.waitForIdle(robot);
|
||||
|
||||
@ -63,17 +66,10 @@ public class TranserFocusToWindow
|
||||
Button btn2 = new Button("button in a frame");
|
||||
another_frame.add(btn2);
|
||||
another_frame.pack();
|
||||
another_frame.setLocation(300, 0);
|
||||
another_frame.setLocation(WIDTH + 100, 0);
|
||||
another_frame.setVisible(true);
|
||||
Util.waitForIdle(robot);
|
||||
|
||||
Util.clickOnTitle(owner_frame, robot);
|
||||
Util.waitForIdle(robot);
|
||||
|
||||
setFocus(btn1, robot);
|
||||
|
||||
setFocus(btn2, robot);
|
||||
|
||||
owner_frame.addWindowFocusListener(new WindowFocusListener() {
|
||||
public void windowLostFocus(WindowEvent we) {
|
||||
System.out.println(we);
|
||||
@ -100,6 +96,10 @@ public class TranserFocusToWindow
|
||||
}
|
||||
});
|
||||
|
||||
Util.clickOnTitle(owner_frame, robot);
|
||||
Util.waitForIdle(robot);
|
||||
setFocus(btn1, robot);
|
||||
setFocus(btn2, robot);
|
||||
// we need this delay so WM can not treat two clicks on title as double click
|
||||
robot.delay(500);
|
||||
Util.clickOnTitle(owner_frame, robot);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user