author | rehn |
Fri, 07 Jul 2017 23:04:06 +0200 | |
changeset 46643 | cb5f289ba033 |
parent 30923 | 09d24256fd09 |
child 46151 | 5fa789776f7d |
permissions | -rw-r--r-- |
30923
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
1 |
/* |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
2 |
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
4 |
* |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
8 |
* |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
13 |
* accompanied this code). |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
14 |
* |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
18 |
* |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
21 |
* questions. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
22 |
*/ |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
23 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
24 |
import java.awt.*; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
25 |
import java.awt.event.*; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
26 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
27 |
/** |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
28 |
* @test |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
29 |
* @bug 4449139 |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
30 |
* @summary test MouseWheelEvent generation by Scrollbar component |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
31 |
*/ |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
32 |
public final class ScrollbarMouseWheelTest |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
33 |
implements MouseWheelListener, WindowListener { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
34 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
35 |
final static String tk = Toolkit.getDefaultToolkit().getClass().getName(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
36 |
final static int REPS = 5; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
37 |
// There is a bug on Windows: 4616935. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
38 |
// Wheel events comes to every component in the hierarchy so we should |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
39 |
// check a platform. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
40 |
// There are two scrollbars within one Panel and both accept 5 clicks, so |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
41 |
// Panel would accept 5*2 clicks on Windows. |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
42 |
final static int PANEL_REPS = tk.equals("sun.awt.windows.WToolkit")? REPS * 2: REPS; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
43 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
44 |
Scrollbar sb1; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
45 |
Scrollbar sb2; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
46 |
Panel pnl; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
47 |
class Sema { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
48 |
boolean flag; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
49 |
boolean getVal() { return flag;} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
50 |
void setVal(boolean b) { flag = b;} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
51 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
52 |
Sema sema = new Sema(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
53 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
54 |
Robot robot; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
55 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
56 |
int sb1upevents, sb2upevents, pnlupevents; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
57 |
int sb1downevents, sb2downevents, pnldownevents; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
58 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
59 |
public static void main(final String[] args) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
60 |
new ScrollbarMouseWheelTest().test(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
61 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
62 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
63 |
public void test() { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
64 |
// Move mouse to upper-right area |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
65 |
try { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
66 |
robot = new Robot(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
67 |
} catch (AWTException e) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
68 |
System.out.println("Problem creating Robot. FAIL."); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
69 |
throw new RuntimeException("Problem creating Robot. FAIL."); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
70 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
71 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
72 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
73 |
robot.setAutoDelay(500); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
74 |
robot.setAutoWaitForIdle(true); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
75 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
76 |
// Show test Frame |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
77 |
Frame frame = new Frame("ScrollbarMouseWheelTest"); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
78 |
frame.addWindowListener(this); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
79 |
pnl = new Panel(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
80 |
pnl.setLayout(new GridLayout(1, 2)); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
81 |
pnl.addMouseWheelListener(this); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
82 |
sb1 = new Scrollbar(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
83 |
sb1.addMouseWheelListener(this); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
84 |
pnl.add(sb1); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
85 |
sb2 = new Scrollbar(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
86 |
pnl.add(sb2); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
87 |
frame.add(pnl); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
88 |
frame.setSize(200, 400); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
89 |
frame.setLocationRelativeTo(null); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
90 |
frame.setVisible(true); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
91 |
frame.toFront(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
92 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
93 |
// When Frame is active, start testing (handled in windowActivated()) |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
94 |
while (true) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
95 |
synchronized (sema) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
96 |
if (sema.getVal()) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
97 |
break; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
98 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
99 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
100 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
101 |
// up on sb1 |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
102 |
testComp(sb1, true); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
103 |
// down on sb1 |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
104 |
testComp(sb1, false); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
105 |
// up on sb2 |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
106 |
testComp(sb2, true); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
107 |
// down on sb2 |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
108 |
testComp(sb2, false); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
109 |
frame.dispose(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
110 |
System.out.println("Test done."); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
111 |
if (sb1upevents == REPS && |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
112 |
sb2upevents == 0 && |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
113 |
pnlupevents == PANEL_REPS && |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
114 |
sb1downevents == REPS && |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
115 |
sb2downevents == 0 && |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
116 |
pnldownevents == PANEL_REPS) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
117 |
System.out.println("PASSED."); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
118 |
} else { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
119 |
System.out.println("Test Failed:" + |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
120 |
"\n\tsb1upevents =" + sb1upevents + |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
121 |
"\n\tsb2upevents = " + sb2upevents + |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
122 |
"\n\tpnlupevents = " + pnlupevents + |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
123 |
"\n\tsb1downevents =" + sb1downevents + |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
124 |
"\n\tsb2downevents = " + sb2downevents + |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
125 |
"\n\tpnldownevents = " + pnldownevents); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
126 |
throw new RuntimeException("Test FAILED."); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
127 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
128 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
129 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
130 |
public void testComp(Component comp, boolean up) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
131 |
Point loc = comp.getLocationOnScreen(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
132 |
robot.mouseMove(loc.x + comp.getWidth() / 2, |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
133 |
loc.y + comp.getHeight() / 2); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
134 |
for (int loop = 0; loop < REPS; loop++) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
135 |
System.out.println("Robot.mouseWheel() on " + comp.getName()); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
136 |
robot.mouseWheel(up ? -1 : 1); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
137 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
138 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
139 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
140 |
public void mouseWheelMoved(MouseWheelEvent mwe) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
141 |
Component src = mwe.getComponent(); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
142 |
System.out.println("mouseWheelMoved() on " + src.getName()); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
143 |
if (mwe.getWheelRotation() == -1) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
144 |
if (src == sb1) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
145 |
sb1upevents++; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
146 |
} else if (src == sb2) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
147 |
sb2upevents++; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
148 |
} else if (src == pnl) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
149 |
pnlupevents++; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
150 |
} else { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
151 |
System.out.println("weird source component"); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
152 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
153 |
} else if (mwe.getWheelRotation() == 1) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
154 |
if (src == sb1) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
155 |
sb1downevents++; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
156 |
} else if (src == sb2) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
157 |
sb2downevents++; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
158 |
} else if (src == pnl) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
159 |
pnldownevents++; |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
160 |
} else { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
161 |
System.out.println("weird source component"); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
162 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
163 |
} else { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
164 |
System.out.println("weird wheel rotation"); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
165 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
166 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
167 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
168 |
public void windowActivated(WindowEvent we) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
169 |
synchronized (sema) { |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
170 |
sema.setVal(true); |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
171 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
172 |
} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
173 |
|
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
174 |
public void windowClosed(WindowEvent we) {} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
175 |
public void windowClosing(WindowEvent we) {} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
176 |
public void windowDeactivated(WindowEvent we) {} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
177 |
public void windowDeiconified(WindowEvent we) {} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
178 |
public void windowIconified(WindowEvent we) {} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
179 |
public void windowOpened(WindowEvent we) {} |
09d24256fd09
8015900: [TEST_BUG] ScrollbarMouseWheelTest failed on ubuntu 12 with unity and unity 2D
serb
parents:
diff
changeset
|
180 |
}// class ScrollbarMouseWheelTest |