< prev index next >

test/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java

Print this page




 110             }
 111         });
 112         try {
 113             tray.add(icon);
 114         } catch (AWTException e) {
 115             throw new RuntimeException(e);
 116         }
 117     }
 118 
 119     void doTest() throws Exception {
 120 
 121         Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
 122         if (iconPosition == null)
 123             throw new RuntimeException("Unable to find the icon location!");
 124 
 125         robot.mouseMove(iconPosition.x, iconPosition.y);
 126         robot.waitForIdle();
 127         robot.mousePress(InputEvent.BUTTON3_MASK);
 128         robot.delay(50);
 129         robot.mouseRelease(InputEvent.BUTTON3_MASK);
 130         robot.delay(1000);
 131 
 132         robot.mouseMove(window.getLocation().x + 10, window.getLocation().y + 10);
 133         robot.mousePress(InputEvent.BUTTON3_MASK);
 134         robot.delay(50);
 135         robot.mouseRelease(InputEvent.BUTTON3_MASK);
 136 
 137         int attempts = 0;
 138         while (!actionPerformed && attempts++ < ATTEMPTS) {
 139             synchronized (actionLock) {
 140                 try {
 141                     actionLock.wait(3000);
 142                 } catch (Exception e) {
 143                 }
 144             }
 145         }
 146         if (!actionPerformed)
 147             throw new RuntimeException("FAIL: ActionEvent not triggered when " +
 148                     "JPopupMenu shown and menu item selected using keyboard");
 149 
 150     }


 110             }
 111         });
 112         try {
 113             tray.add(icon);
 114         } catch (AWTException e) {
 115             throw new RuntimeException(e);
 116         }
 117     }
 118 
 119     void doTest() throws Exception {
 120 
 121         Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
 122         if (iconPosition == null)
 123             throw new RuntimeException("Unable to find the icon location!");
 124 
 125         robot.mouseMove(iconPosition.x, iconPosition.y);
 126         robot.waitForIdle();
 127         robot.mousePress(InputEvent.BUTTON3_MASK);
 128         robot.delay(50);
 129         robot.mouseRelease(InputEvent.BUTTON3_MASK);
 130         robot.delay(6000);
 131 
 132         robot.mouseMove(window.getLocation().x + 10, window.getLocation().y + 10);
 133         robot.mousePress(InputEvent.BUTTON3_MASK);
 134         robot.delay(50);
 135         robot.mouseRelease(InputEvent.BUTTON3_MASK);
 136 
 137         int attempts = 0;
 138         while (!actionPerformed && attempts++ < ATTEMPTS) {
 139             synchronized (actionLock) {
 140                 try {
 141                     actionLock.wait(3000);
 142                 } catch (Exception e) {
 143                 }
 144             }
 145         }
 146         if (!actionPerformed)
 147             throw new RuntimeException("FAIL: ActionEvent not triggered when " +
 148                     "JPopupMenu shown and menu item selected using keyboard");
 149 
 150     }
< prev index next >