|
| 1 | +/* |
| 2 | + * Copyright (c) 2015, 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 | + |
| 24 | +import java.awt.BorderLayout; |
| 25 | +import java.awt.Color; |
| 26 | +import javax.swing.JFrame; |
| 27 | +import javax.swing.JPanel; |
| 28 | +import javax.swing.JSplitPane; |
| 29 | + |
| 30 | +/* |
| 31 | + * @test |
| 32 | + * @bug 8132123 |
| 33 | + * @summary MultiResolutionCachedImage unnecessarily creates base image |
| 34 | + * to get its size |
| 35 | + * @library /java/awt/regtesthelpers |
| 36 | + * @build PassFailJFrame |
| 37 | + * @run main/manual/othervm -Dsun.java2d.uiScale=2 bug8132123 |
| 38 | + */ |
| 39 | + |
| 40 | +public class bug8132123 { |
| 41 | + |
| 42 | + private static final String INSTRUCTIONS = """ |
| 43 | + Verify that JSplitPane uses high-resolution system icons for |
| 44 | + the one-touch expanding buttons on HiDPI displays. |
| 45 | +
|
| 46 | + If the display does not support HiDPI mode press PASS. |
| 47 | +
|
| 48 | + 1. Run the test on HiDPI Display. |
| 49 | + 2. Check that the one-touch expanding buttons on the JSplitPane are painted |
| 50 | + correctly. If so, press PASS, else press FAIL. """; |
| 51 | + |
| 52 | + public static void main(String[] args) throws Exception { |
| 53 | + PassFailJFrame.builder() |
| 54 | + .title("JSplitPane Instructions") |
| 55 | + .instructions(INSTRUCTIONS) |
| 56 | + .rows(10) |
| 57 | + .columns(40) |
| 58 | + .testUI(bug8132123::init) |
| 59 | + .build() |
| 60 | + .awaitAndCheck(); |
| 61 | + } |
| 62 | + |
| 63 | + public static JFrame init() { |
| 64 | + JFrame frame = new JFrame("Test SplitPane"); |
| 65 | + JPanel left = new JPanel(); |
| 66 | + left.setBackground(Color.GRAY); |
| 67 | + JPanel right = new JPanel(); |
| 68 | + right.setBackground(Color.GRAY); |
| 69 | + JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, |
| 70 | + left, right); |
| 71 | + splitPane.setOneTouchExpandable(true); |
| 72 | + frame.setLayout(new BorderLayout()); |
| 73 | + frame.setSize(250, 250); |
| 74 | + frame.getContentPane().add(splitPane); |
| 75 | + return frame; |
| 76 | + } |
| 77 | +} |
0 commit comments