Skip to content

Commit

Permalink
7151826: [TEST_BUG] [macosx] The test javax/swing/JPopupMenu/4966112/…
Browse files Browse the repository at this point in the history
…bug4966112.java not for mac

Backport-of: 4d9f207
  • Loading branch information
RealCLanger committed Oct 30, 2021
1 parent 363ab5f commit 36e54fb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,6 @@ javax/swing/JInternalFrame/Test6325652.java 8196467 macosx-all
javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java 8225045 linux-all
javax/swing/JLabel/6596966/bug6596966.java 8040914 macosx-all
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all
javax/swing/JPopupMenu/4966112/bug4966112.java 8064915 macosx-all
javax/swing/JSpinner/8223788/JSpinnerButtonFocusTest.java 8238085 macosx-all
javax/swing/MultiUIDefaults/Test6860438.java 8198391 generic-all
javax/swing/UITest/UITest.java 8198392 generic-all
Expand Down
34 changes: 30 additions & 4 deletions test/jdk/javax/swing/JPopupMenu/4966112/bug4966112.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,27 @@
* @author Alexander Zuev
* @run main bug4966112
*/
import javax.swing.*;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JSpinner;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.PopupMenuListener;
import javax.swing.event.PopupMenuEvent;
import java.awt.*;
import java.awt.event.*;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Robot;
import java.awt.Point;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class bug4966112 {

Expand All @@ -48,6 +64,7 @@ public class bug4966112 {
private static volatile JFileChooser filec;
private static int buttonMask;
private static Robot robot;
private static boolean isAquaFileChooser;

public static void main(String[] args) throws Exception {
robot = new Robot();
Expand Down Expand Up @@ -99,6 +116,11 @@ public static void main(String[] args) throws Exception {
createAndShowFileChooser();
robot.waitForIdle();

if ((UIManager.getLookAndFeel().getID()).equals("Aqua")) {
isAquaFileChooser = true;
} else {
isAquaFileChooser = false;
}
clickMouse(filec);
robot.waitForIdle();

Expand Down Expand Up @@ -146,7 +168,11 @@ private static void setClickPoint(final JComponent c) throws Exception {
public void run() {
Point p = c.getLocationOnScreen();
Dimension size = c.getSize();
result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
if (isAquaFileChooser) {
result[0] = new Point(p.x + size.width / 2, p.y + 5);
} else {
result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
}
}
});

Expand Down

1 comment on commit 36e54fb

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