author | vlivanov |
Wed, 02 Mar 2016 15:42:03 +0300 | |
changeset 36349 | 6cc8e6f596b2 |
parent 34788 | 176e7a6529d4 |
child 36511 | 9d0388c6b336 |
permissions | -rw-r--r-- |
25137
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
1 |
/* |
34788 | 2 |
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. |
25137
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
4 |
* |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
8 |
* |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
13 |
* accompanied this code). |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
14 |
* |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
18 |
* |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
21 |
* questions. |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
22 |
*/ |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
23 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
24 |
import java.awt.*; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
25 |
import java.awt.image.BufferedImage; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
26 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
27 |
/* |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
28 |
* @test |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
29 |
* @summary Check the return value of the getActionCommand method |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
30 |
* of the ActionEvent triggered when TrayIcon is double clicked |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
31 |
* (single clicked, on Mac) |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
32 |
* @author Dmitriy Ermashov (dmitriy.ermashov@oracle.com) |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
33 |
* @library ../../../../lib/testlibrary ../ |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
34 |
* @build ExtendedRobot SystemTrayIconHelper |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
35 |
* @run main ActionCommand |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
36 |
*/ |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
37 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
38 |
public class ActionCommand { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
39 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
40 |
TrayIcon icon; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
41 |
ExtendedRobot robot; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
42 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
43 |
boolean actionPerformed = false; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
44 |
Object actionLock = new Object(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
45 |
String actionCommand = null; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
46 |
static boolean isMacOS = false; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
47 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
48 |
public static void main(String[] args) throws Exception { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
49 |
if (! SystemTray.isSupported()) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
50 |
System.out.println("SystemTray not supported on the platform under test. " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
51 |
"Marking the test passed"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
52 |
} else { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
53 |
if (System.getProperty("os.name").toLowerCase().startsWith("win")) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
54 |
System.err.println("Test can fail if the icon hides to a tray icons pool " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
55 |
"in Windows 7, which is behavior by default.\n" + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
56 |
"Set \"Right mouse click\" -> \"Customize notification icons\" -> " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
57 |
"\"Always show all icons and notifications on the taskbar\" true to " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
58 |
"avoid this problem. Or change behavior only for Java SE tray icon " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
59 |
"and rerun test."); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
60 |
} else if (System.getProperty("os.name").toLowerCase().startsWith("mac")){ |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
61 |
isMacOS = true; |
34788 | 62 |
} else if (SystemTrayIconHelper.isOel7()) { |
63 |
System.out.println("OEL 7 doesn't support double click in " + |
|
64 |
"systray. Skipped"); |
|
65 |
return; |
|
25137
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
66 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
67 |
new ActionCommand().doTest(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
68 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
69 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
70 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
71 |
void doTest() throws Exception { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
72 |
robot = new ExtendedRobot(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
73 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
74 |
EventQueue.invokeAndWait(() -> { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
75 |
SystemTray tray = SystemTray.getSystemTray(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
76 |
icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), "Sample Icon"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
77 |
icon.addActionListener((event) -> { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
78 |
actionPerformed = true; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
79 |
actionCommand = event.getActionCommand(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
80 |
synchronized (actionLock) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
81 |
try { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
82 |
actionLock.notifyAll(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
83 |
} catch (Exception e) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
84 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
85 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
86 |
}); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
87 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
88 |
if (icon.getActionCommand() != null) |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
89 |
throw new RuntimeException("FAIL: getActionCommand did not return null " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
90 |
"when no action command set " + icon.getActionCommand()); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
91 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
92 |
icon.setActionCommand("Sample Command"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
93 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
94 |
if (! "Sample Command".equals(icon.getActionCommand())) |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
95 |
throw new RuntimeException("FAIL: getActionCommand did not return the correct value. " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
96 |
icon.getActionCommand() + " Expected: Sample Command"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
97 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
98 |
try { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
99 |
tray.add(icon); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
100 |
} catch (AWTException e) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
101 |
throw new RuntimeException(e); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
102 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
103 |
}); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
104 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
105 |
robot.waitForIdle(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
106 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
107 |
Point iconPosition = SystemTrayIconHelper.getTrayIconLocation(icon); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
108 |
if (iconPosition == null) |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
109 |
throw new RuntimeException("Unable to find the icon location!"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
110 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
111 |
robot.mouseMove(iconPosition.x, iconPosition.y); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
112 |
robot.waitForIdle(2000); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
113 |
actionPerformed = false; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
114 |
SystemTrayIconHelper.doubleClick(robot); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
115 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
116 |
if (! actionPerformed) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
117 |
synchronized (actionLock) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
118 |
try { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
119 |
actionLock.wait(3000); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
120 |
} catch (Exception e) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
121 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
122 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
123 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
124 |
if (! actionPerformed) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
125 |
throw new RuntimeException("FAIL: ActionEvent not triggered when TrayIcon is "+(isMacOS? "" : "double ")+"clicked"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
126 |
} else if (! "Sample Command".equals(actionCommand)) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
127 |
throw new RuntimeException("FAIL: ActionEvent.getActionCommand did not return the correct " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
128 |
"value. Returned: " + actionCommand + " ; Expected: Sample Command"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
129 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
130 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
131 |
EventQueue.invokeAndWait(() -> { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
132 |
icon.setActionCommand(null); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
133 |
if (icon.getActionCommand() != null) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
134 |
throw new RuntimeException("FAIL: ActionCommand set to null. getActionCommand did " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
135 |
"not return null " + icon.getActionCommand()); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
136 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
137 |
}); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
138 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
139 |
robot.mouseMove(0, 0); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
140 |
robot.waitForIdle(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
141 |
robot.mouseMove(iconPosition.x, iconPosition.y); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
142 |
robot.waitForIdle(); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
143 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
144 |
actionPerformed = false; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
145 |
actionCommand = null; |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
146 |
SystemTrayIconHelper.doubleClick(robot); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
147 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
148 |
if (! actionPerformed) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
149 |
synchronized (actionLock) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
150 |
try { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
151 |
actionLock.wait(3000); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
152 |
} catch (Exception e) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
153 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
154 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
155 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
156 |
if (! actionPerformed) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
157 |
throw new RuntimeException("FAIL: ActionEvent not triggered when ActionCommand set to " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
158 |
"null and then TrayIcon is "+(isMacOS? "" : "double ")+ "clicked"); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
159 |
} else if (actionCommand != null) { |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
160 |
throw new RuntimeException("FAIL: ActionEvent.getActionCommand did not return null " + |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
161 |
"when ActionCommand is set to null " + actionCommand); |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
162 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
163 |
|
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
164 |
} |
43055e2deee9
8044765: Move functional tests AWT_SystemTray/Automated to openjdk repository
yan
parents:
diff
changeset
|
165 |
} |