/* * Copyright 2010 Red Hat, Inc. 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. */ import java.awt.*; import java.awt.image.*; import static java.awt.RenderingHints.*; /* * @test * @bug 6976265 * @summary This test check if STROKE_CONTROL is supported. * @run main Test6976265 * @author Denis Lila , Pavel Tisnovsky */ // TODO: this test uses lines. That's good for now, but it should really use // Path2Ds as Shapes. That's because lines could be treated as special cases, // and the code we want to test (in the rendering engine) might not even run. // So we must use shapes that are as general as possible. public class Test6976265 extends RenderingEngineTest { public void run() { Object[] tmp = getGraphics(400, 400); BufferedImage bi = (BufferedImage) tmp[0]; Graphics2D g2 = (Graphics2D) tmp[1]; g2.setRenderingHint(KEY_STROKE_CONTROL, VALUE_STROKE_NORMALIZE); g2.setRenderingHint(KEY_ANTIALIASING, VALUE_ANTIALIAS_ON); g2.drawLine(10, 10, 10, 100); // test if rendering is correct if (! new Color(bi.getRGB(10, 10)).equals(Color.black)) { throw new RuntimeException("StrokeControlTest test failed."); } } public static void main(String[] args) { new Test6976265().run(); } }