On Fri, 28 Jun 2024 20:03:32 GMT, Alexey Ivanov <[email protected]> wrote:
>> test/jdk/com/sun/java/swing/plaf/gtk/TestMenuMnemonicOnAltPress.java line 63:
>>
>>> 61:
>>> UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
>>> 62: } else if (laf.getName().contains("Aqua")) {
>>> 63:
>>> UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
>>
>> Suggestion:
>>
>> if (laf.getName().contains("GTK")) {
>> UIManager.setLookAndFeel(laf.getClassName());
>> } else if (laf.getName().contains("Aqua")) {
>> UIManager.setLookAndFeel(laf.getClassName());
>>
>> Now that the body of both `if` statements is the same, you can combine the
>> conditions into one `if` statement.
>
> Alternatively, you can choose the look-and-feel before starting the test:
> there's always only one available.
>
> If you found a L&F, install it and run the test outside the loop (over
> `LookAndFeelInfo` array).
Updated to install the L&F in loop if expected L&F is found.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18992#discussion_r1663457287