test/jdk/java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.java
changeset 59194 10385df5d986
parent 47216 71c04702a3d5
equal deleted inserted replaced
59193:b83adf4bd4ee 59194:10385df5d986
    60             robot = new Robot();
    60             robot = new Robot();
    61         } catch (AWTException e) {
    61         } catch (AWTException e) {
    62             throw new RuntimeException("Error: unable to create robot");
    62             throw new RuntimeException("Error: unable to create robot");
    63         }
    63         }
    64 
    64 
       
    65         robot.setAutoDelay(200);
    65         dialogInvisibleOwner = new Frame("Dialog Invisible Owner Frame");
    66         dialogInvisibleOwner = new Frame("Dialog Invisible Owner Frame");
    66         dialog = new Dialog(dialogInvisibleOwner, "Owned Dialog");
    67         dialog = new Dialog(dialogInvisibleOwner, "Owned Dialog");
    67 
    68 
    68         frame = new Frame("A Frame");
    69         frame = new Frame("A Frame");
    69         frameButton = new Button("button");
    70         frameButton = new Button("button");
    77         dialog.setBounds(100, 50, 200, 100);
    78         dialog.setBounds(100, 50, 200, 100);
    78     }
    79     }
    79 
    80 
    80     public void performTest() {
    81     public void performTest() {
    81         frame.setVisible(true);
    82         frame.setVisible(true);
       
    83         robot.delay(200);
    82         robot.waitForIdle();
    84         robot.waitForIdle();
    83         clickOnTitle(frame);
    85         clickOnTitle(frame);
       
    86         robot.delay(200);
    84         robot.waitForIdle();
    87         robot.waitForIdle();
    85         robot.delay(200);
    88         robot.delay(200);
    86         if (!frame.isFocused()) {
    89         if (!frame.isFocused()) {
    87             dispose();
    90             dispose();
    88             throw new RuntimeException("Error: frame didn't get initial focus");
    91             throw new RuntimeException("Error: frame didn't get initial focus");
    89         }
    92         }
    90 
    93 
    91         dialog.setVisible(true);
    94         dialog.setVisible(true);
       
    95         robot.delay(200);
    92         robot.waitForIdle();
    96         robot.waitForIdle();
    93         robot.delay(200);
    97         robot.delay(200);
    94         if (!dialog.isFocused()) {
    98         if (!dialog.isFocused()) {
    95             dispose();
    99             dispose();
    96             throw new RuntimeException("Error: dialog didn't get initial focus");
   100             throw new RuntimeException("Error: dialog didn't get initial focus");
   116         Point p = c.getLocationOnScreen();
   120         Point p = c.getLocationOnScreen();
   117         Dimension d = c.getSize();
   121         Dimension d = c.getSize();
   118         robot.mouseMove(p.x + (int)(d.getWidth() / 2),
   122         robot.mouseMove(p.x + (int)(d.getWidth() / 2),
   119                         p.y + ((Frame)c).getInsets().top / 2);
   123                         p.y + ((Frame)c).getInsets().top / 2);
   120         robot.mousePress(InputEvent.BUTTON1_MASK);
   124         robot.mousePress(InputEvent.BUTTON1_MASK);
   121         robot.delay(20);
       
   122         robot.mouseRelease(InputEvent.BUTTON1_MASK);
   125         robot.mouseRelease(InputEvent.BUTTON1_MASK);
   123     }
   126     }
   124 }
   127 }