RFR: 8347836: Disabled PopupMenu shows shortcuts on Mac [v2]
Alexander Zvegintsev
azvegint at openjdk.org
Mon Feb 3 18:34:50 UTC 2025
On Mon, 3 Feb 2025 17:49:15 GMT, Damon Nguyen <dnguyen at openjdk.org> wrote:
>> The test instructions say that disabled PopupMenus should not have shortcuts shown, but on MacOS, these shortcuts still appear. When checking native MacOS15 behavior, disabled PopupMenus still have shortcuts shown. Since the test doesn't modify the popup's shortcuts other than adding the shortcut for `A`, it makes sense that the result matches native behavior. So, I modified the test instructions instead to exclude MacOS from this step.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23402#discussion_r1939837571
More information about the client-libs-dev
mailing list