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 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
25 |
import java.awt.*; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
26 |
import static jdk.testlibrary.Asserts.*; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
27 |
|
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 |
// FWD: Frame -> Window -> Dialog |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
30 |
public class FocusTransferFWDTest { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
31 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
32 |
class CustomFrame extends TestFrame { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
33 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
34 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
35 |
public void doOpenAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
36 |
if (window != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
37 |
window.setVisible(true); |
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 |
} |
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 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
42 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
43 |
this.dispose(); |
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 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
46 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
47 |
class CustomWindow extends TestWindow { |
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 |
public CustomWindow(Frame f) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
50 |
super(f); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
51 |
} |
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 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
54 |
public void doOpenAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
55 |
if (dialog != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
56 |
dialog.setVisible(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
57 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
58 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
59 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
60 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
61 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
62 |
this.dispose(); |
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 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
65 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
66 |
class CustomDialog extends TestDialog { |
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 |
public CustomDialog(Frame f) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
69 |
super(f); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
70 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
71 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
72 |
public CustomDialog(Dialog d) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
73 |
super(d); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
74 |
} |
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 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
77 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
78 |
this.dispose(); |
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 |
} |
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 |
private TestDialog dialog; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
83 |
private TestFrame frame; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
84 |
private TestWindow window; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
85 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
86 |
private Frame parentFrame; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
87 |
private Dialog parentDialog; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
88 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
89 |
private static final int delay = 1000; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
90 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
91 |
private final ExtendedRobot robot; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
92 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
93 |
private final Dialog.ModalityType modalityType; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
94 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
95 |
public enum DialogParent {NULL_DIALOG, NULL_FRAME, HIDDEN_DIALOG, HIDDEN_FRAME}; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
96 |
private DialogParent dialogParent; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
97 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
98 |
FocusTransferFWDTest(Dialog.ModalityType modType, |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
99 |
DialogParent dlgParent) throws Exception { |
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 |
modalityType = modType; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
102 |
dialogParent = dlgParent; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
103 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
104 |
robot = new ExtendedRobot(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
105 |
EventQueue.invokeLater(this::createGUI); |
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 |
private void createGUI() { |
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 |
frame = new CustomFrame(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
111 |
frame.setLocation(50, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
112 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
113 |
switch (dialogParent) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
114 |
case NULL_DIALOG: |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
115 |
dialog = new CustomDialog((Dialog) null); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
116 |
break; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
117 |
case NULL_FRAME: |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
118 |
dialog = new CustomDialog((Frame) null); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
119 |
break; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
120 |
case HIDDEN_DIALOG: |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
121 |
parentDialog = new Dialog((Frame) null); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
122 |
dialog = new CustomDialog(parentDialog); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
123 |
break; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
124 |
case HIDDEN_FRAME: |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
125 |
parentFrame = new Frame(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
126 |
dialog = new CustomDialog(parentFrame); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
127 |
break; |
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 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
130 |
assertTrue(dialog != null, "error: null dialog"); |
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 |
if (modalityType != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
133 |
dialog.setModalityType(modalityType); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
134 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
135 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
136 |
dialog.setLocation(250, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
137 |
window = new CustomWindow(frame); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
138 |
window.setLocation(450, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
139 |
frame.setVisible(true); |
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 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
142 |
private void closeAll() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
143 |
if (dialog != null) { dialog.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
144 |
if ( frame != null) { frame.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
145 |
if (window != null) { window.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
146 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
147 |
if (parentDialog != null) { parentDialog.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
148 |
if (parentFrame != null) { parentFrame.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
149 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
150 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
151 |
public void doTest() throws Exception { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
152 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
153 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
154 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
155 |
try { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
156 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
157 |
frame.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
158 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
159 |
frame.clickOpenButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
160 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
161 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
162 |
window.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
163 |
frame.checkOpenButtonFocusLost(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
164 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
165 |
window.clickOpenButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
166 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
167 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
168 |
dialog.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
169 |
window.checkOpenButtonFocusLost(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
170 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
171 |
window.openGained.reset(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
172 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
173 |
dialog.clickCloseButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
174 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
175 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
176 |
window.checkOpenButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
177 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
178 |
frame.openGained.reset(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
179 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
180 |
window.clickCloseButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
181 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
182 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
183 |
frame.checkOpenButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
184 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
185 |
frame.clickCloseButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
186 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
187 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
188 |
} catch (Exception e) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
189 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
190 |
// make screenshot before exit |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
191 |
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
|
192 |
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
|
193 |
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
|
194 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
195 |
throw e; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
196 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
197 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
198 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
199 |
EventQueue.invokeAndWait(this::closeAll); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
200 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
201 |
} |