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

Reviewed-by: serb, honkar
  • Loading branch information
Damon Nguyen authored and Harshitha Onkar committed Dec 21, 2022
1 parent 7e59a0e commit f80face
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 @@ -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
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

3 comments on commit f80face

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on f80face Oct 24, 2023

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 f80face Oct 24, 2023

Choose a reason for hiding this comment

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

@GoeLin Could not automatically backport f80faced to openjdk/jdk17u-dev due to conflicts in the following files:

  • test/jdk/ProblemList.txt

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk17u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk17u-dev.git master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b GoeLin-backport-f80faced

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git f80faced6e6c6c1b10541a8b0c91625215c9ef43

# Backport the commit
$ git cherry-pick --no-commit f80faced6e6c6c1b10541a8b0c91625215c9ef43
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport f80faced6e6c6c1b10541a8b0c91625215c9ef43'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Backport f80faced6e6c6c1b10541a8b0c91625215c9ef43.

Please sign in to comment.