author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 39056 | jdk/test/java/awt/List/ScrollOutside/ScrollOut.java@d99e63b6d962 |
permissions | -rw-r--r-- |
9472
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
1 |
/* |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
28087
diff
changeset
|
2 |
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. |
9472
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
4 |
* |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
8 |
* |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
13 |
* accompanied this code). |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
14 |
* |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
18 |
* |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
21 |
* questions. |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
22 |
*/ |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
23 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
24 |
/* |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
25 |
@test |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
28087
diff
changeset
|
26 |
@key headful |
9472
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
27 |
@bug 7036733 |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
28 |
@summary Regression : NullPointerException when scrolling horizontally on AWT List |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
29 |
@author Andrei Dmitriev area=awt-list |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
30 |
@library ../../regtesthelpers |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
31 |
@build Util |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
32 |
@run main ScrollOut |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
33 |
*/ |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
34 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
35 |
import java.awt.*; |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
36 |
import java.awt.event.*; |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
37 |
import test.java.awt.regtesthelpers.Util; |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
38 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
39 |
public class ScrollOut |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
40 |
{ |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
41 |
public static final void main(String args[]) |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
42 |
{ |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
43 |
final Frame frame = new Frame(); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
44 |
final List list = new List(); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
45 |
Robot robot = null; |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
46 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
47 |
for (int i = 0; i < 5; i++){ |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
48 |
list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
49 |
} |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
50 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
51 |
frame.add(list); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
52 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
53 |
frame.pack(); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
54 |
frame.setLocationRelativeTo(null); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
55 |
frame.setVisible(true); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
56 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
57 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
58 |
try{ |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
59 |
robot = new Robot(); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
60 |
}catch(AWTException e){ |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
61 |
throw new RuntimeException(e); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
62 |
} |
28087
622b2f420bc3
8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents:
9734
diff
changeset
|
63 |
robot.waitForIdle(); |
9472
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
64 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
65 |
//Drag from center to the outside on left |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
66 |
Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2, |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
67 |
list.getLocationOnScreen().y + list.getHeight()/2); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
68 |
Point to = new Point(list.getLocationOnScreen().x - 30, |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
69 |
from.y); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
70 |
|
28087
622b2f420bc3
8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents:
9734
diff
changeset
|
71 |
robot.waitForIdle(); |
9472
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
72 |
Util.drag(robot, from, to, InputEvent.BUTTON1_MASK); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
73 |
|
28087
622b2f420bc3
8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents:
9734
diff
changeset
|
74 |
robot.waitForIdle(); |
9472
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
75 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
76 |
//Drag from center to the outside on up |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
77 |
to = new Point(from.x, |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
78 |
list.getLocationOnScreen().y - 50); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
79 |
|
28087
622b2f420bc3
8063104: Change open awt regression tests to avoid sun.awt.SunToolkit.realSync, part 2
yan
parents:
9734
diff
changeset
|
80 |
robot.waitForIdle(); |
9472
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
81 |
Util.drag(robot, from, to, InputEvent.BUTTON1_MASK); |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
82 |
|
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
83 |
}//End init() |
9f1950d3b025
7036733: Regression : NullPointerException when scrolling horizontally on AWT List
dav
parents:
diff
changeset
|
84 |
} |