11/*
2- * Copyright (c) 2004, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2004, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2020 * or visit www.oracle.com if you need additional information or have any
2121 * questions.
2222 */
23+
2324/*
2425 * @test
2526 * @bug 6180413 6184485 6267144
2627 * @summary test for popup menu visual bugs in XAWT
27- * @library /java/awt/regtesthelpers
28- * @build PassFailJFrame
28+ * @library /java/awt/regtesthelpers /test/lib
29+ * @build PassFailJFrame jdk.test.lib.Platform
2930 * @run main/manual PopupMenuVisuals
3031*/
3132
4041import java .awt .event .ActionListener ;
4142import java .awt .event .KeyEvent ;
4243
44+ import jdk .test .lib .Platform ;
45+
4346public class PopupMenuVisuals {
4447 private static final String INSTRUCTIONS = """
4548 This test should show a button 'Popup'.
4649 Click on the button. A popup menu should be shown.
4750 If following conditions are met:
48- - Menu is disabled
49- - Menu has caption 'Popup menu' (only applicable for linux)
50- - Menu items don't show shortcuts
51+ - Menu is disabled %s%s
5152
52- Click Pass else click Fail.""" ;
53+ Click Pass else click Fail."""
54+ .formatted (
55+ Platform .isLinux () ? "\n - Menu has caption 'Popup menu'" : "" ,
56+ !Platform .isOSX () ? "\n - Menu items don't show shortcuts" : ""
57+ );
5358
5459 static PopupMenu pm ;
5560 static Frame frame ;
@@ -58,7 +63,6 @@ public static void main(String[] args) throws Exception {
5863 PassFailJFrame .builder ()
5964 .title ("PopupMenu Instructions" )
6065 .instructions (INSTRUCTIONS )
61- .rows ((int ) INSTRUCTIONS .lines ().count () + 2 )
6266 .columns (35 )
6367 .testUI (PopupMenuVisuals ::createTestUI )
6468 .build ()
@@ -79,9 +83,9 @@ private static Frame createTestUI() {
7983 CheckboxMenuItem mi3 = new CheckboxMenuItem ("Item 3" );
8084 Menu sm = new Menu ("Submenu" );
8185
82- //Get things going. Request focus, set size, et cetera
86+ // Get things going. Request focus, set size, et cetera
8387 frame = new Frame ("PopupMenuVisuals" );
84- frame .setSize (200 ,200 );
88+ frame .setSize (200 , 200 );
8589 frame .validate ();
8690
8791 frame .add (b );
0 commit comments