< prev index next >
test/java/awt/TrayIcon/ModalityTest/ModalityTest.java
Print this page
*** 33,42 ****
--- 33,43 ----
* @build ExtendedRobot SystemTrayIconHelper
* @run main ModalityTest
*/
public class ModalityTest {
+ private static boolean isOEL7;
TrayIcon icon;
ExtendedRobot robot;
Dialog d;
boolean actionPerformed = false;
*** 78,88 ****
"in Windows 7, which is behavior by default.\n" +
"Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
"\"Always show all icons and notifications on the taskbar\" true " +
"to avoid this problem. Or change behavior only for Java SE tray " +
"icon and rerun test.");
!
new ModalityTest().doTest();
}
}
public ModalityTest() throws Exception {
--- 79,89 ----
"in Windows 7, which is behavior by default.\n" +
"Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
"\"Always show all icons and notifications on the taskbar\" true " +
"to avoid this problem. Or change behavior only for Java SE tray " +
"icon and rerun test.");
! isOEL7 = SystemTrayIconHelper.isOel7();
new ModalityTest().doTest();
}
}
public ModalityTest() throws Exception {
*** 223,260 ****
throw new RuntimeException("ERROR: TIMEOUT: The thread in EDT not yet complete");
Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
if (iconPosition == null)
throw new RuntimeException("Unable to find the icon location!");
if (! d.isVisible())
throw new RuntimeException("FAIL: The modal dialog is not yet visible");
robot.mouseMove(iconPosition.x, iconPosition.y);
robot.waitForIdle(2000);
SystemTrayIconHelper.doubleClick(robot);
! if (! actionPerformed) {
synchronized (actionLock) {
try {
actionLock.wait(3000);
} catch (Exception e) {
}
}
}
! if (! actionPerformed)
throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is double clicked");
for (int i = 0; i < buttonTypes.length; i++) {
mousePressed = false;
robot.mousePress(buttonTypes[i]);
if (! mousePressed) {
synchronized (pressLock) {
try {
! pressLock.wait(3000);
} catch (Exception e) {
}
}
}
if (! mousePressed)
--- 224,275 ----
throw new RuntimeException("ERROR: TIMEOUT: The thread in EDT not yet complete");
Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
if (iconPosition == null)
throw new RuntimeException("Unable to find the icon location!");
+ if (isOEL7) {
+ // close tray
+ robot.mouseMove(100,100);
+ robot.click(InputEvent.BUTTON1_MASK);
+ robot.waitForIdle(2000);
+ }
if (! d.isVisible())
throw new RuntimeException("FAIL: The modal dialog is not yet visible");
robot.mouseMove(iconPosition.x, iconPosition.y);
robot.waitForIdle(2000);
+ if(!isOEL7) {
SystemTrayIconHelper.doubleClick(robot);
! if (!actionPerformed) {
synchronized (actionLock) {
try {
actionLock.wait(3000);
} catch (Exception e) {
}
}
}
! if (!actionPerformed)
throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is double clicked");
+ }
for (int i = 0; i < buttonTypes.length; i++) {
mousePressed = false;
+ if(isOEL7) {
+ SystemTrayIconHelper.openTrayIfNeeded(robot);
+ robot.mouseMove(iconPosition.x, iconPosition.y);
+ robot.click(buttonTypes[i]);
+ } else {
robot.mousePress(buttonTypes[i]);
+ }
if (! mousePressed) {
synchronized (pressLock) {
try {
! pressLock.wait(6000);
} catch (Exception e) {
}
}
}
if (! mousePressed)
*** 262,277 ****
throw new RuntimeException("FAIL: mousePressed not triggered when " +
buttonNames[i] + " pressed");
mouseReleased = false;
mouseClicked = false;
robot.mouseRelease(buttonTypes[i]);
if (! mouseReleased) {
synchronized (releaseLock) {
try {
! releaseLock.wait(3000);
} catch (Exception e) {
}
}
}
if (! mouseReleased)
--- 277,298 ----
throw new RuntimeException("FAIL: mousePressed not triggered when " +
buttonNames[i] + " pressed");
mouseReleased = false;
mouseClicked = false;
+ if(isOEL7) {
+ SystemTrayIconHelper.openTrayIfNeeded(robot);
+ robot.mouseMove(iconPosition.x, iconPosition.y);
+ robot.click(buttonTypes[i]);
+ } else {
robot.mouseRelease(buttonTypes[i]);
+ }
if (! mouseReleased) {
synchronized (releaseLock) {
try {
! releaseLock.wait(6000);
} catch (Exception e) {
}
}
}
if (! mouseReleased)
*** 279,302 ****
buttonNames[i] + " released");
if (! mouseClicked) {
synchronized (clickLock) {
try {
! clickLock.wait(3000);
} catch (Exception e) {
}
}
}
if (! mouseClicked)
throw new RuntimeException("FAIL: mouseClicked not triggered when " +
buttonNames[i] + " pressed & released");
}
!
mouseMoved = false;
robot.mouseMove(iconPosition.x, iconPosition.y);
robot.glide(iconPosition.x + 100, iconPosition.y);
! if (! mouseMoved)
! if (! SystemTrayIconHelper.skip(0) )
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
}
}
--- 300,324 ----
buttonNames[i] + " released");
if (! mouseClicked) {
synchronized (clickLock) {
try {
! clickLock.wait(6000);
} catch (Exception e) {
}
}
}
if (! mouseClicked)
throw new RuntimeException("FAIL: mouseClicked not triggered when " +
buttonNames[i] + " pressed & released");
}
! if (!isOEL7) {
mouseMoved = false;
robot.mouseMove(iconPosition.x, iconPosition.y);
robot.glide(iconPosition.x + 100, iconPosition.y);
! if (!mouseMoved)
! if (!SystemTrayIconHelper.skip(0))
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
}
+ }
}
< prev index next >