jdk/test/java/awt/Window/8027025/Test8027025.java
changeset 27763 1fba965925e8
parent 21272 aac4dd1cd15d
child 40128 e635645d2a8a
equal deleted inserted replaced
27762:397a31d6d1a6 27763:1fba965925e8
    26  * @summary [macosx] getLocationOnScreen returns 0 if parent invisible
    26  * @summary [macosx] getLocationOnScreen returns 0 if parent invisible
    27  * @author Petr Pchelko
    27  * @author Petr Pchelko
    28  * @run main Test8027025
    28  * @run main Test8027025
    29  */
    29  */
    30 
    30 
    31 import sun.awt.SunToolkit;
       
    32 
       
    33 import javax.swing.*;
    31 import javax.swing.*;
    34 import java.awt.*;
    32 import java.awt.*;
    35 import java.util.concurrent.atomic.AtomicReference;
    33 import java.util.concurrent.atomic.AtomicReference;
    36 
    34 
    37 public class Test8027025 {
    35 public class Test8027025 {
    47                 window.setSize(200, 200);
    45                 window.setSize(200, 200);
    48                 window.setLocationRelativeTo(frame);
    46                 window.setLocationRelativeTo(frame);
    49                 window.setVisible(true);
    47                 window.setVisible(true);
    50             });
    48             });
    51 
    49 
    52             ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
    50             Robot robot = new Robot();
       
    51             robot.waitForIdle();
    53 
    52 
    54             AtomicReference<Point> point = new AtomicReference<>();
    53             AtomicReference<Point> point = new AtomicReference<>();
    55             SwingUtilities.invokeAndWait(() -> point.set(window.getLocationOnScreen()));
    54             SwingUtilities.invokeAndWait(() -> point.set(window.getLocationOnScreen()));
    56 
    55 
    57             if (point.get().getX() == 0 || point.get().getY() == 0) {
    56             if (point.get().getX() == 0 || point.get().getY() == 0) {