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

Alexey Ivanov aivanov at openjdk.org
Thu Nov 17 13:09:05 UTC 2022


On Thu, 10 Nov 2022 05:14:36 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.

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

> 49:     private static JFrame frame;
> 50:     private volatile static CountDownLatch actionPerformLatch =
> 51:         new CountDownLatch(1);

Suggestion:

    private final static CountDownLatch actionPerformLatch =
        new CountDownLatch(1);

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

> 53: 
> 54:     private static void createAndShow() {
> 55:         frame = new JFrame("Test Frame");

Suggestion:

        frame = new JFrame("JMenuItem.setAccelerator");

A more meaningful title is better than a very generic one, isn't it?

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

> 79:         try {
> 80:             if (!Desktop.isDesktopSupported()
> 81:                 || !Desktop.getDesktop().isSupported(Action.APP_MENU_BAR)) {

Why are you checking `APP_MENU_BAR` if you don't use it?

Is the test indented for standard `JMenu` or the one that integrates with macOS menu bar?

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

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



More information about the client-libs-dev mailing list