Skip to content

Commit

Permalink
8202931: [macos] java/awt/Choice/ChoicePopupLocation/ChoicePopupLocat…
Browse files Browse the repository at this point in the history
…ion.java fails

Backport-of: f80faced6e6c6c1b10541a8b0c91625215c9ef43
  • Loading branch information
GoeLin committed Oct 25, 2023
1 parent 8bde7d4 commit 39c8bb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,6 @@ java/awt/Debug/DumpOnKey/DumpOnKey.java 8202667 windows-all
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java 8202926 linux-all
java/awt/datatransfer/ConstructFlavoredObjectTest/ConstructFlavoredObjectTest.java 8202860 linux-all
java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.java 8202882,8255898 linux-all,macosx-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/Component/NativeInLightShow/NativeInLightShow.java 8202932 linux-all
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -33,6 +33,10 @@
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
Expand All @@ -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();
Expand All @@ -52,7 +57,7 @@ public static void main(final String[] args) throws Exception {
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);
}
Expand Down Expand Up @@ -120,6 +125,8 @@ private static void openPopup(final Choice choice) throws Exception {
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();
}
}
Expand Down

1 comment on commit 39c8bb2

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.