Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/awt/Paint/bug8024864.java
47490 views
/*1* Copyright (c) 2013, 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*/2223/* @test24* @bug 8024864 803142225* @summary [macosx] Problems with rendering of controls26* @author Petr Pchelko27* @library ../regtesthelpers28* @build Util29* @run main bug802486430*/3132import javax.swing.*;33import java.awt.*;3435import test.java.awt.regtesthelpers.Util;3637public class bug802486438{39private static final int REPEATS = 30;4041private static volatile JFrame frame;4243private static void showTestUI() {44frame = new JFrame();45frame.setBackground(Color.green);46JPanel p = new JPanel();47p.setBackground(Color.red);48JLabel l = new JLabel("Test!");49p.add(l);50frame.add(p);51frame.pack();52frame.setLocation(100,100);53frame.setVisible(true);54}5556public static void main(String[] args) throws Exception57{58Robot r = new Robot();59for (int i = 0; i < REPEATS; i++) {60try {61SwingUtilities.invokeAndWait(bug8024864::showTestUI);62//Thread.sleep(100);63Util.waitTillShown(frame);64Util.waitForIdle(r);6566Dimension frameSize = frame.getSize();67Point loc = new Point(frameSize.width - 15, frameSize.height - 15);68SwingUtilities.convertPointToScreen(loc, frame);69Color c = r.getPixelColor(loc.x, loc.y);7071if (c.getGreen() > 200) {72throw new RuntimeException("TEST FAILED. Unexpected pixel color " + c);73}7475} finally {76if (frame != null) {77frame.dispose();78}79Util.waitForIdle(r);80}81}82}83}848586