Skip to content

Commit

Permalink
Automatic merge of jdk:master into master
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Nov 11, 2020
2 parents 85dab8e + 5181f9c commit a2620eb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -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
Expand Down
34 changes: 26 additions & 8 deletions test/jdk/javax/swing/JComponent/7154030/bug7154030.java
Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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() {

Expand All @@ -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");
}

Expand All @@ -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");
}

Expand All @@ -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() {

Expand All @@ -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() {

Expand All @@ -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 {
Expand Down

0 comments on commit a2620eb

Please sign in to comment.