test/jdk/sun/java2d/pisces/Test7036754.java
changeset 47919 66350f079368
parent 47918 a82c9f231737
parent 47880 bbd692ad4fa3
child 47920 52c9e8d2f8d9
child 48093 2cb07c3778e1
equal deleted inserted replaced
47918:a82c9f231737 47919:66350f079368
     1 /*
       
     2  * Copyright (c) 2011, 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 /**
       
    25  * @test
       
    26  * @bug     7036754
       
    27  *
       
    28  * @summary Verifies that there are no non-finite numbers when stroking
       
    29  *          certain quadratic curves.
       
    30  *
       
    31  * @author Jim Graham
       
    32  * @run     main Test7036754
       
    33  */
       
    34 
       
    35 import java.awt.*;
       
    36 import java.awt.geom.*;
       
    37 
       
    38 public class Test7036754 {
       
    39     public static void main(String argv[]) {
       
    40         Shape s = new QuadCurve2D.Float(839.24677f, 508.97888f,
       
    41                                         839.2953f, 508.97122f,
       
    42                                         839.3438f, 508.96353f);
       
    43         s = new BasicStroke(10f).createStrokedShape(s);
       
    44         float nsegs[] = {2, 2, 4, 6, 0};
       
    45         float coords[] = new float[6];
       
    46         PathIterator pi = s.getPathIterator(null);
       
    47         while (!pi.isDone()) {
       
    48             int type = pi.currentSegment(coords);
       
    49             for (int i = 0; i < nsegs[type]; i++) {
       
    50                 float c = coords[i];
       
    51                 if (Float.isNaN(c) || Float.isInfinite(c)) {
       
    52                     throw new RuntimeException("bad value in stroke");
       
    53                 }
       
    54             }
       
    55             pi.next();
       
    56         }
       
    57     }
       
    58 }