8311585: Add JRadioButtonMenuItem to bug8031573.java

Reviewed-by: honkar, aivanov
This commit is contained in:
Rajat Mahajan 2023-09-01 21:49:49 +00:00 committed by Harshitha Onkar
parent 2a11bc41ba
commit 4f90abaf17

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,18 +32,18 @@ import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.text.JTextComponent;
/* @test
* @bug 8031573 8040279 8143064
* @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
* @bug 8031573 8040279 8143064 8294427
* @summary Checkmarks of JCheckBoxMenuItems aren't rendered
* in high resolution on Retina
* @requires (os.family != "linux")
* @run main/manual bug8031573
*/
@ -54,14 +54,21 @@ public class bug8031573 {
private static final CountDownLatch latch = new CountDownLatch(1);
public static final String INSTRUCTIONS = "INSTRUCTIONS:\n\n"
+ "Verify that high resolution system icons are used for JCheckBoxMenuItem on HiDPI displays.\n"
+ "If the display does not support HiDPI mode press PASS.\n"
+ "1. Run the test on HiDPI Display.\n"
+ "2. Open the Menu.\n"
+ "3. Check that the icon on the JCheckBoxMenuItem is smooth.\n"
+ " If so, press PASS, else press FAIL.\n";
+ "Verify that the check and radio-check icons are rendered smoothly\n"
+ "for both JCheckBoxMenuItem and JRadioButtonMenuItem.\n"
+ "1. Open the Menu.\n"
+ "2. Check that the icon on the JCheckBoxMenuItem is smooth.\n"
+ "3. Check that the icon on the JRadioButtonMenuItem is smooth.\n"
+ "4. If you're on Windows:\n"
+ " Test the markers are still crisp after changing the scale in Windows settings.\n"
+ " This could be done on same monitor by changing its scale or\n"
+ " by moving the window to a secondary monitor with a different scale.\n"
+ " Then go to step 6.\n"
+ "5. If you're on Mac OS:\n"
+ " If you tested on a Retina display, go to step 6.\n"
+ "6. If both icons render smoothly, press PASS, otherwise press FAIL.\n";
public static void main(String args[]) throws Exception {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
try {
SwingUtilities.invokeAndWait(() -> createTestGUI());
@ -88,6 +95,9 @@ public class bug8031573 {
JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem("JCheckBoxMenuItem");
checkBoxMenuItem.setSelected(true);
menu.add(checkBoxMenuItem);
JRadioButtonMenuItem radioButtonMenuItem = new JRadioButtonMenuItem("JRadioButtonMenuItem");
radioButtonMenuItem.setSelected(true);
menu.add(radioButtonMenuItem);
bar.add(menu);
frame.setJMenuBar(bar);