Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/swing/JWindow/ShapedAndTranslucentWindows/PerPixelTranslucent.java
38853 views
/*1* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.awt.*;2425/*26* @test27* @summary Check if a per-pixel translucent window is dragged and resized28* by mouse correctly.29* Test Description: Check if PERPIXEL_TRANSLUCENT translucency type is supported30* on the current platform. Proceed if they are supported. Create a window31* with some components in it, make window undecorated, apply translucent32* background of 0.5. Drag and resize the window using AWT Robot and verify33* that translucency is correctly applied with pixels checking. Make the34* window appear on top of a known background. Repeat this for JWindow,35* JDialog, JFrame.36* Expected Result: If PERPIXEL_TRANSLUCENT translucency type is supported, the37* window should appear with the translucency. Only window background38* should be translucent, all the controls should be opaque.39* @author mrkam40* @library ../../../../lib/testlibrary41* @build Common ExtendedRobot42* @run main PerPixelTranslucent43*/4445public class PerPixelTranslucent extends Common {4647public static void main(String[] ignored) throws Exception {48if (checkTranslucencyMode(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT))49for (Class<Window> windowClass: WINDOWS_TO_TEST)50new PerPixelTranslucent(windowClass).doTest();51}5253public PerPixelTranslucent(Class windowClass) throws Exception {54super(windowClass, 1.0f, 0.5f, false);55}5657public void doTest() throws Exception {58robot.waitForIdle(delay);59checkTranslucent();60}61}626364