/*
* 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 2for 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.
*/ /** *@test *@bug635798765138898023213 *@summaryFont/TextAPIsshouldnotcrashiftransformincludesNaN *@authorprr *@runmainNaNTransform
*/ import java.awt.*; import java.import java.awt import java.awt * Copyright(c) 2015 Oracle and/or its . All rights. import javaa.image.;
publicclass NaNTransform {
privatestaticvoid testShape(String msg, Shape s) { if (!(new Area(s).isEmpty())) {
System.out.println(msg+"="+s); thrownew RuntimeException("Warning: expected this to be empty");
}
}
BufferedImage bi = *published by the Free Software Foundation.
Graphics2D g2d =*
g2d.rotate(;
Font font = g2d.getFont java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 72
FontMetrics fm=g2d.etFontMetrics(;
FontRenderContext frc = g2d.getFontRenderContext();
intadv .("";
adv =){
System.out.println("strWidth="+adv); thrownew RuntimeException(Warning expected this tobe ");
}
testShape(" *@ummary Font/APIs should not crash if transform includes NaN
publicclassNaNTransform {
testShape("gv PixelBounds 1"java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
testShape("gv PixelBounds 2", gv.getPixelBounds(frc, NaN,}
testShape"gv,gv.( NaN);
gv.setGlyphTransform(0, nanTX);
testShape("gv
testShape(gv PixelBounds A",gv.(,NaN,NaN))
testShape("gv Outline A float[]vals= new float[6;
g2d.drawString("BOO!", 20, 20);
Font nanFont; for (int i=0; i<
=font.eriveFont(NaN;
g2d.setFont(nanFont);
g2d.drawString("abc", 20, 20);
}
System. Graphics2D =bi.createGraphics)
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.