RFR: 8296275: Write a test to verify setAccelerator method of JMenuItem [v6]

Alexey Ivanov aivanov at openjdk.org
Tue Nov 29 16:12:34 UTC 2022


On Mon, 21 Nov 2022 05:20:29 GMT, Naveen Narayanan <duke at openjdk.org> wrote:

>> This testcase will
>> 1) Verify setAccelerator method of JMenuitem.
>> 2) Check that the selection of a menu item in the menu bar will generate action by a key combination of META+M.
>> 
>> Testing:
>> Tested using Mach5(20 times per platform) in Mac OS, Linux and Windows and got all pass.
>
> Naveen Narayanan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8296275: Review comments fixed.

I have to repeat a more serious problem:

> Since the test has nothing to do with `Desktop` class it should be moved to `JMenuItem` folder because it tests functionality of `JMenuItem`.

If it's supposed to test the Swing support for macOS global, then the test should do it.

Could you please clarify? If it's for regular  `JMenu` and `JMenuItem`, move the test; if it's for the global, then modify the test accordingly.

test/jdk/java/awt/Desktop/JMenuItemSetAcceleratorTest.java line 48:

> 46:     private static JFrame frame;
> 47:     private static final CountDownLatch actionLatch = new CountDownLatch(1);
> 48:     private static Robot robot;

My IDE issues a warning, the `robot` field can be converted to local variable. Indeed, it isn't used outside of `main`.

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

Changes requested by aivanov (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11035



More information about the client-libs-dev mailing list