author | goetz |
Tue, 14 Jun 2016 10:44:59 +0200 | |
changeset 39056 | d99e63b6d962 |
parent 31649 | 738dd49e1689 |
permissions | -rw-r--r-- |
31649
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
1 |
/* |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
4 |
* |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
8 |
* |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
13 |
* accompanied this code). |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
14 |
* |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
18 |
* |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
21 |
* questions. |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
22 |
*/ |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
23 |
|
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
24 |
/* |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
25 |
@test |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
31649
diff
changeset
|
26 |
@key headful |
31649
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
27 |
@bug 8129116 |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
28 |
@summary Deadlock with multimonitor fullscreen windows. |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
29 |
@run main/timeout=20 MultimonDeadlockTest |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
30 |
*/ |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
31 |
import java.awt.*; |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
32 |
import java.awt.event.WindowAdapter; |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
33 |
import java.awt.event.WindowEvent; |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
34 |
import java.lang.reflect.InvocationTargetException; |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
35 |
|
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
36 |
public class MultimonDeadlockTest { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
37 |
|
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
38 |
public static void main(String argv[]) { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
39 |
final GraphicsDevice[] devices = GraphicsEnvironment |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
40 |
.getLocalGraphicsEnvironment() |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
41 |
.getScreenDevices(); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
42 |
if (devices.length < 2) { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
43 |
System.out.println("It's a multiscreen test... skipping!"); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
44 |
return; |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
45 |
} |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
46 |
|
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
47 |
Frame frames[] = new Frame[devices.length]; |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
48 |
try { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
49 |
EventQueue.invokeAndWait(() -> { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
50 |
for (int i = 0; i < devices.length; i++) { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
51 |
frames[i] = new Frame(); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
52 |
frames[i].setSize(100, 100); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
53 |
frames[i].setBackground(Color.BLUE); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
54 |
devices[i].setFullScreenWindow(frames[i]); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
55 |
} |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
56 |
}); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
57 |
Thread.sleep(5000); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
58 |
} catch (InterruptedException | InvocationTargetException ex) { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
59 |
} finally { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
60 |
for (int i = 0; i < devices.length; i++) { |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
61 |
devices[i].setFullScreenWindow(null); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
62 |
frames[i].dispose(); |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
63 |
} |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
64 |
} |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
65 |
|
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
66 |
} |
738dd49e1689
8129116: Deadlock with multimonitor fullscreen windows.
azvegint
parents:
diff
changeset
|
67 |
} |