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 java.awt.*;
25 import java.awt.event.MouseAdapter;
26 import java.awt.event.MouseEvent;
27 import java.awt.geom.Area;
28 import java.awt.geom.GeneralPath;
29 import java.awt.geom.Rectangle2D;
30
31 /*
32 * @test
33 * @summary Check if dynamically setting a shape works
34 *
35 * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
36 * by the current platform. Proceed if it is supported. Show a window which
37 * contains some components and apply a shape for the Window when the window
38 * is visible. Shape should be applied in such a way that some components
39 * are partially clipped off. Check if the components appear only partially
40 * and events work correctly for those components - ie, events occur only on
41 * the areas which appear and do not occur on the clipped off areas. Events
42 * should be checked by clicking on the visible and clipped regions. Repeat
43 * this for Window, Dialog and Frame.
44 * Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported,
45 * clicking on clipped region should deliver the event to the background (it
46 * should be another Window behind the test window)
47 *
48 * @author mrkam
49 * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
50 * @library ../../../../lib/testlibrary
51 * @build Common ExtendedRobot
52 * @run main SetShapeDynamicallyAndClick
|
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 java.awt.*;
25 import java.awt.event.MouseAdapter;
26 import java.awt.event.MouseEvent;
27 import java.awt.geom.Area;
28 import java.awt.geom.GeneralPath;
29 import java.awt.geom.Rectangle2D;
30
31 /*
32 * @test
33 * @key headful
34 * @summary Check if dynamically setting a shape works
35 *
36 * Test Description: Check if PERPIXEL_TRANSPARENT Translucency type is supported
37 * by the current platform. Proceed if it is supported. Show a window which
38 * contains some components and apply a shape for the Window when the window
39 * is visible. Shape should be applied in such a way that some components
40 * are partially clipped off. Check if the components appear only partially
41 * and events work correctly for those components - ie, events occur only on
42 * the areas which appear and do not occur on the clipped off areas. Events
43 * should be checked by clicking on the visible and clipped regions. Repeat
44 * this for Window, Dialog and Frame.
45 * Expected Result: If PERPIXEL_TRANSPARENT translucency type is supported,
46 * clicking on clipped region should deliver the event to the background (it
47 * should be another Window behind the test window)
48 *
49 * @author mrkam
50 * @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
51 * @library ../../../../lib/testlibrary
52 * @build Common ExtendedRobot
53 * @run main SetShapeDynamicallyAndClick
|