Path: blob/master/test/jdk/sun/java2d/marlin/Test7036754.java
41149 views
/*1* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 703675426*27* @summary Verifies that there are no non-finite numbers when stroking28* certain quadratic curves.29*30* @author Jim Graham31* @run main Test703675432*/3334import java.awt.*;35import java.awt.geom.*;3637public class Test7036754 {38public static void main(String argv[]) {39Shape s = new QuadCurve2D.Float(839.24677f, 508.97888f,40839.2953f, 508.97122f,41839.3438f, 508.96353f);42s = new BasicStroke(10f).createStrokedShape(s);43float nsegs[] = {2, 2, 4, 6, 0};44float coords[] = new float[6];45PathIterator pi = s.getPathIterator(null);46while (!pi.isDone()) {47int type = pi.currentSegment(coords);48for (int i = 0; i < nsegs[type]; i++) {49float c = coords[i];50if (Float.isNaN(c) || Float.isInfinite(c)) {51throw new RuntimeException("bad value in stroke");52}53}54pi.next();55}56}57}585960