< prev index next >

test/java/awt/TrayIcon/ActionEventTest/ActionEventTest.java

Print this page

        

*** 21,34 **** * questions. */ /* * @test ! * @bug 6191390 * @summary Verify that ActionEvent is received with correct modifiers set. * @library ../../../../lib/testlibrary ../ * @build ExtendedRobot SystemTrayIconHelper */ import java.awt.Image; import java.awt.TrayIcon; import java.awt.SystemTray; --- 21,37 ---- * questions. */ /* * @test ! * @bug 6191390 8154328 * @summary Verify that ActionEvent is received with correct modifiers set. * @library ../../../../lib/testlibrary ../ + * @library /java/awt/patchlib + * @build java.desktop/java.awt.Helper * @build ExtendedRobot SystemTrayIconHelper + * @run main ActionEventTest */ import java.awt.Image; import java.awt.TrayIcon; import java.awt.SystemTray;
*** 44,53 **** --- 47,57 ---- public class ActionEventTest { Image image; TrayIcon icon; Robot robot; + boolean actionPerformed; public static void main(String[] args) throws Exception { if (!SystemTray.isSupported()) { System.out.println("SystemTray not supported on the platform." + " Marking the test passed.");
*** 80,89 **** --- 84,94 ---- icon = new TrayIcon( new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "ti"); icon.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { + actionPerformed = true; int md = ae.getModifiers(); int expectedMask = ActionEvent.ALT_MASK | ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK; if ((md & expectedMask) != expectedMask) {
*** 100,109 **** --- 105,117 ---- throw new RuntimeException(e); } } public void clear() { + robot.keyRelease(KeyEvent.VK_ALT); + robot.keyRelease(KeyEvent.VK_SHIFT); + robot.keyRelease(KeyEvent.VK_CONTROL); SystemTray.getSystemTray().remove(icon); } void doTest() throws Exception { robot.keyPress(KeyEvent.VK_ALT);
*** 121,132 **** robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.delay(100); robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - robot.delay(100); robot.waitForIdle(); ! robot.keyRelease(KeyEvent.VK_ALT); ! robot.keyRelease(KeyEvent.VK_SHIFT); ! robot.keyRelease(KeyEvent.VK_CONTROL); } } --- 129,139 ---- robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.delay(100); robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); ! if (!actionPerformed) { ! robot.delay(500); ! } } }
< prev index next >