Skip to content

Commit

Permalink
8196096: javax/swing/JPopupMenu/6580930/bug6580930.java fails
Browse files Browse the repository at this point in the history
Reviewed-by: serb
  • Loading branch information
Semyon Sadetsky committed Jun 3, 2019
1 parent abe2973 commit b5b24b9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -735,7 +735,7 @@ javax/swing/JFileChooser/DeserializedJFileChooser/DeserializedJFileChooserTest.j
javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all
javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8193942 generic-all
javax/swing/JList/6462008/bug6462008.java 7156347 generic-all
javax/swing/JPopupMenu/6580930/bug6580930.java 8196096 windows-all,macosx-all
javax/swing/JPopupMenu/6580930/bug6580930.java 7124313 macosx-all
javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all
javax/swing/JPopupMenu/6675802/bug6675802.java 8196097 windows-all
javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
Expand Down
19 changes: 14 additions & 5 deletions test/jdk/javax/swing/JPopupMenu/6580930/bug6580930.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2019, 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 @@ -42,6 +42,8 @@ public class bug6580930 {
private static JPopupMenu popup;
private static Toolkit toolkit;
private static volatile boolean skipTest = false;
private static Point loc;
private static int y;

private static void createGui() {
frame = new JFrame();
Expand Down Expand Up @@ -93,25 +95,32 @@ public void run() {
if(skipTest) {
return;
}
Point loc = frame.getLocationOnScreen();

SwingUtilities.invokeAndWait(() -> loc = frame.getLocationOnScreen());
robot.waitForIdle();

robot.mouseMove(loc.x, loc.y);
showPopup();
robot.waitForIdle();
if (isHeavyWeightMenuVisible()) {
if (!System.getProperty("os.name").startsWith("Mac")
&& isHeavyWeightMenuVisible()) {
throw new RuntimeException("HeavyWeightPopup is unexpectedly visible");
}

robot.keyPress(KeyEvent.VK_ESCAPE);
robot.keyRelease(KeyEvent.VK_ESCAPE);

int x = loc.x;
int y = loc.y + (frame.getHeight() - popup.getPreferredSize().height) + 1;
SwingUtilities.invokeAndWait( () -> y = loc.y + (frame.getHeight() -
popup.getPreferredSize().height) + 1);
robot.waitForIdle();
robot.mouseMove(x, y);

showPopup();
SwingUtilities.invokeAndWait(() -> loc = popup.getLocationOnScreen());
robot.waitForIdle();

if (!popup.getLocationOnScreen().equals(new Point(x, y))) {
if (!loc.equals(new Point(x, y))) {
throw new RuntimeException("Popup is unexpectedly shifted");
}

Expand Down

2 comments on commit b5b24b9

@RealCLanger
Copy link
Contributor

Choose a reason for hiding this comment

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

/backport jdk11u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on b5b24b9 Sep 27, 2021

Choose a reason for hiding this comment

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

@RealCLanger could not automatically backport b5b24b90 to Optional[openjdk/jdk11u-dev] due to conflicts in the following files:

  • test/jdk/javax/swing/JPopupMenu/6580930/bug6580930.java

To manually resolve these conflicts run the following commands in your personal fork of Optional[openjdk/jdk11u-dev]:

$ git checkout -b RealCLanger-backport-b5b24b90
$ git fetch --no-tags https://git.openjdk.java.net/jdk b5b24b904a68432153e8fa5c10cab5c27e871722
$ git cherry-pick --no-commit b5b24b904a68432153e8fa5c10cab5c27e871722
$ # Resolve conflicts
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport b5b24b904a68432153e8fa5c10cab5c27e871722'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the Optional[openjdk/jdk11u-dev] with the title Backport b5b24b904a68432153e8fa5c10cab5c27e871722.

Please sign in to comment.