Skip to content

Commit 4d9f207

Browse files
trebarijayathirthrao
authored andcommitted
7151826: [TEST_BUG] [macosx] The test javax/swing/JPopupMenu/4966112/bug4966112.java not for mac
Reviewed-by: serb, jdv
1 parent 1eca634 commit 4d9f207

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,6 @@ javax/swing/JFileChooser/8062561/bug8062561.java 8196466 linux-all,macosx-all
777777
javax/swing/JInternalFrame/Test6325652.java 8224977 macosx-all
778778
javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java 8225045 linux-all
779779
javax/swing/JPopupMenu/4870644/bug4870644.java 8194130 macosx-all,linux-all
780-
javax/swing/JPopupMenu/4966112/bug4966112.java 8064915 macosx-all
781780
javax/swing/MultiUIDefaults/Test6860438.java 8198391 generic-all
782781
javax/swing/UITest/UITest.java 8198392 generic-all
783782
javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 generic-all

test/jdk/javax/swing/JPopupMenu/4966112/bug4966112.java

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,27 @@
3131
* @author Alexander Zuev
3232
* @run main bug4966112
3333
*/
34-
import javax.swing.*;
34+
import javax.swing.JButton;
35+
import javax.swing.JComponent;
36+
import javax.swing.JFileChooser;
37+
import javax.swing.JFrame;
38+
import javax.swing.JPanel;
39+
import javax.swing.JPopupMenu;
40+
import javax.swing.JSpinner;
41+
import javax.swing.JSplitPane;
42+
import javax.swing.SwingUtilities;
43+
import javax.swing.UIManager;
3544
import javax.swing.event.PopupMenuListener;
3645
import javax.swing.event.PopupMenuEvent;
37-
import java.awt.*;
38-
import java.awt.event.*;
46+
47+
import java.awt.BorderLayout;
48+
import java.awt.Dimension;
49+
import java.awt.Robot;
50+
import java.awt.Point;
51+
import java.awt.event.InputEvent;
52+
import java.awt.event.KeyEvent;
53+
import java.awt.event.MouseAdapter;
54+
import java.awt.event.MouseEvent;
3955

4056
public class bug4966112 {
4157

@@ -48,6 +64,7 @@ public class bug4966112 {
4864
private static volatile JFileChooser filec;
4965
private static int buttonMask;
5066
private static Robot robot;
67+
private static boolean isAquaFileChooser;
5168

5269
public static void main(String[] args) throws Exception {
5370
robot = new Robot();
@@ -99,6 +116,11 @@ public static void main(String[] args) throws Exception {
99116
createAndShowFileChooser();
100117
robot.waitForIdle();
101118

119+
if ((UIManager.getLookAndFeel().getID()).equals("Aqua")) {
120+
isAquaFileChooser = true;
121+
} else {
122+
isAquaFileChooser = false;
123+
}
102124
clickMouse(filec);
103125
robot.waitForIdle();
104126

@@ -146,7 +168,11 @@ private static void setClickPoint(final JComponent c) throws Exception {
146168
public void run() {
147169
Point p = c.getLocationOnScreen();
148170
Dimension size = c.getSize();
149-
result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
171+
if (isAquaFileChooser) {
172+
result[0] = new Point(p.x + size.width / 2, p.y + 5);
173+
} else {
174+
result[0] = new Point(p.x + size.width / 2, p.y + size.height / 2);
175+
}
150176
}
151177
});
152178

0 commit comments

Comments
 (0)