--- /dev/null 2015-04-13 15:04:05.000000000 +0400 +++ new/test/java/awt/Graphics2D/ScaledTransform/ScaledTransform.java 2015-04-13 15:04:05.000000000 +0400 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2015, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +import java.awt.Dialog; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Window; +import java.awt.geom.AffineTransform; +import sun.java2d.SunGraphics2D; + +/* + * @test + * @bug 8069361 + * @summary SunGraphics2D.getDefaultTransform() does not include scale factor + * @author Alexander Scherbatiy + * @run main ScaledTransform + */ +public class ScaledTransform { + + private static volatile boolean passed = false; + + public static void main(String[] args) { + + final Dialog dialog = new Dialog((Window) null); + + try { + dialog.setSize(100, 100); + dialog.setModal(true); + Panel panel = new Panel() { + + @Override + public void paint(Graphics g) { + if (g instanceof SunGraphics2D) { + SunGraphics2D g2d = (SunGraphics2D) g; + int scale = g2d.surfaceData.getDefaultScale(); + AffineTransform transform = g2d.getTransform(); + passed = transform.getScaleX() == scale + && transform.getScaleY() == scale; + } else { + passed = true; + } + dialog.setVisible(false); + } + }; + dialog.add(panel); + dialog.setVisible(true); + + if (!passed) { + throw new RuntimeException("Transform is not scaled!"); + } + + } finally { + dialog.dispose(); + } + } +} \ No newline at end of file