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.Dimension;
24 import java.awt.Graphics;
25 import java.awt.Graphics2D;
26 import java.awt.Image;
27 import java.awt.image.BufferedImage;
28 import javax.swing.JCheckBox;
29 import javax.swing.JComponent;
30 import javax.swing.SwingUtilities;
31 import jdk.testlibrary.OSInfo;
32
33 /* @test
34 * @bug 8032667
35 * @summary [macosx] Components cannot be rendered in HiDPI to BufferedImage
36 * @library ../../../../lib/testlibrary
37 * @build jdk.testlibrary.OSInfo
38 * @run main bug8032667_image_diff
39 */
40 public class bug8032667_image_diff {
41
42 static final int IMAGE_WIDTH = 130;
43 static final int IMAGE_HEIGHT = 50;
44
45 public static void main(String[] args) throws Exception {
46
47 if(!OSInfo.OSType.MACOSX.equals(OSInfo.getOSType())){
48 return;
49 }
50
51 SwingUtilities.invokeAndWait(new Runnable() {
52 @Override
53 public void run() {
54
55 JCheckBox checkBox = new JCheckBox();
56 checkBox.setSelected(true);
57 checkBox.setSize(new Dimension(IMAGE_WIDTH, IMAGE_HEIGHT));
58
59 final BufferedImage image1 = getHiDPIImage(checkBox);
60 final BufferedImage image2 = getScaledImage(checkBox);
61
62 if(equal(image1, image2)){
63 throw new RuntimeException("2x image equals to non smooth image");
64 }
65 }
66 });
67 }
|
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.Dimension;
24 import java.awt.Graphics;
25 import java.awt.Graphics2D;
26 import java.awt.Image;
27 import java.awt.image.BufferedImage;
28 import javax.swing.JCheckBox;
29 import javax.swing.JComponent;
30 import javax.swing.SwingUtilities;
31
32 import jdk.test.lib.Platform;
33
34 /* @test
35 * @bug 8032667
36 * @summary [macosx] Components cannot be rendered in HiDPI to BufferedImage
37 * @library /test/lib
38 * @build jdk.test.lib.Platform
39 * @run main bug8032667_image_diff
40 */
41 public class bug8032667_image_diff {
42
43 static final int IMAGE_WIDTH = 130;
44 static final int IMAGE_HEIGHT = 50;
45
46 public static void main(String[] args) throws Exception {
47
48 if (!Platform.isOSX()) {
49 return;
50 }
51
52 SwingUtilities.invokeAndWait(new Runnable() {
53 @Override
54 public void run() {
55
56 JCheckBox checkBox = new JCheckBox();
57 checkBox.setSelected(true);
58 checkBox.setSize(new Dimension(IMAGE_WIDTH, IMAGE_HEIGHT));
59
60 final BufferedImage image1 = getHiDPIImage(checkBox);
61 final BufferedImage image2 = getScaledImage(checkBox);
62
63 if(equal(image1, image2)){
64 throw new RuntimeException("2x image equals to non smooth image");
65 }
66 }
67 });
68 }
|