author | egahlin |
Wed, 03 Jul 2019 22:51:44 +0200 | |
branch | JEP-349-branch |
changeset 57449 | 099789ceff7d |
parent 49096 | eaef201ec301 |
permissions | -rw-r--r-- |
12285
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
1 |
/* |
14856 | 2 |
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
12285
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
4 |
* |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
8 |
* |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
13 |
* accompanied this code). |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
14 |
* |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
18 |
* |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
21 |
* questions. |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
22 |
*/ |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
23 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
24 |
/* |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
25 |
* Portions Copyright (c) 2012 IBM Corporation |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
26 |
*/ |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
27 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
28 |
/* @test |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
29 |
* @bug 7155298 |
49096
eaef201ec301
8198333: ProblemList should be updated for headless mode
serb
parents:
47216
diff
changeset
|
30 |
* @key headful |
12285
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
31 |
* @run main/othervm/timeout=60 TestDispose |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
32 |
* @summary Editable TextArea blocks GUI application from exit. |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
33 |
* @author Sean Chou |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
34 |
*/ |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
35 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
36 |
import java.awt.FlowLayout; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
37 |
import java.awt.Frame; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
38 |
import java.awt.TextArea; |
27763
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
39 |
import java.awt.Robot; |
12285
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
40 |
import java.lang.reflect.InvocationTargetException; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
41 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
42 |
import javax.swing.JFrame; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
43 |
import javax.swing.SwingUtilities; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
44 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
45 |
public class TestDispose { |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
46 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
47 |
public static Frame frame = null; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
48 |
public static TextArea textArea = null; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
49 |
public static volatile Process worker = null; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
50 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
51 |
public void testDispose() throws InvocationTargetException, |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
52 |
InterruptedException { |
27763
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
53 |
Robot robot; |
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
54 |
try { |
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
55 |
robot = new Robot(); |
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
56 |
}catch(Exception ex) { |
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
57 |
ex.printStackTrace(); |
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
58 |
throw new RuntimeException("Unexpected failure"); |
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
59 |
} |
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
60 |
|
12285
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
61 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
62 |
SwingUtilities.invokeAndWait(new Runnable() { |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
63 |
@Override |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
64 |
public void run() { |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
65 |
frame = new JFrame("Test"); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
66 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
67 |
textArea = new TextArea("editable textArea"); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
68 |
textArea.setEditable(true); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
69 |
// textArea.setEditable(false); // this testcase passes if textArea is non-editable |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
70 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
71 |
frame.setLayout(new FlowLayout()); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
72 |
frame.add(textArea); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
73 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
74 |
frame.pack(); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
75 |
frame.setVisible(true); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
76 |
} |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
77 |
}); |
27763
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
78 |
robot.waitForIdle(); |
12285
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
79 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
80 |
SwingUtilities.invokeAndWait(new Runnable() { |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
81 |
@Override |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
82 |
public void run() { |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
83 |
frame.dispose(); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
84 |
} |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
85 |
}); |
27763
1fba965925e8
8063102: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
14856
diff
changeset
|
86 |
robot.waitForIdle(); |
12285
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
87 |
} |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
88 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
89 |
public static void main(String[] args) throws Exception{ |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
90 |
if(args.length == 0) { |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
91 |
Runtime.getRuntime().addShutdownHook(new Thread(){ |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
92 |
public void run() { |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
93 |
worker.destroy(); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
94 |
} |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
95 |
}); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
96 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
97 |
System.out.println(System.getProperty("java.home")+"/bin/java TestDispose workprocess"); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
98 |
worker = Runtime.getRuntime().exec(System.getProperty("java.home")+"/bin/java TestDispose workprocess"); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
99 |
worker.waitFor(); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
100 |
return; |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
101 |
} |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
102 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
103 |
TestDispose app = new TestDispose(); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
104 |
app.testDispose(); |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
105 |
} |
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
106 |
|
37f0c586ba99
7155298: Editable TextArea/TextField are blocking GUI applications from exit
zhouyx
parents:
diff
changeset
|
107 |
} |