author | ssadetsky |
Wed, 03 Apr 2019 15:43:25 -0700 | |
branch | JDK-8200758-branch |
changeset 57303 | eff0cf668c29 |
parent 52739 | 7199c4da1a6f |
permissions | -rw-r--r-- |
26601
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
1 |
/* |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
26601
diff
changeset
|
2 |
* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. |
26601
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
4 |
* |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
8 |
* |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
13 |
* accompanied this code). |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
14 |
* |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
18 |
* |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
21 |
* questions. |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
22 |
*/ |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
23 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
24 |
import javax.swing.*; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
25 |
import java.awt.*; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
26 |
import java.awt.event.ComponentAdapter; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
27 |
import java.awt.event.ComponentEvent; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
28 |
import java.awt.event.MouseAdapter; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
29 |
import java.awt.event.MouseEvent; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
30 |
import java.awt.geom.Area; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
31 |
import java.awt.geom.GeneralPath; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
32 |
import java.awt.geom.Rectangle2D; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
33 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
34 |
/* |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
35 |
* @test |
39056
d99e63b6d962
8159690: [TESTBUG] Mark headful tests with @key headful.
goetz
parents:
26601
diff
changeset
|
36 |
* @key headful |
26601
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
37 |
* @summary Check if a window set with shape clips the contents |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
38 |
* Test Description: Check if PERPIXEL_TRANSPARENT translucency type is supported |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
39 |
* by the current platform. Proceed if it is supported. Apply different types |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
40 |
* of shapes on a Window which contains some awt components. Shape should be |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
41 |
* applied in such a way that some components are partially clipped off. Check |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
42 |
* if the components appear only partially and events work correctly for those |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
43 |
* components - i.e. events occur only on the areas which appear and do not |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
44 |
* occur on the clipped off areas. Events should be checked by clicking on the |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
45 |
* visible and clipped regions. Repeat this for Window, Dialog and Frame. |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
46 |
* Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported, clicking |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
47 |
* on clipped region should deliver the event to the background (it should be |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
48 |
* another Window behind the test window) |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
49 |
* @author mrkam |
52739 | 50 |
* @library /lib/client |
26601
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
51 |
* @build Common ExtendedRobot |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
52 |
* @run main SetShapeAndClickSwing |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
53 |
*/ |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
54 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
55 |
public class SetShapeAndClickSwing extends Common { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
56 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
57 |
Component south, center, north; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
58 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
59 |
public static void main(String[] args) throws Exception { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
60 |
if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT)) |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
61 |
for (Class<Window> windowClass: WINDOWS_TO_TEST) |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
62 |
new SetShapeAndClickSwing(windowClass).doTest(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
63 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
64 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
65 |
public SetShapeAndClickSwing(Class windowClass) throws Exception { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
66 |
super(windowClass); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
67 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
68 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
69 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
70 |
public void initBackgroundFrame() { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
71 |
super.initBackgroundFrame(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
72 |
background.addMouseListener(new MouseAdapter() { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
73 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
74 |
public void mouseClicked(MouseEvent e) { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
75 |
clicked |= 1 << 0; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
76 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
77 |
}); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
78 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
79 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
80 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
81 |
public void createSwingComponents() { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
82 |
window.setSize(200,200); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
83 |
window.setLayout(new BorderLayout()); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
84 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
85 |
south = new JLabel("South"); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
86 |
south.addMouseListener(new MouseAdapter() { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
87 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
88 |
public void mouseClicked(MouseEvent e) { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
89 |
clicked |= 1 << 3; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
90 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
91 |
}); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
92 |
window.add(south, BorderLayout.SOUTH); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
93 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
94 |
center = new JList(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
95 |
center.addMouseListener(new MouseAdapter() { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
96 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
97 |
public void mouseClicked(MouseEvent e) { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
98 |
clicked |= 1 << 2; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
99 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
100 |
}); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
101 |
window.add(center, BorderLayout.CENTER); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
102 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
103 |
north = new JTextField("North"); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
104 |
north.addMouseListener(new MouseAdapter() { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
105 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
106 |
public void mouseClicked(MouseEvent e) { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
107 |
clicked |= 1 << 1; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
108 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
109 |
}); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
110 |
window.add(north, BorderLayout.NORTH); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
111 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
112 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
113 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
114 |
public void doTest() throws Exception { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
115 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
116 |
robot.waitForIdle(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
117 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
118 |
Point wls = window.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
119 |
Point ls; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
120 |
int y; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
121 |
ls = north.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
122 |
checkClick(ls.x + north.getWidth() / 3, ls.y + north.getHeight() / 2, 1); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
123 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
124 |
ls = center.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
125 |
checkClick(ls.x + center.getWidth() * 3 / 4, ls.y + center.getHeight() * 3 / 4, 2); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
126 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
127 |
ls = south.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
128 |
checkClick(ls.x + south.getWidth() * 2 / 3, ls.y + south.getHeight() / 2, 3); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
129 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
130 |
ls = center.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
131 |
checkClick(ls.x + center.getWidth() / 4, ls.y + center.getHeight() / 4, 2); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
132 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
133 |
ls = north.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
134 |
y = ls.y + north.getHeight() / 2; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
135 |
checkClick(wls.x + 200 - (y - wls.y), y, 0); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
136 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
137 |
EventQueue.invokeAndWait(window::toFront); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
138 |
robot.waitForIdle(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
139 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
140 |
ls = center.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
141 |
y = ls.y + center.getHeight() / 2; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
142 |
checkClick(wls.x + 200 - (y - wls.y), y, 0); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
143 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
144 |
EventQueue.invokeAndWait(window::toFront); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
145 |
robot.waitForIdle(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
146 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
147 |
ls = south.getLocationOnScreen(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
148 |
y = ls.y + south.getHeight() / 2; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
149 |
checkClick(wls.x + 200 - (y - wls.y), y, 0); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
150 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
151 |
EventQueue.invokeAndWait(window::dispose); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
152 |
EventQueue.invokeAndWait(background::dispose); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
153 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
154 |
robot.waitForIdle(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
155 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
156 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
157 |
@Override |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
158 |
public void applyShape() { |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
159 |
Area shape = new Area(new Rectangle2D.Float(0, 0, 200, 200)); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
160 |
GeneralPath gp; |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
161 |
gp = new GeneralPath(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
162 |
gp.moveTo(190, 0); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
163 |
gp.lineTo(200, 0); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
164 |
gp.lineTo(200, 10); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
165 |
gp.lineTo(10, 200); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
166 |
gp.lineTo(0, 200); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
167 |
gp.lineTo(0, 190); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
168 |
gp.closePath(); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
169 |
shape.subtract(new Area(gp)); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
170 |
|
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
171 |
window.setShape(shape); |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
172 |
} |
2713482c0fd3
8055360: Move the rest part of AWT ShapedAndTranslucent tests to OpenJDK
dermashov
parents:
diff
changeset
|
173 |
} |