On Tue, 28 Jan 2025 11:28:27 GMT, Alexander Zvegintsev <azveg...@openjdk.org> 
wrote:

> Several TrayIcon tests are trying to click on the system tray icon with Robot 
> using XTest API.
> 
> Basically we have the same kind of failures as before, e.g. 
> [JDK-8280990](https://bugs.openjdk.org/browse/JDK-8280990)
>>  the reason is this is using XTEST, an X11 protocol which will not work 
>> outside of X11.
>>
>> In other words, the emulated input event reaches the X11 clients, but not 
>> the Wayland compositor which is the actual display server but also the X11 
>> window manager in Wayland, the component which is in charge of 
>> moving/resizing/stacking the windows. 
> 
> I also tested the same tests by clicking manually instead of using the robot, 
> and it works as expected.
> So for now, skip those tests on Wayland (and do some minor cleanup).
> 
> Testing after modifications is also green.

Changes requested by aivanov (Reviewer).

test/jdk/java/awt/TrayIcon/ActionCommand/ActionCommand.java line 68:

> 66: 
> 67:     public static void main(String[] args) throws Exception {
> 68:         if (Platform.isOnWayland()) {

Perhaps, each `if` statement could be standalone… without the `else`. For both 
conditions `Platform.isOnWayland()` and `!SystemTray.isSupported()`, an 
exception is thrown, which means the test effectively finished. The following 
statements would be executed if and only if, no exception was thrown, therefore 
the indentation of the code could be reduced and the code would also look 
cleaner.

test/jdk/java/awt/TrayIcon/ActionCommand/ActionCommand.java line 75:

> 73:             throw new SkippedException("SystemTray is not supported on 
> this platform.");
> 74:         } else {
> 75:             if 
> (System.getProperty("os.name").toLowerCase().startsWith("win")) {

`Platform.isWindows()` could work better… as well `Platform.isOSX()` for Mac.

The case `SystemTrayIconHelper.isOel7orLater()` should probably also throw 
`SkippedException`.

test/jdk/java/awt/TrayIcon/ActionCommand/ActionCommand.java line 148:

> 146:         if (!actionPerformed) {
> 147:             throw new RuntimeException("FAIL: ActionEvent not triggered 
> when TrayIcon is "+(isMacOS? "" : "double ")+"clicked");
> 148:         } else if (! "Sample Command".equals(actionCommand)) {

Suggestion:

        } else if (!"Sample Command".equals(actionCommand)) {

test/jdk/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupClickTest.java line 41:

> 39:  * @summary Check if a action performed event is received when TrayIcon 
> display
> 40:  *          message is clicked on.
> 41:  * @author Shashidhara Veerabhadraiah 
> (shashidhara.veerabhadra...@oracle.com)

Suggestion:


The `@author` tags are removed.

test/jdk/java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java line 46:

> 44:  * @summary Check if a JPopupMenu can be displayed when TrayIcon is
> 45:  *          right clicked. It uses a JWindow as the parent of the 
> JPopupMenu
> 46:  * @author Dmitriy Ermashov (dmitriy.ermas...@oracle.com)

Suggestion:


The @author tags are removed.

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

PR Review: https://git.openjdk.org/jdk/pull/23329#pullrequestreview-2579011225
PR Review Comment: https://git.openjdk.org/jdk/pull/23329#discussion_r1932611515
PR Review Comment: https://git.openjdk.org/jdk/pull/23329#discussion_r1932615258
PR Review Comment: https://git.openjdk.org/jdk/pull/23329#discussion_r1932616875
PR Review Comment: https://git.openjdk.org/jdk/pull/23329#discussion_r1932622551
PR Review Comment: https://git.openjdk.org/jdk/pull/23329#discussion_r1932624759

Reply via email to