mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-21 02:48:02 +00:00
8081457: TrayIcon tests fail in OEL 7 only
Reviewed-by: alexsch, serb, azvegint
This commit is contained in:
parent
bcb6785755
commit
39ce42b41e
@ -413,6 +413,7 @@ public class XTrayIconPeer implements TrayIconPeer,
|
||||
void addListeners() {
|
||||
canvas.addMouseListener(eventProxy);
|
||||
canvas.addMouseMotionListener(eventProxy);
|
||||
eframe.addMouseListener(eventProxy);
|
||||
}
|
||||
|
||||
long getWindow() {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -59,8 +59,11 @@ public class ActionCommand {
|
||||
"and rerun test.");
|
||||
} else if (System.getProperty("os.name").toLowerCase().startsWith("mac")){
|
||||
isMacOS = true;
|
||||
} else if (SystemTrayIconHelper.isOel7()) {
|
||||
System.out.println("OEL 7 doesn't support double click in " +
|
||||
"systray. Skipped");
|
||||
return;
|
||||
}
|
||||
|
||||
new ActionCommand().doTest();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -66,6 +66,10 @@ public class ActionEventMask {
|
||||
} else {
|
||||
if (System.getProperty("os.name").toLowerCase().startsWith("mac")) {
|
||||
isMacOS = true;
|
||||
} else if (SystemTrayIconHelper.isOel7()) {
|
||||
System.out.println("OEL 7 doesn't support double click in " +
|
||||
"systray. Skipped");
|
||||
return;
|
||||
}
|
||||
new ActionEventMask().doTest();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,6 +35,7 @@ import java.awt.image.BufferedImage;
|
||||
*/
|
||||
public class ModalityTest {
|
||||
|
||||
private static boolean isOEL7;
|
||||
TrayIcon icon;
|
||||
ExtendedRobot robot;
|
||||
Dialog d;
|
||||
@ -80,7 +81,7 @@ public class ModalityTest {
|
||||
"\"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();
|
||||
}
|
||||
}
|
||||
@ -225,6 +226,12 @@ public class ModalityTest {
|
||||
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");
|
||||
@ -232,27 +239,35 @@ public class ModalityTest {
|
||||
robot.mouseMove(iconPosition.x, iconPosition.y);
|
||||
robot.waitForIdle(2000);
|
||||
|
||||
SystemTrayIconHelper.doubleClick(robot);
|
||||
if(!isOEL7) {
|
||||
SystemTrayIconHelper.doubleClick(robot);
|
||||
|
||||
if (! actionPerformed) {
|
||||
synchronized (actionLock) {
|
||||
try {
|
||||
actionLock.wait(3000);
|
||||
} catch (Exception e) {
|
||||
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");
|
||||
}
|
||||
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(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) {
|
||||
}
|
||||
}
|
||||
@ -264,12 +279,18 @@ public class ModalityTest {
|
||||
|
||||
mouseReleased = false;
|
||||
mouseClicked = false;
|
||||
robot.mouseRelease(buttonTypes[i]);
|
||||
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) {
|
||||
}
|
||||
}
|
||||
@ -281,7 +302,7 @@ public class ModalityTest {
|
||||
if (! mouseClicked) {
|
||||
synchronized (clickLock) {
|
||||
try {
|
||||
clickLock.wait(3000);
|
||||
clickLock.wait(6000);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
@ -290,13 +311,14 @@ public class ModalityTest {
|
||||
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);
|
||||
|
||||
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");
|
||||
if (!mouseMoved)
|
||||
if (!SystemTrayIconHelper.skip(0))
|
||||
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -71,6 +71,8 @@ public class MouseEventMaskTest {
|
||||
"\"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.");
|
||||
} else if (SystemTrayIconHelper.isOel7()) {
|
||||
return;
|
||||
}
|
||||
new MouseEventMaskTest().doTest();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,7 +31,7 @@ import java.awt.image.BufferedImage;
|
||||
* @summary Check for mouseMoved event for java.awt.TrayIcon
|
||||
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com)
|
||||
* @library ../../../../lib/testlibrary
|
||||
* @build ExtendedRobot
|
||||
* @build ExtendedRobot SystemTrayIconHelper
|
||||
* @run main MouseMovedTest
|
||||
*/
|
||||
|
||||
@ -39,6 +39,14 @@ public class MouseMovedTest {
|
||||
static volatile boolean moved;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
if (!SystemTray.isSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SystemTrayIconHelper.isOel7()) {
|
||||
return;
|
||||
}
|
||||
|
||||
moved = false;
|
||||
|
||||
TrayIcon icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Test icon");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -51,6 +51,7 @@ public class FunctionalityCheck {
|
||||
boolean mouseReleased = false;
|
||||
boolean mouseClicked = false;
|
||||
boolean mouseMoved = false;
|
||||
static boolean isOEL7;
|
||||
|
||||
static final int[] buttonTypes = {
|
||||
InputEvent.BUTTON1_MASK,
|
||||
@ -69,6 +70,7 @@ public class FunctionalityCheck {
|
||||
System.out.println("SystemTray not supported on the platform under test. " +
|
||||
"Marking the test passed");
|
||||
} else {
|
||||
isOEL7 = SystemTrayIconHelper.isOel7();
|
||||
new FunctionalityCheck().doTest();
|
||||
}
|
||||
}
|
||||
@ -188,31 +190,44 @@ public class FunctionalityCheck {
|
||||
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);
|
||||
}
|
||||
|
||||
robot.mouseMove(iconPosition.x, iconPosition.y);
|
||||
robot.waitForIdle(2000);
|
||||
robot.waitForIdle();
|
||||
if(!isOEL7) {
|
||||
SystemTrayIconHelper.doubleClick(robot);
|
||||
|
||||
SystemTrayIconHelper.doubleClick(robot);
|
||||
|
||||
if (! actionPerformed) {
|
||||
synchronized (actionLock) {
|
||||
try {
|
||||
actionLock.wait(3000);
|
||||
} catch (Exception e) {
|
||||
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");
|
||||
}
|
||||
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(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) {
|
||||
}
|
||||
}
|
||||
@ -224,12 +239,17 @@ public class FunctionalityCheck {
|
||||
|
||||
mouseReleased = false;
|
||||
mouseClicked = false;
|
||||
robot.mouseRelease(buttonTypes[i]);
|
||||
|
||||
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) {
|
||||
}
|
||||
}
|
||||
@ -242,7 +262,7 @@ public class FunctionalityCheck {
|
||||
if (! mouseClicked) {
|
||||
synchronized (clickLock) {
|
||||
try {
|
||||
clickLock.wait(3000);
|
||||
clickLock.wait(6000);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
@ -251,13 +271,14 @@ public class FunctionalityCheck {
|
||||
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);
|
||||
|
||||
mouseMoved = false;
|
||||
robot.mouseMove(iconPosition.x + 100, iconPosition.y);
|
||||
robot.glide(iconPosition.x, iconPosition.y);
|
||||
|
||||
if (! mouseMoved)
|
||||
if (! SystemTrayIconHelper.skip(0) )
|
||||
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
|
||||
if (!mouseMoved)
|
||||
if (!SystemTrayIconHelper.skip(0))
|
||||
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ grant {
|
||||
permission java.util.PropertyPermission "resultsDir", "read";
|
||||
permission java.util.PropertyPermission "user.home", "read";
|
||||
permission java.util.PropertyPermission "os.name", "read";
|
||||
permission java.util.PropertyPermission "os.version", "read";
|
||||
permission java.awt.AWTPermission "accessEventQueue";
|
||||
permission java.lang.RuntimePermission "setIO";
|
||||
permission java.lang.RuntimePermission "accessDeclaredMembers";
|
||||
@ -17,5 +18,6 @@ grant {
|
||||
permission java.util.PropertyPermission "java.class.path", "read";
|
||||
permission java.awt.AWTPermission "readDisplayPixels";
|
||||
permission java.awt.AWTPermission "watchMousePointer";
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -66,7 +66,9 @@ public class SystemTrayIconHelper {
|
||||
for (int x = (int) (screenSize.getWidth()-width); x > 0; x--) {
|
||||
for (int y = (int) (screenSize.getHeight()-height); y > (screenSize.getHeight()-50); y--) {
|
||||
if (imagesEquals(((BufferedImage)icon.getImage()).getSubimage(0, 0, width, height), screen.getSubimage(x, y, width, height))) {
|
||||
return new Point(x+5, y+5);
|
||||
Point point = new Point(x + 5, y + 5);
|
||||
System.out.println("Icon location " + point);
|
||||
return point;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,6 +93,7 @@ public class SystemTrayIconHelper {
|
||||
point2d = (Point2D)m_getLocation.invoke(peer, new Object[]{model});
|
||||
Point po = new Point((int)(point2d.getX()), (int)(point2d.getY()));
|
||||
po.translate(10, -5);
|
||||
System.out.println("Icon location " + po);
|
||||
return po;
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -101,12 +104,15 @@ public class SystemTrayIconHelper {
|
||||
// sun.awt.X11.XTrayIconPeer
|
||||
Field f_peer = getField(java.awt.TrayIcon.class, "peer");
|
||||
|
||||
SystemTrayIconHelper.openTrayIfNeeded(robot);
|
||||
|
||||
Object peer = f_peer.get(icon);
|
||||
Method m_getLOS = peer.getClass().getDeclaredMethod(
|
||||
"getLocationOnScreen", new Class[]{});
|
||||
m_getLOS.setAccessible(true);
|
||||
Point point = (Point)m_getLOS.invoke(peer, new Object[]{});
|
||||
point.translate(5, 5);
|
||||
System.out.println("Icon location " + point);
|
||||
return point;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -169,4 +175,38 @@ public class SystemTrayIconHelper {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean openTrayIfNeeded(Robot robot) {
|
||||
String sysv = System.getProperty("os.version");
|
||||
System.out.println("System version is " + sysv);
|
||||
//Additional step to raise the system try in Gnome 3 in OEL 7
|
||||
if(isOel7()) {
|
||||
System.out.println("OEL 7 detected");
|
||||
GraphicsConfiguration gc = GraphicsEnvironment.
|
||||
getLocalGraphicsEnvironment().getDefaultScreenDevice().
|
||||
getDefaultConfiguration();
|
||||
Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(gc);
|
||||
if(insets.bottom > 0) {
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit()
|
||||
.getScreenSize();
|
||||
robot.mouseMove(screenSize.width - insets.bottom / 2,
|
||||
screenSize.height - insets.bottom / 2);
|
||||
robot.delay(50);
|
||||
robot.mousePress(InputEvent.BUTTON1_MASK);
|
||||
robot.delay(50);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_MASK);
|
||||
robot.waitForIdle();
|
||||
robot.delay(1000);
|
||||
System.out.println("Tray is opened");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isOel7() {
|
||||
return System.getProperty("os.name").toLowerCase()
|
||||
.contains("linux") && System.getProperty("os.version")
|
||||
.toLowerCase().contains("el7");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -121,6 +121,12 @@ public class TrayIconEventModifiersTest {
|
||||
};
|
||||
}
|
||||
|
||||
if (SystemTrayIconHelper.isOel7()) {
|
||||
System.out.println("OEL 7 doesn't support click modifiers in " +
|
||||
"systray. Skipped");
|
||||
return;
|
||||
}
|
||||
|
||||
new TrayIconEventModifiersTest().doTest();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,7 @@ import java.awt.image.BufferedImage;
|
||||
|
||||
public class TrayIconEventsTest {
|
||||
|
||||
private static boolean isOEL7;
|
||||
TrayIcon icon;
|
||||
ExtendedRobot robot;
|
||||
|
||||
@ -77,6 +78,7 @@ public class TrayIconEventsTest {
|
||||
"\"Always show all icons and notifications on the taskbar\" true " +
|
||||
"to avoid this problem. Or change behavior only for Java SE " +
|
||||
"tray icon.");
|
||||
isOEL7 = SystemTrayIconHelper.isOel7();
|
||||
new TrayIconEventsTest().doTest();
|
||||
}
|
||||
}
|
||||
@ -195,31 +197,44 @@ public class TrayIconEventsTest {
|
||||
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);
|
||||
}
|
||||
|
||||
robot.mouseMove(iconPosition.x, iconPosition.y);
|
||||
robot.waitForIdle(2000);
|
||||
robot.waitForIdle();
|
||||
if(!isOEL7) {
|
||||
SystemTrayIconHelper.doubleClick(robot);
|
||||
|
||||
SystemTrayIconHelper.doubleClick(robot);
|
||||
|
||||
if (! actionPerformed) {
|
||||
synchronized (actionLock) {
|
||||
try {
|
||||
actionLock.wait(10000);
|
||||
} catch (Exception e) {
|
||||
if (!actionPerformed) {
|
||||
synchronized (actionLock) {
|
||||
try {
|
||||
actionLock.wait(10000);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!actionPerformed)
|
||||
throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is double clicked");
|
||||
}
|
||||
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(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) {
|
||||
}
|
||||
}
|
||||
@ -231,12 +246,18 @@ public class TrayIconEventsTest {
|
||||
|
||||
mouseReleased = false;
|
||||
mouseClicked = false;
|
||||
robot.mouseRelease(buttonTypes[i]);
|
||||
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) {
|
||||
}
|
||||
}
|
||||
@ -248,7 +269,7 @@ public class TrayIconEventsTest {
|
||||
if (! mouseClicked) {
|
||||
synchronized (clickLock) {
|
||||
try {
|
||||
clickLock.wait(3000);
|
||||
clickLock.wait(6000);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
@ -258,12 +279,14 @@ public class TrayIconEventsTest {
|
||||
buttonNames[i] + " pressed & released");
|
||||
}
|
||||
|
||||
mouseMoved = false;
|
||||
robot.mouseMove(iconPosition.x + 100, iconPosition.y);
|
||||
robot.glide(iconPosition.x, iconPosition.y);
|
||||
if (!isOEL7) {
|
||||
mouseMoved = false;
|
||||
robot.mouseMove(iconPosition.x + 100, iconPosition.y);
|
||||
robot.glide(iconPosition.x, iconPosition.y);
|
||||
|
||||
if (! mouseMoved)
|
||||
if (! SystemTrayIconHelper.skip(0) )
|
||||
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
|
||||
if (!mouseMoved)
|
||||
if (!SystemTrayIconHelper.skip(0))
|
||||
throw new RuntimeException("FAIL: mouseMoved not triggered even when mouse moved over the icon");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -66,6 +66,10 @@ public class TrayIconMouseTest {
|
||||
} else {
|
||||
if (System.getProperty("os.name").toLowerCase().startsWith("mac")) {
|
||||
isMacOS = true;
|
||||
} else if (SystemTrayIconHelper.isOel7()) {
|
||||
System.out.println("OEL 7 doesn't support double click in " +
|
||||
"systray. Skipped");
|
||||
return;
|
||||
}
|
||||
new TrayIconMouseTest().doTest();
|
||||
}
|
||||
@ -108,7 +112,7 @@ public class TrayIconMouseTest {
|
||||
for (int i = 0; i < buttonTypes.length; i++) {
|
||||
actionPerformed = false;
|
||||
robot.click(buttonTypes[i]);
|
||||
robot.waitForIdle(2000);
|
||||
robot.waitForIdle(6000);
|
||||
|
||||
if (isMacOS && actionPerformed && i == 2) {
|
||||
|
||||
@ -155,7 +159,7 @@ public class TrayIconMouseTest {
|
||||
if (! actionPerformed) {
|
||||
synchronized (actionLock) {
|
||||
try {
|
||||
actionLock.wait(3000);
|
||||
actionLock.wait(6000);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -127,7 +127,7 @@ public class TrayIconPopupTest {
|
||||
robot.mousePress(InputEvent.BUTTON3_MASK);
|
||||
robot.delay(50);
|
||||
robot.mouseRelease(InputEvent.BUTTON3_MASK);
|
||||
robot.delay(1000);
|
||||
robot.delay(6000);
|
||||
|
||||
robot.mouseMove(window.getLocation().x + 10, window.getLocation().y + 10);
|
||||
robot.mousePress(InputEvent.BUTTON3_MASK);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user