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 |
|
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 |
public class FocusTransferDialogsTest { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
29 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
30 |
class CustomDialog1 extends TestDialog { |
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 |
public CustomDialog1(Frame f) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
33 |
super(f); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
34 |
} |
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 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
37 |
public void doOpenAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
38 |
if (dialog2 != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
39 |
dialog2.setVisible(true); |
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 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
42 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
43 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
44 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
45 |
this.dispose(); |
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 |
} |
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 |
class CustomDialog2 extends TestDialog { |
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 |
public CustomDialog2(Dialog d) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
52 |
super(d); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
53 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
54 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
55 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
56 |
public void doOpenAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
57 |
if (dialog3 != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
58 |
dialog3.setVisible(true); |
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 |
} |
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 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
63 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
64 |
this.dispose(); |
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 |
} |
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 |
class CustomDialog3 extends TestDialog { |
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 |
public CustomDialog3(Frame f) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
71 |
super(f); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
72 |
} |
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 |
public CustomDialog3(Dialog d) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
75 |
super(d); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
76 |
} |
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 |
@Override |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
79 |
public void doCloseAction() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
80 |
this.dispose(); |
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 |
} |
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 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
85 |
private TestDialog dialog1, dialog2, dialog3; |
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 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
88 |
private static final int delay = 1000; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
89 |
private final ExtendedRobot robot; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
90 |
private Dialog.ModalityType modalityType; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
91 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
92 |
FocusTransferDialogsTest(Dialog.ModalityType modType) throws Exception { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
93 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
94 |
modalityType = modType; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
95 |
robot = new ExtendedRobot(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
96 |
EventQueue.invokeLater(this::createGUI); |
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 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
99 |
private void createGUI() { |
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 |
dialog1 = new CustomDialog1((Frame) null); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
102 |
dialog1.setTitle("Dialog1"); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
103 |
dialog1.setLocation(50, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
104 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
105 |
if (modalityType != null) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
106 |
dialog1.setModalityType(modalityType); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
107 |
} else { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
108 |
modalityType = Dialog.ModalityType.MODELESS; |
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 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
111 |
dialog2 = new CustomDialog2(dialog1); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
112 |
dialog2.setTitle("Dialog2"); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
113 |
dialog2.setLocation(250, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
114 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
115 |
parentFrame = new Frame(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
116 |
dialog3 = new CustomDialog3(parentFrame); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
117 |
dialog3.setTitle("Dialog3"); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
118 |
dialog3.setLocation(450, 50); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
119 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
120 |
dialog1.setVisible(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
121 |
} |
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 |
private void closeAll() { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
124 |
if (dialog1 != null) { dialog1.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
125 |
if (dialog2 != null) { dialog2.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
126 |
if (dialog3 != null) { dialog3.dispose(); } |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
127 |
if (parentFrame != null) { parentFrame.dispose(); } |
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 |
public void doTest() throws Exception { |
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 |
robot.waitForIdle(delay); |
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 |
try { |
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 |
dialog1.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
137 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
138 |
dialog1.clickOpenButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
139 |
robot.waitForIdle(delay); |
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 |
dialog2.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
142 |
dialog1.checkOpenButtonFocusLost(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
143 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
144 |
dialog1.openGained.reset(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
145 |
dialog2.clickOpenButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
146 |
robot.waitForIdle(delay); |
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 |
switch (modalityType) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
149 |
case APPLICATION_MODAL: |
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 |
dialog3.checkCloseButtonFocusGained(false, 10); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
152 |
dialog2.checkOpenButtonFocusLost(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
153 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
154 |
dialog1.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
155 |
dialog3.closeGained.reset(); |
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 |
dialog1.clickCloseButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
158 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
159 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
160 |
dialog3.checkCloseButtonFocusGained(true); |
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 |
break; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
163 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
164 |
case DOCUMENT_MODAL: |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
165 |
case MODELESS: |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
166 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
167 |
dialog3.checkCloseButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
168 |
dialog2.checkOpenButtonFocusLost(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
169 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
170 |
dialog1.openGained.reset(); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
171 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
172 |
dialog2.clickCloseButton(robot); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
173 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
174 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
175 |
dialog1.checkOpenButtonFocusGained(true); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
176 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
177 |
break; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
178 |
} |
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 |
} catch (Exception e) { |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
181 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
182 |
// make screenshot before exit |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
183 |
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
|
184 |
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
|
185 |
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
|
186 |
|
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
187 |
throw e; |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
188 |
} |
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 |
robot.waitForIdle(delay); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
191 |
EventQueue.invokeAndWait(this::closeAll); |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
192 |
} |
625be49758c1
8047367: move awt automated tests from AWT_Modality to OpenJDK repository - part 2
avstepan
parents:
diff
changeset
|
193 |
} |