1 /* |
1 /* |
2 * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
20 * or visit www.oracle.com if you need additional information or have any |
20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 test |
25 @test |
|
26 @key headful |
26 @bug 4868278 |
27 @bug 4868278 |
27 @summary Tests that GraphicsConfig for invisible (peerless) window is |
28 @summary Tests that GraphicsConfig for invisible (peerless) windows is |
28 updated after showing the window |
29 updated after showing the window |
29 @author artem.ananiev, area=awt.multiscreen |
|
30 @library ../../regtesthelpers |
30 @library ../../regtesthelpers |
31 @build Util |
31 @build Util |
32 @run applet WindowGCChangeTest.html |
32 @run main WindowGCChangeTest |
33 */ |
33 */ |
34 |
|
35 import java.applet.Applet; |
|
36 |
34 |
37 import java.awt.*; |
35 import java.awt.*; |
38 import java.awt.event.*; |
36 import java.awt.event.*; |
39 |
37 |
40 import test.java.awt.regtesthelpers.Util; |
38 import test.java.awt.regtesthelpers.Util; |
41 |
39 |
42 public class WindowGCChangeTest extends Applet |
40 public class WindowGCChangeTest { |
43 { |
|
44 public void init() |
|
45 { |
|
46 } |
|
47 |
41 |
48 public void start() |
42 public static void main(final String[] args) { |
49 { |
|
50 Robot robot = null; |
43 Robot robot = null; |
51 try |
44 try |
52 { |
45 { |
53 robot = new Robot(); |
46 robot = new Robot(); |
54 } |
47 } |
55 catch (Exception z) |
48 catch (Exception z) |
56 { |
49 { |
57 z.printStackTrace(System.err); |
50 z.printStackTrace(System.err); |
58 throw new RuntimeException("Test FAILED: couldn't create Robot instance", z); |
51 throw new RuntimeException("Test FAILED: couldn't create Robot instance", z); |
59 } |
52 } |
60 |
|
61 setSize(200, 200); |
|
62 setVisible(true); |
|
63 validate(); |
|
64 Util.waitForIdle(robot); |
53 Util.waitForIdle(robot); |
65 |
54 |
66 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
55 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
67 GraphicsDevice[] gds = ge.getScreenDevices(); |
56 GraphicsDevice[] gds = ge.getScreenDevices(); |
68 // check 2-screens systems only |
57 // check 2-screens systems only |