author | hseigel |
Wed, 01 Mar 2017 08:00:02 -0500 | |
changeset 46194 | 5596e6f63072 |
parent 40128 | e635645d2a8a |
permissions | -rw-r--r-- |
10691
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
1 |
/* |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
2 |
* Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
4 |
* |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
8 |
* |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
13 |
* accompanied this code). |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
14 |
* |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
18 |
* |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
21 |
* questions. |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
22 |
*/ |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
23 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
24 |
/* |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
25 |
* @test |
40128
e635645d2a8a
8160974: [TESTBUG] Mark more headful tests with @key headful.
goetz
parents:
28071
diff
changeset
|
26 |
* @key headful |
10691
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
27 |
* @bug 6827032 |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
28 |
* @summary Color chooser with drag enabled shouldn't throw NPE |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
29 |
* @author Peter Zhelezniakov |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
30 |
* @library ../regtesthelpers |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
31 |
*/ |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
32 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
33 |
import java.awt.*; |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
34 |
import java.awt.event.*; |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
35 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
36 |
import javax.swing.*; |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
37 |
import javax.swing.plaf.nimbus.NimbusLookAndFeel; |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
38 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
39 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
40 |
public class Test6827032 { |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
41 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
42 |
private static volatile Point point; |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
43 |
private static JColorChooser cc; |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
44 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
45 |
public static void main(String[] args) throws Exception { |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
46 |
UIManager.setLookAndFeel(new NimbusLookAndFeel()); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
47 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
48 |
Robot robot = new Robot(); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
49 |
robot.setAutoDelay(50); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
50 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
51 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
52 |
SwingUtilities.invokeAndWait(new Runnable() { |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
53 |
public void run() { |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
54 |
createAndShowGUI(); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
55 |
} |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
56 |
}); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
57 |
|
28071
3acb75b8df45
8063107: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents:
10691
diff
changeset
|
58 |
robot.waitForIdle(); |
10691
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
59 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
60 |
SwingUtilities.invokeAndWait(new Runnable() { |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
61 |
public void run() { |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
62 |
Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel"); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
63 |
point = previewPanel.getLocationOnScreen(); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
64 |
} |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
65 |
}); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
66 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
67 |
point.translate(5, 5); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
68 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
69 |
robot.mouseMove(point.x, point.y); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
70 |
robot.mousePress(InputEvent.BUTTON1_MASK); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
71 |
robot.mouseRelease(InputEvent.BUTTON1_MASK); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
72 |
} |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
73 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
74 |
|
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
75 |
private static void createAndShowGUI() { |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
76 |
JFrame frame = new JFrame(Test6827032.class.getName()); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
77 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
78 |
cc = new JColorChooser(); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
79 |
cc.setDragEnabled(true); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
80 |
frame.add(cc); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
81 |
frame.pack(); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
82 |
frame.setVisible(true); |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
83 |
} |
50cda9bfed7e
7076791: closed/javax/swing/JColorChooser/Test6827032.java failed on windows
rupashka
parents:
diff
changeset
|
84 |
} |