Skip to content
Permalink
Browse files

8235900: [TESTBUG] [macos] PopupMenu Opaque property is not reflectin…

…g the Parents property on MAC OS

Reviewed-by: serb
  • Loading branch information
smahaliswamy authored and arapte committed Feb 3, 2020
1 parent 9fb0aee commit 060e4ec305249fc7c4950c102fe890a14b4da889
Showing with 31 additions and 17 deletions.
  1. +31 −17 test/jdk/javax/swing/PopupFactory/6276087/NonOpaquePopupMenuTest.java
@@ -32,10 +32,14 @@
import java.awt.event.*;

import javax.swing.*;
import static javax.swing.UIManager.LookAndFeelInfo;
import static javax.swing.UIManager.getInstalledLookAndFeels;
import static javax.swing.UIManager.setLookAndFeel;

public class NonOpaquePopupMenuTest extends JFrame {

private static JMenu fileMenu;
private static final String AQUALAF="com.apple.laf.AquaLookAndFeel";

public NonOpaquePopupMenuTest() {
getContentPane().setBackground(java.awt.Color.RED);
@@ -53,30 +57,40 @@ public NonOpaquePopupMenuTest() {
}

public static void main(String[] args) throws Throwable {
Robot robot = new Robot();
robot.setAutoDelay(250);
LookAndFeelInfo[] lookAndFeelInfoArray = getInstalledLookAndFeels();

for (LookAndFeelInfo lookAndFeelInfo : lookAndFeelInfoArray) {
System.out.println(lookAndFeelInfo.getClassName());
if ( AQUALAF == lookAndFeelInfo.getClassName()) {
System.out.println("This test scenario is not applicable for" +
" Aqua LookandFeel and hence skipping the validation");
continue;
}
setLookAndFeel(lookAndFeelInfo.getClassName());
Robot robot = new Robot();
robot.setAutoDelay(250);

SwingUtilities.invokeAndWait(new Runnable() {
SwingUtilities.invokeAndWait(new Runnable() {

@Override
public void run() {
new NonOpaquePopupMenuTest();
}
});
@Override
public void run() {
new NonOpaquePopupMenuTest();
}
});

robot.waitForIdle();
robot.waitForIdle();

Point p = getMenuClickPoint();
robot.mouseMove(p.x, p.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
Point p = getMenuClickPoint();
robot.mouseMove(p.x, p.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);

robot.waitForIdle();
robot.waitForIdle();

if (isParentOpaque()) {
throw new RuntimeException("Popup menu parent is opaque");
if (isParentOpaque()) {
throw new RuntimeException("Popup menu parent is opaque");
}
}

}

private static boolean isParentOpaque() throws Exception {

0 comments on commit 060e4ec

Please sign in to comment.