1 /*
2 * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
92
93 static int[] keyMasks = {
94 KeyEvent.SHIFT_DOWN_MASK,
95 KeyEvent.CTRL_DOWN_MASK
96 };
97
98 public static void main(String[] args) throws Exception {
99 if (! SystemTray.isSupported()) {
100 System.out.println("SystemTray not supported on the platform under test. " +
101 "Marking the test passed");
102 } else {
103 if (System.getProperty("os.name").toLowerCase().startsWith("win"))
104 System.err.println("Test can fail if the icon hides to a tray icons pool" +
105 "in Windows 7, which is behavior by default.\n" +
106 "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
107 "\"Always show all icons and notifications on the taskbar\" true " +
108 "to avoid this problem. Or change behavior only for Java SE tray " +
109 "icon and rerun test.");
110
111 System.out.println(System.getProperty("os.arch"));
112 if (System.getProperty("os.name").indexOf("Sun") != -1 &&
113 System.getProperty("os.arch").indexOf("sparc") != -1) {
114 keyTypes = new int[]{
115 KeyEvent.VK_SHIFT,
116 KeyEvent.VK_CONTROL,
117 KeyEvent.VK_META
118 };
119
120 keyNames = new String[]{
121 "SHIFT",
122 "CONTROL",
123 "META"
124 };
125 keyMasks = new int[]{
126 KeyEvent.SHIFT_DOWN_MASK,
127 KeyEvent.CTRL_DOWN_MASK,
128 KeyEvent.META_DOWN_MASK
129 };
130 }
131
132 if (SystemTrayIconHelper.isOel7()) {
133 System.out.println("OEL 7 doesn't support click modifiers in " +
134 "systray. Skipped");
135 return;
136 }
137
138 new TrayIconEventModifiersTest().doTest();
139 }
140 }
141
142 public TrayIconEventModifiersTest() throws Exception {
143 robot = new ExtendedRobot();
144 EventQueue.invokeAndWait(this::initializeGUI);
145 }
146
147 private void initializeGUI() {
148
149 SystemTray tray = SystemTray.getSystemTray();
150 icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
|
1 /*
2 * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
92
93 static int[] keyMasks = {
94 KeyEvent.SHIFT_DOWN_MASK,
95 KeyEvent.CTRL_DOWN_MASK
96 };
97
98 public static void main(String[] args) throws Exception {
99 if (! SystemTray.isSupported()) {
100 System.out.println("SystemTray not supported on the platform under test. " +
101 "Marking the test passed");
102 } else {
103 if (System.getProperty("os.name").toLowerCase().startsWith("win"))
104 System.err.println("Test can fail if the icon hides to a tray icons pool" +
105 "in Windows 7, which is behavior by default.\n" +
106 "Set \"Right mouse click\" -> \"Customize notification icons\" -> " +
107 "\"Always show all icons and notifications on the taskbar\" true " +
108 "to avoid this problem. Or change behavior only for Java SE tray " +
109 "icon and rerun test.");
110
111 System.out.println(System.getProperty("os.arch"));
112
113 if (SystemTrayIconHelper.isOel7()) {
114 System.out.println("OEL 7 doesn't support click modifiers in " +
115 "systray. Skipped");
116 return;
117 }
118
119 new TrayIconEventModifiersTest().doTest();
120 }
121 }
122
123 public TrayIconEventModifiersTest() throws Exception {
124 robot = new ExtendedRobot();
125 EventQueue.invokeAndWait(this::initializeGUI);
126 }
127
128 private void initializeGUI() {
129
130 SystemTray tray = SystemTray.getSystemTray();
131 icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_INT_RGB), caption);
|