RFR: 8280948: [TESTBUG] Write a regression test for JDK-4659800 [v3]

Alexey Ivanov aivanov at openjdk.java.net
Thu Feb 3 21:51:05 UTC 2022


On Thu, 3 Feb 2022 19:10:49 GMT, Manukumar V S <mvs at openjdk.org> wrote:

>> Write a regression test for JDK-4659800.
>> This test checks whether typing 'Enter' key generates ActionEvent on focused Button or not, in Windows and Windows Classic Look And Feels in Windows platform.
>> This test is run 10 times on windows and it passed all the times.
>
> Manukumar V S has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8280948: [TESTBUG] Write a regression test for JDK-4659800

Changes requested by aivanov (Reviewer).

test/jdk/javax/swing/JButton/4659800/EnterKeyActivatesButton.java line 74:

> 72:         frame = new JFrame();
> 73:         JPanel panel = new JPanel();
> 74:         panel.add(new JTextField("Text field"));

It's not necessary here. You're testing JButton itself.

test/jdk/javax/swing/JButton/4659800/EnterKeyActivatesButton.java line 90:

> 88:         Robot robot = new Robot();
> 89:         robot.setAutoDelay(100);
> 90:         for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {

I can suggest iterating over the filtered list of lafs:

LookAndFeelInfo[] winlafs = Arrays.stream(lafs)
                                  .filter(e -> e.getName().startsWith("Windows"))
                                  .toArray(LookAndFeelInfo[]::new)

Or you can collect the result as list via `.collect(Collectors.toList())`.

Alternatively, you can use the `forEach` method with the body of the `for`-loop.

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

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



More information about the client-libs-dev mailing list