1 /*
2 * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import javax.swing.*;
25 import java.awt.*;
26 import java.awt.event.ComponentAdapter;
27 import java.awt.event.ComponentEvent;
28 import java.awt.event.MouseAdapter;
29 import java.awt.event.MouseEvent;
30 import java.awt.geom.Area;
31 import java.awt.geom.GeneralPath;
32 import java.awt.geom.Rectangle2D;
33
34 /*
35 * @test
36 * @summary Check if a window set with shape clips the contents
37 * Test Description: Check if PERPIXEL_TRANSPARENT translucency type is supported
38 * by the current platform. Proceed if it is supported. Apply different types
39 * of shapes on a Window which contains some awt components. Shape should be
40 * applied in such a way that some components are partially clipped off. Check
41 * if the components appear only partially and events work correctly for those
42 * components - i.e. events occur only on the areas which appear and do not
43 * occur on the clipped off areas. Events should be checked by clicking on the
44 * visible and clipped regions. Repeat this for Window, Dialog and Frame.
45 * Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported, clicking
46 * on clipped region should deliver the event to the background (it should be
47 * another Window behind the test window)
48 * @author mrkam
49 * @library ../../../../lib/testlibrary
50 * @build Common ExtendedRobot
51 * @run main SetShapeAndClickSwing
52 */
53
54 public class SetShapeAndClickSwing extends Common {
55
|
1 /*
2 * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import javax.swing.*;
25 import java.awt.*;
26 import java.awt.event.ComponentAdapter;
27 import java.awt.event.ComponentEvent;
28 import java.awt.event.MouseAdapter;
29 import java.awt.event.MouseEvent;
30 import java.awt.geom.Area;
31 import java.awt.geom.GeneralPath;
32 import java.awt.geom.Rectangle2D;
33
34 /*
35 * @test
36 * @key headful
37 * @summary Check if a window set with shape clips the contents
38 * Test Description: Check if PERPIXEL_TRANSPARENT translucency type is supported
39 * by the current platform. Proceed if it is supported. Apply different types
40 * of shapes on a Window which contains some awt components. Shape should be
41 * applied in such a way that some components are partially clipped off. Check
42 * if the components appear only partially and events work correctly for those
43 * components - i.e. events occur only on the areas which appear and do not
44 * occur on the clipped off areas. Events should be checked by clicking on the
45 * visible and clipped regions. Repeat this for Window, Dialog and Frame.
46 * Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported, clicking
47 * on clipped region should deliver the event to the background (it should be
48 * another Window behind the test window)
49 * @author mrkam
50 * @library ../../../../lib/testlibrary
51 * @build Common ExtendedRobot
52 * @run main SetShapeAndClickSwing
53 */
54
55 public class SetShapeAndClickSwing extends Common {
56
|