RFR: 8193543: Regression automated test '/open/test/jdk/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java' fails

Alexander Zvegintsev azvegint at openjdk.java.net
Thu Apr 21 17:54:48 UTC 2022


Looks like this test was written based on assumption that SystemTray is supported on all platforms.

However on Linux it may not be true. 

Availability of SystemTray is detected by getting owner of `_NET_SYSTEM_TRAY` selection:

https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.java#L42

https://github.com/openjdk/jdk/blob/739769c8fc4b496f08a92225a12d07414537b6c0/src/java.desktop/unix/classes/sun/awt/X11/XSystemTrayPeer.java#L58-L59


As an example, SystemTray is not available on Wayland because of this.



So I modified the test:

- WIndows and macOS: expecting SystemTray.
- Linux: check absence/presence of `UnsupportedOperationException` exception of `SystemTray.getSystemTray()` call  based on `SystemTray.isSupported()` result.

-------------

Commit messages:
 - initial

Changes: https://git.openjdk.java.net/jdk/pull/8346/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8346&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8193543
  Stats: 29 lines in 2 files changed: 14 ins; 2 del; 13 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8346.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8346/head:pull/8346

PR: https://git.openjdk.java.net/jdk/pull/8346



More information about the client-libs-dev mailing list