diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index d1c155a7b9c..3cc33d44c61 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -730,7 +730,6 @@ javax/sound/midi/Sequencer/MetaCallback.java 8178698 linux-all javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8233177 linux-all,windows-all javax/swing/border/TestTitledBorderLeak.java 8213531 linux-all -javax/swing/JComponent/7154030/bug7154030.java 7190978 generic-all javax/swing/JComponent/6683775/bug6683775.java 8172337 generic-all javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedTranslucentPerPixelTranslucentGradient.java 8233582 linux-all javax/swing/JWindow/ShapedAndTranslucentWindows/ShapedPerPixelTranslucentGradient.java 8233582 linux-all diff --git a/test/jdk/javax/swing/JComponent/7154030/bug7154030.java b/test/jdk/javax/swing/JComponent/7154030/bug7154030.java index 81a3548486d..4835c07bf94 100644 --- a/test/jdk/javax/swing/JComponent/7154030/bug7154030.java +++ b/test/jdk/javax/swing/JComponent/7154030/bug7154030.java @@ -39,6 +39,8 @@ import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; +import javax.imageio.ImageIO; +import java.io.File; /* * @test @@ -57,6 +59,7 @@ public class bug7154030 { private static JButton button = null; private static JFrame frame; + private static int locx, locy, frw, frh; public static void main(String[] args) throws Exception { try { @@ -86,14 +89,21 @@ public void run() { frame.setContentPane(desktop); frame.setSize(300, 300); - frame.setLocation(0, 0); + frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } }); - robot.waitForIdle(500); - imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300)); + robot.waitForIdle(1000); + + Rectangle bounds = frame.getBounds(); + locx = bounds.x; + locy = bounds.y; + frw = bounds.width; + frh = bounds.height; + + imageInit = robot.createScreenCapture(new Rectangle(locx, locy, frw, frh)); SwingUtilities.invokeAndWait(new Runnable() { @@ -104,8 +114,10 @@ public void run() { }); robot.waitForIdle(500); - imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300)); + imageShow = robot.createScreenCapture(new Rectangle(locx, locy, frw, frh)); if (Util.compareBufferedImages(imageInit, imageShow)) { + ImageIO.write(imageInit, "png", new File("imageInit.png")); + ImageIO.write(imageShow, "png", new File("imageShow.png")); throw new Exception("Failed to show opaque button"); } @@ -119,9 +131,11 @@ public void run() { }); robot.waitForIdle(500); - imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300)); + imageHide = robot.createScreenCapture(new Rectangle(locx, locy, frw, frh)); if (!Util.compareBufferedImages(imageInit, imageHide)) { + ImageIO.write(imageInit, "png", new File("imageInit.png")); + ImageIO.write(imageHide, "png", new File("imageHide.png")); throw new Exception("Failed to hide opaque button"); } @@ -136,7 +150,7 @@ public void run() { }); robot.waitForIdle(500); - imageInit = robot.createScreenCapture(new Rectangle(0, 0, 300, 300)); + imageInit = robot.createScreenCapture(new Rectangle(locx, locy, frw, frh)); SwingUtilities.invokeAndWait(new Runnable() { @@ -147,7 +161,7 @@ public void run() { }); robot.waitForIdle(500); - imageShow = robot.createScreenCapture(new Rectangle(0, 0, 300, 300)); + imageShow = robot.createScreenCapture(new Rectangle(locx, locy, frw, frh)); SwingUtilities.invokeAndWait(new Runnable() { @@ -158,13 +172,17 @@ public void run() { }); if (Util.compareBufferedImages(imageInit, imageShow)) { + ImageIO.write(imageInit, "png", new File("imageInit.png")); + ImageIO.write(imageShow, "png", new File("imageShow.png")); throw new Exception("Failed to show non-opaque button"); } robot.waitForIdle(500); - imageHide = robot.createScreenCapture(new Rectangle(0, 0, 300, 300)); + imageHide = robot.createScreenCapture(new Rectangle(locx, locy, frw, frh)); if (!Util.compareBufferedImages(imageInit, imageHide)) { + ImageIO.write(imageInit, "png", new File("imageInit.png")); + ImageIO.write(imageHide, "png", new File("imageHide.png")); throw new Exception("Failed to hide non-opaque button"); } } finally {