8202931: [macos] java/awt/Choice/ChoicePopupLocation/ChoicePopupLocation.java fails

Reviewed-by: serb, honkar
This commit is contained in:
Damon Nguyen 2022-12-21 20:10:52 +00:00 committed by Harshitha Onkar
parent 7e59a0ecb6
commit f80faced6e
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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();
}
}