author | avstepan |
Wed, 09 Jul 2014 12:56:03 +0400 | |
changeset 25759 | 625be49758c1 |
permissions | -rw-r--r-- |
25759
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
1 |
/* |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
2 |
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
4 |
* |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
8 |
* |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
13 |
* accompanied this code). |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
14 |
* |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
18 |
* |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
21 |
* questions. |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
22 |
*/ |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
23 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
24 |
import java.awt.*; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
25 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
26 |
// FDW: Frame -> Dialog -> Window |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
27 |
public class FocusTransferFDWTest { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
28 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
29 |
class CustomFrame extends TestFrame { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
30 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
31 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
32 |
public void doOpenAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
33 |
if (dialog != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
34 |
dialog.setVisible(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
35 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
36 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
37 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
38 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
39 |
class CustomWindow extends TestWindow { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
40 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
41 |
public CustomWindow(Dialog d) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
42 |
super(d); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
43 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
44 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
45 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
46 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
47 |
this.dispose(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
48 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
49 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
50 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
51 |
class CustomDialog extends TestDialog { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
52 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
53 |
public CustomDialog(Frame f) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
54 |
super(f); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
55 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
56 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
57 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
58 |
public void doOpenAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
59 |
if (window != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
60 |
window.setVisible(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
61 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
62 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
63 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
64 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
65 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
66 |
this.dispose(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
67 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
68 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
69 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
70 |
private TestDialog dialog; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
71 |
private TestFrame frame; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
72 |
private TestWindow window; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
73 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
74 |
private static final int delay = 1000; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
75 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
76 |
private final ExtendedRobot robot; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
77 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
78 |
private final Dialog.ModalityType modalityType; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
79 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
80 |
FocusTransferFDWTest(Dialog.ModalityType modType) throws Exception { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
81 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
82 |
modalityType = modType; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
83 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
84 |
robot = new ExtendedRobot(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
85 |
EventQueue.invokeLater(this::createGUI); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
86 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
87 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
88 |
private void createGUI() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
89 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
90 |
frame = new CustomFrame(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
91 |
frame.setLocation(50, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
92 |
dialog = new CustomDialog((Frame) null); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
93 |
if (modalityType != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
94 |
dialog.setModalityType(modalityType); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
95 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
96 |
dialog.setLocation(250, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
97 |
window = new CustomWindow(dialog); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
98 |
window.setLocation(450, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
99 |
frame.setVisible(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
100 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
101 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
102 |
private void closeAll() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
103 |
if (dialog != null) { dialog.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
104 |
if ( frame != null) { frame.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
105 |
if (window != null) { window.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
106 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
107 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
108 |
public void doTest() throws Exception { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
109 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
110 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
111 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
112 |
try { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
113 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
114 |
frame.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
115 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
116 |
frame.clickOpenButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
117 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
118 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
119 |
dialog.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
120 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
121 |
frame.checkOpenButtonFocusLost(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
122 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
123 |
dialog.clickOpenButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
124 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
125 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
126 |
window.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
127 |
dialog.checkOpenButtonFocusLost(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
128 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
129 |
dialog.openGained.reset(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
130 |
window.clickCloseButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
131 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
132 |
dialog.checkOpenButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
133 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
134 |
frame.openGained.reset(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
135 |
dialog.clickCloseButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
136 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
137 |
frame.checkOpenButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
138 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
139 |
} catch (Exception e) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
140 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
141 |
// make screenshot before exit |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
142 |
Rectangle rect = new Rectangle(0, 0, 650, 250); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
143 |
java.awt.image.BufferedImage img = robot.createScreenCapture(rect); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
144 |
javax.imageio.ImageIO.write(img, "jpg", new java.io.File("NOK.jpg")); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
145 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
146 |
throw e; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
147 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
148 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
149 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
150 |
EventQueue.invokeAndWait(this::closeAll); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
151 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
152 |
} |