|
| 1 | +/* |
| 2 | + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | + * |
| 5 | + * This code is free software; you can redistribute it and/or modify it |
| 6 | + * under the terms of the GNU General Public License version 2 only, as |
| 7 | + * published by the Free Software Foundation. |
| 8 | + * |
| 9 | + * This code is distributed in the hope that it will be useful, but WITHOUT |
| 10 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 11 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 12 | + * version 2 for more details (a copy is included in the LICENSE file that |
| 13 | + * accompanied this code). |
| 14 | + * |
| 15 | + * You should have received a copy of the GNU General Public License version |
| 16 | + * 2 along with this work; if not, write to the Free Software Foundation, |
| 17 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 | + * |
| 19 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
| 20 | + * or visit www.oracle.com if you need additional information or have any |
| 21 | + * questions. |
| 22 | + */ |
| 23 | +import java.awt.BorderLayout; |
| 24 | +import java.awt.Dialog; |
| 25 | +import java.awt.EventQueue; |
| 26 | +import java.awt.Frame; |
| 27 | +import java.awt.TextArea; |
| 28 | +import javax.swing.JDialog; |
| 29 | +import javax.swing.JOptionPane; |
| 30 | +import javax.swing.SwingUtilities; |
| 31 | + |
| 32 | +/** |
| 33 | + * @test |
| 34 | + * @bug 8024926 8040279 |
| 35 | + * @requires (os.family == "mac") |
| 36 | + * @summary [macosx] AquaIcon HiDPI support |
| 37 | + * @library /java/awt/regtesthelpers |
| 38 | + * @build PassFailJFrame |
| 39 | + * @run main/manual bug8024926 |
| 40 | + */ |
| 41 | +public class bug8024926 { |
| 42 | + |
| 43 | + private static final String INSTRUCTIONS = """ |
| 44 | + Verify that high resolution system icons are used |
| 45 | + in JOptionPane on HiDPI displays. |
| 46 | + 1) Run the test on Retina display or enable the Quartz Debug |
| 47 | + and select the screen resolution with (HiDPI) label. |
| 48 | + "2) Check that the error icon on the JOptionPane is smooth. |
| 49 | + "If so, press PASS, else press FAIL."""; |
| 50 | + |
| 51 | + public static void main(String[] args) throws Exception { |
| 52 | + PassFailJFrame.builder() |
| 53 | + .title("AquaIcon HIDPI Instructions") |
| 54 | + .instructions(INSTRUCTIONS) |
| 55 | + .rows(10) |
| 56 | + .columns(35) |
| 57 | + .testUI(bug8024926::createTestUI) |
| 58 | + .build() |
| 59 | + .awaitAndCheck(); |
| 60 | + } |
| 61 | + |
| 62 | + private static JDialog createTestUI() { |
| 63 | + JOptionPane optionPane = new JOptionPane("High resolution icon test"); |
| 64 | + optionPane.setMessage("Icons should have high resolutions"); |
| 65 | + optionPane.setMessageType(JOptionPane.ERROR_MESSAGE); |
| 66 | + JDialog dialog = new JDialog(); |
| 67 | + dialog.setContentPane(optionPane); |
| 68 | + dialog.pack(); |
| 69 | + return dialog; |
| 70 | + } |
| 71 | +} |
0 commit comments