author | vromero |
Thu, 05 Jan 2017 11:16:39 -0800 | |
changeset 43033 | c37b643739a7 |
parent 40128 | e635645d2a8a |
permissions | -rw-r--r-- |
11099
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
1 |
/* |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
2 |
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
4 |
* |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
8 |
* |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
13 |
* accompanied this code). |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
14 |
* |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
18 |
* |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
21 |
* questions. |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
22 |
*/ |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
23 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
24 |
/* |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
25 |
* @test |
40128
e635645d2a8a
8160974: [TESTBUG] Mark more headful tests with @key headful.
goetz
parents:
27764
diff
changeset
|
26 |
* @key headful |
11099
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
27 |
* @bug 4865918 |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
28 |
* @summary REGRESSION:JCK1.4a-runtime api/javax_swing/interactive/JScrollBarTests.html#JScrollBar |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
29 |
* @author Andrey Pikalev |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
30 |
* @run main bug4865918 |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
31 |
*/ |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
32 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
33 |
import javax.swing.*; |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
34 |
import java.awt.*; |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
35 |
import java.awt.event.*; |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
36 |
import java.util.*; |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
37 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
38 |
public class bug4865918 { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
39 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
40 |
private static TestScrollBar sbar; |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
41 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
42 |
public static void main(String[] argv) throws Exception { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
43 |
|
27764
4e79ff3e0602
8063106: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
11099
diff
changeset
|
44 |
Robot robot = new Robot(); |
11099
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
45 |
SwingUtilities.invokeAndWait(new Runnable() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
46 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
47 |
public void run() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
48 |
createAndShowGUI(); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
49 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
50 |
}); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
51 |
|
27764
4e79ff3e0602
8063106: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
11099
diff
changeset
|
52 |
robot.waitForIdle(); |
11099
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
53 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
54 |
SwingUtilities.invokeAndWait(new Runnable() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
55 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
56 |
@Override |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
57 |
public void run() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
58 |
sbar.pressMouse(); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
59 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
60 |
}); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
61 |
|
27764
4e79ff3e0602
8063106: Change open swing regression tests to avoid sun.awt.SunToolkit.realSync, part 1
yan
parents:
11099
diff
changeset
|
62 |
robot.waitForIdle(); |
11099
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
63 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
64 |
int value = getValue(); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
65 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
66 |
if (value != 9) { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
67 |
throw new Error("The scrollbar block increment is incorect"); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
68 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
69 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
70 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
71 |
private static int getValue() throws Exception { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
72 |
final int[] result = new int[1]; |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
73 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
74 |
SwingUtilities.invokeAndWait(new Runnable() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
75 |
@Override |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
76 |
public void run() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
77 |
result[0] = sbar.getValue(); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
78 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
79 |
}); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
80 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
81 |
return result[0]; |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
82 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
83 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
84 |
private static void createAndShowGUI() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
85 |
JFrame frame = new JFrame("bug4865918"); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
86 |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
87 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
88 |
sbar = new TestScrollBar(JScrollBar.HORIZONTAL, -1, 10, -100, 100); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
89 |
sbar.setPreferredSize(new Dimension(200, 20)); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
90 |
sbar.setBlockIncrement(10); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
91 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
92 |
frame.getContentPane().add(sbar); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
93 |
frame.pack(); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
94 |
frame.setVisible(true); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
95 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
96 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
97 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
98 |
static class TestScrollBar extends JScrollBar { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
99 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
100 |
public TestScrollBar(int orientation, int value, int extent, |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
101 |
int min, int max) { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
102 |
super(orientation, value, extent, min, max); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
103 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
104 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
105 |
|
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
106 |
public void pressMouse() { |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
107 |
MouseEvent me = new MouseEvent(sbar, |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
108 |
MouseEvent.MOUSE_PRESSED, |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
109 |
(new Date()).getTime(), |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
110 |
MouseEvent.BUTTON1_MASK, |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
111 |
3 * getWidth() / 4, getHeight() / 2, |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
112 |
1, true); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
113 |
processMouseEvent(me); |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
114 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
115 |
} |
0842eb336150
7110440: closed/javax/swing/JScrollBar/4865918/bug4865918.java fails on Aqua L&F
rupashka
parents:
diff
changeset
|
116 |
} |