< prev index next >
test/java/awt/TrayIcon/SecurityCheck/FunctionalityCheck/FunctionalityCheck.java
Print this page
@@ -49,10 +49,11 @@
String caption = "Sample Icon";
boolean mousePressed = false;
boolean mouseReleased = false;
boolean mouseClicked = false;
boolean mouseMoved = false;
+ static boolean isOEL7;
static final int[] buttonTypes = {
InputEvent.BUTTON1_MASK,
InputEvent.BUTTON2_MASK,
InputEvent.BUTTON3_MASK
@@ -67,10 +68,11 @@
public static void main(String[] args) throws Exception {
if (! SystemTray.isSupported()) {
System.out.println("SystemTray not supported on the platform under test. " +
"Marking the test passed");
} else {
+ isOEL7 = SystemTrayIconHelper.isOel7();
new FunctionalityCheck().doTest();
}
}
FunctionalityCheck() throws Exception {
@@ -186,35 +188,48 @@
Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon);
if (iconPosition == null)
throw new RuntimeException("Unable to find the icon location!");
-
- robot.mouseMove(iconPosition.x, iconPosition.y);
+ if (isOEL7) {
+ // close tray
+ robot.mouseMove(100,100);
+ robot.click(InputEvent.BUTTON1_MASK);
robot.waitForIdle(2000);
+ }
+ robot.mouseMove(iconPosition.x, iconPosition.y);
+ robot.waitForIdle();
+ if(!isOEL7) {
SystemTrayIconHelper.doubleClick(robot);
- if (! actionPerformed) {
+ if (!actionPerformed) {
synchronized (actionLock) {
try {
actionLock.wait(3000);
} catch (Exception e) {
}
}
}
- if (! actionPerformed)
+ 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(3000);
+ pressLock.wait(6000);
} catch (Exception e) {
}
}
}
if (! mousePressed)
@@ -222,16 +237,21 @@
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(3000);
+ releaseLock.wait(6000);
} catch (Exception e) {
}
}
}
if (! mouseReleased)
@@ -240,24 +260,25 @@
buttonNames[i] + " released");
if (! mouseClicked) {
synchronized (clickLock) {
try {
- clickLock.wait(3000);
+ 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 + 100, iconPosition.y);
robot.glide(iconPosition.x, iconPosition.y);
- if (! mouseMoved)
- if (! SystemTrayIconHelper.skip(0) )
+ if (!mouseMoved)
+ if (!SystemTrayIconHelper.skip(0))
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
}
+ }
}
< prev index next >