--- /dev/null 2016-02-18 10:26:55.033760309 +0300 +++ new/test/java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 2016-02-18 12:17:02.581526995 +0300 @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * @test @summary setAlwaysOnTop doesn't behave correctly in Linux/Solaris under + * certain scenarios + * @bug 8036915 + * @author Semyon Sadetsky + * @run main GetScreenLocationTest + */ +import java.awt.*; + +public class GetScreenLocationTest { + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + Window frame = null; + for(int i = 0; i < 100; i++) { + if(frame != null) frame.dispose(); + frame = new Dialog((Frame)null); + frame.setSize(200, 200); + frame.setVisible(true); + robot.waitForIdle(); + robot.delay(100); + frame.setLocation(321, 321); + robot.waitForIdle(); + robot.delay(100); + Dimension size = frame.getSize(); + if(size.width != 200 || size.height != 200) { + frame.dispose(); + throw new RuntimeException("getSize() is wrong " + size); + } + Rectangle r = frame.getBounds(); + frame.dispose(); + if(r.x != 321 || r.y != 321) { + throw new RuntimeException("getLocation() returns " + + "wrong coordinates " + r.getLocation()); + } + if(r.width != 200 || r.height != 200) { + throw new RuntimeException("getSize() is wrong " + r.getSize()); + } + } + System.out.println("ok"); + } + +} \ No newline at end of file