Skip to content

Commit

Permalink
8300405: Screen capture for test JFileChooserSetLocationTest.java, fa…
Browse files Browse the repository at this point in the history
…ilure case

Reviewed-by: serb
  • Loading branch information
Tejesh R committed Jan 27, 2023
1 parent 3758487 commit db8fa1b
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,23 @@

import java.awt.Component;
import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
Expand Down Expand Up @@ -175,12 +181,18 @@ private static Point getActualLocation(final MyFileChooser fcoo)
return pt.get();
}

public static void verify(int x1, int x2, int y1, int y2) {
public static void verify(int x1, int x2, int y1, int y2) throws Exception {
System.out.println("verify " + x1 + "==" + x2 + "; " + y1 + "==" + y2);
if ((Math.abs(x1 - x2) < TOLERANCE_LEVEL) &&
(Math.abs(y1 - y2) < TOLERANCE_LEVEL)) {
System.out.println("Test passed");
} else {
GraphicsConfiguration gc = GraphicsEnvironment.
getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
Rectangle gcBounds = gc.getBounds();
BufferedImage bufferedImage = robot.createScreenCapture(
new Rectangle(gcBounds));
ImageIO.write(bufferedImage, "png",new File("FailureImage.png"));
throw new RuntimeException(
"Test Failed, setLocation() is not working properly");
}
Expand Down

3 comments on commit db8fa1b

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on db8fa1b Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheRealMDoerr the backport was successfully created on the branch TheRealMDoerr-backport-db8fa1be in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit db8fa1be from the openjdk/jdk repository.

The commit being backported was authored by Tejesh R on 27 Jan 2023 and was reviewed by Sergey Bylokhov.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git TheRealMDoerr-backport-db8fa1be:TheRealMDoerr-backport-db8fa1be
$ git checkout TheRealMDoerr-backport-db8fa1be
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git TheRealMDoerr-backport-db8fa1be

Please sign in to comment.