< prev index next >

test/jdk/java/awt/image/multiresolution/MultiresolutionIconTest.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 22,46 **** */ /* * @test * @key headful ! * @bug 8150724 8151303 * @author a.stepanov * @summary Check that correct resolution variants are chosen for icons * when multiresolution image is used for their construction. * * @library ../../../../lib/testlibrary/ * @build ExtendedRobot * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=1 MultiresolutionIconTest * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=2 MultiresolutionIconTest */ - - // TODO: please remove the "@requires" tag after 8151303 fix - - import java.awt.*; import java.awt.event.InputEvent; import java.awt.image.BaseMultiResolutionImage; import java.awt.image.BufferedImage; import javax.swing.*; --- 22,42 ---- */ /* * @test * @key headful ! * @bug 8150724 8151303 8169187 * @author a.stepanov * @summary Check that correct resolution variants are chosen for icons * when multiresolution image is used for their construction. * * @library ../../../../lib/testlibrary/ * @build ExtendedRobot * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=1 MultiresolutionIconTest * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=2 MultiresolutionIconTest */ import java.awt.*; import java.awt.event.InputEvent; import java.awt.image.BaseMultiResolutionImage; import java.awt.image.BufferedImage; import javax.swing.*;
*** 134,144 **** r.waitForIdle(100); Color c = r.getPixelColor(x, y); r.waitForIdle(100); r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); r.waitForIdle(100); ! if (!c.equals(ok)) { return false; } // check the icon's color hasn't changed // after the mouse was released c = r.getPixelColor(x, y); return c.equals(ok); } --- 130,151 ---- r.waitForIdle(100); Color c = r.getPixelColor(x, y); r.waitForIdle(100); r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); r.waitForIdle(100); ! ! if (!c.equals(ok)) { ! Rectangle bounds = new Rectangle(x, y, 1, 1); ! BufferedImage image = r.createScreenCapture(bounds); ! r.waitForIdle(200); ! Color locColor = new Color(image.getRGB((int)bounds.getWidth()/2, (int)bounds.getHeight()/2), true); ! ! if(!locColor.equals(ok)) { ! System.out.println("Pressed color "+locColor+" does not match the expected color "+ok); ! return false; ! } ! } // check the icon's color hasn't changed // after the mouse was released c = r.getPixelColor(x, y); return c.equals(ok); }
< prev index next >