RFR: 8347836: Disabled PopupMenu shows shortcuts on Mac [v2]

Damon Nguyen dnguyen at openjdk.org
Mon Feb 3 19:02:31 UTC 2025


On Mon, 3 Feb 2025 18:25:47 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

>> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review comments
>
> test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java line 49:
> 
>> 47:          If following conditions are met:
>> 48:           - Menu is disabled
>> 49:           - Menu has caption 'Popup menu' (only applicable for linux)
> 
> I believe we can only print instructions that are specific to the current platform.
> 
> e.g.:
> 
> 
> --- a/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java
> +++ b/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java
> @@ -20,14 +20,17 @@
>   * or visit www.oracle.com if you need additional information or have any
>   * questions.
>   */
> +
>  /*
>   * @test
>   * @bug 6180413 6184485 6267144
>   * @summary test for popup menu visual bugs in XAWT
> - * @library /java/awt/regtesthelpers
> - * @build PassFailJFrame
> + * @library /java/awt/regtesthelpers /test/lib
> + * @build PassFailJFrame jdk.test.lib.Platform
>   * @run main/manual PopupMenuVisuals
> -*/
> + */
> +
> +import jdk.test.lib.Platform;
>  
>  import java.awt.Button;
>  import java.awt.CheckboxMenuItem;
> @@ -45,11 +48,13 @@ public class PopupMenuVisuals {
>           This test should show a button 'Popup'.
>           Click on the button. A popup menu should be shown.
>           If following conditions are met:
> -          - Menu is disabled
> -          - Menu has caption 'Popup menu' (only applicable for linux)
> -          - Menu items don't show shortcuts (except on MacOS)
> +          - Menu is disabled %s%s
>  
> -         Click Pass else click Fail.""";
> +         Click Pass else click Fail."""
> +            .formatted(
> +                    Platform.isLinux() ? "\n - Menu has caption 'Popup menu'" : "",
> +                    !Platform.isOSX() ? "\n - Menu items don't show shortcuts" : ""
> +            );
>  
>      static PopupMenu pm;
>      static Frame frame;
> 
> 
> I think it will improve a test user experience.

Neat! Learned something new. Will definitely use this where applicable in the future. Added.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23402#discussion_r1939878279


More information about the client-libs-dev mailing list