diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index c838ad6fdb7..cd9785e1a24 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -418,7 +418,6 @@ java/awt/image/VolatileImage/GradientPaints.java 8199003 linux-all java/awt/JAWT/JAWT.sh 8197798 windows-all,linux-all java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java 8202860 linux-all java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882 linux-all -java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java 8202931 macosx-all,linux-all java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java 7124275 macosx-all java/awt/Focus/TranserFocusToWindow/TranserFocusToWindow.java 6848810 macosx-all,linux-all java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java 8194751 linux-all diff --git a/test/jdk/java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java b/test/jdk/java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java index 37396a79fa4..229b0492f24 100644 --- a/test/jdk/java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java +++ b/test/jdk/java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022, 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 @@ -33,6 +33,10 @@ import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.InputEvent; +import java.awt.image.BufferedImage; +import java.io.File; + +import javax.imageio.ImageIO; /** * @test @@ -44,6 +48,7 @@ public final class ChoicePopupLocation { private static final int SIZE = 350; private static int frameWidth; + private static Rectangle bounds; public static void main(final String[] args) throws Exception { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); @@ -52,7 +57,7 @@ public final class ChoicePopupLocation { Point right = null; for (GraphicsDevice sd : sds) { GraphicsConfiguration gc = sd.getDefaultConfiguration(); - Rectangle bounds = gc.getBounds(); + bounds = gc.getBounds(); if (left == null || left.x > bounds.x) { left = new Point(bounds.x, bounds.y + bounds.height / 2); } @@ -120,6 +125,8 @@ public final class ChoicePopupLocation { robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); if (choice.getSelectedIndex() == 0) { + BufferedImage failImage = robot.createScreenCapture(bounds); + ImageIO.write(failImage, "png", new File("failImage.png")); throw new RuntimeException(); } }