author | avstepan |
Tue, 18 Nov 2014 17:10:34 +0400 | |
changeset 28068 | e0916ce5b3fc |
permissions | -rw-r--r-- |
28068
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
1 |
/* |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
2 |
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
4 |
* |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
8 |
* |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
13 |
* accompanied this code). |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
14 |
* |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
18 |
* |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
21 |
* questions. |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
22 |
*/ |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
23 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
24 |
import java.awt.*; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
25 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
26 |
public class FileDialogModalityTest { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
27 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
28 |
private volatile TestDialog dialog; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
29 |
private volatile ParentFrame parent; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
30 |
private volatile TestWindow window; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
31 |
private volatile FileDialog fileDialog; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
32 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
33 |
private static final int delay = 500; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
34 |
private final ExtendedRobot robot; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
35 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
36 |
private final Dialog.ModalityType modalityType; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
37 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
38 |
public static void main(String[] args) throws Exception { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
39 |
(new FileDialogModalityTest(Dialog.ModalityType.DOCUMENT_MODAL)).doTest(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
40 |
(new FileDialogModalityTest(Dialog.ModalityType.TOOLKIT_MODAL)).doTest(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
41 |
(new FileDialogModalityTest(Dialog.ModalityType.MODELESS)).doTest(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
42 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
43 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
44 |
public FileDialogModalityTest(Dialog.ModalityType t) throws Exception { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
45 |
modalityType = t; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
46 |
robot = new ExtendedRobot(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
47 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
48 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
49 |
private void createGUI() { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
50 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
51 |
parent = new ParentFrame(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
52 |
dialog = new CustomDialog((Frame) null); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
53 |
window = new CustomWindow(parent); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
54 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
55 |
int x = Toolkit.getDefaultToolkit().getScreenSize().width - |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
56 |
parent.getWidth() - 50; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
57 |
int y = 50; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
58 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
59 |
parent.setLocation(x, y); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
60 |
y += (parent.getHeight() + 50); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
61 |
window.setLocation(x, y); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
62 |
y += (window.getHeight() + 50); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
63 |
dialog.setLocation(x, y); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
64 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
65 |
parent.setVisible(true); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
66 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
67 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
68 |
private void startTest() throws Exception { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
69 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
70 |
EventQueue.invokeLater(this::createGUI); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
71 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
72 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
73 |
parent.clickOpenButton(robot); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
74 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
75 |
window.clickOpenButton(robot); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
76 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
77 |
dialog.clickOpenButton(robot); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
78 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
79 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
80 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
81 |
private void checkUnblockedWindows() throws Exception { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
82 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
83 |
String msg = " should not be blocked."; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
84 |
parent.checkUnblockedFrame (robot, "This frame" + msg); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
85 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
86 |
window.checkUnblockedWindow(robot, "This window" + msg); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
87 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
88 |
dialog.checkUnblockedDialog(robot, "This dialog" + msg); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
89 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
90 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
91 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
92 |
private void checkBlockedWindows() throws Exception { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
93 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
94 |
String msg = " should be blocked by the FileDialog."; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
95 |
parent.checkBlockedFrame (robot, "This Frame" + msg); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
96 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
97 |
window.checkBlockedWindow(robot, "This Window" + msg); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
98 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
99 |
dialog.checkBlockedDialog(robot, "This Dialog" + msg); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
100 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
101 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
102 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
103 |
private void docModalTest() throws Exception { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
104 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
105 |
String msg = "Document modal FileDialog should "; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
106 |
parent.checkUnblockedFrame (robot, msg + "not block this Frame."); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
107 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
108 |
window.checkUnblockedWindow(robot, msg + "not block this Window."); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
109 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
110 |
dialog.checkBlockedDialog(robot, msg + "block its parent Dialog."); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
111 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
112 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
113 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
114 |
public void doTest() throws Exception { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
115 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
116 |
try { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
117 |
startTest(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
118 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
119 |
switch (modalityType) { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
120 |
case APPLICATION_MODAL: |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
121 |
case TOOLKIT_MODAL: |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
122 |
checkBlockedWindows(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
123 |
break; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
124 |
case DOCUMENT_MODAL: |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
125 |
docModalTest(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
126 |
break; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
127 |
case MODELESS: |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
128 |
checkUnblockedWindows(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
129 |
break; |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
130 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
131 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
132 |
EventQueue.invokeAndWait(() -> { fileDialog.dispose(); }); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
133 |
robot.waitForIdle(delay); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
134 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
135 |
if (modalityType != Dialog.ModalityType.MODELESS) { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
136 |
checkUnblockedWindows(); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
137 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
138 |
} finally { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
139 |
EventQueue.invokeLater(this::closeAll); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
140 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
141 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
142 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
143 |
private void closeAll() { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
144 |
if (parent != null) { parent.dispose(); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
145 |
if (dialog != null) { dialog.dispose(); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
146 |
if (window != null) { window.dispose(); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
147 |
if (fileDialog != null) { fileDialog.dispose(); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
148 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
149 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
150 |
class ParentFrame extends TestFrame { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
151 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
152 |
@Override |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
153 |
public void doOpenAction() { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
154 |
if (window != null) { window.setVisible(true); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
155 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
156 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
157 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
158 |
class CustomDialog extends TestDialog { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
159 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
160 |
public CustomDialog(Frame f) { super(f); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
161 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
162 |
@Override |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
163 |
public void doOpenAction() { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
164 |
fileDialog = new FileDialog(this); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
165 |
fileDialog.setModalityType(modalityType); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
166 |
fileDialog.setLocation(50, 50); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
167 |
fileDialog.setVisible(true); |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
168 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
169 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
170 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
171 |
class CustomWindow extends TestWindow { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
172 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
173 |
public CustomWindow(TestFrame f) { super(f); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
174 |
|
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
175 |
@Override |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
176 |
public void doOpenAction() { |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
177 |
if (dialog != null) { dialog.setVisible(true); } |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
178 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
179 |
} |
e0916ce5b3fc
8054359: move awt automated tests from AWT_Modality to OpenJDK repository - part 8
avstepan
parents:
diff
changeset
|
180 |
} |