/hg/icedtea6: Added two JTreg tests for checking TextLayout clas...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon Apr 29 04:31:17 PDT 2013
changeset 11353b3c2109 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=11353b3c2109
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Apr 29 13:27:32 2013 +0200
Added two JTreg tests for checking TextLayout class behaviour.
diffstat:
ChangeLog | 8 ++++
Makefile.am | 4 +-
patches/textLayoutGetCharacterCount.patch | 54 +++++++++++++++++++++++++++++++
patches/textLayoutLimits.patch | 49 ++++++++++++++++++++++++++++
4 files changed, 114 insertions(+), 1 deletions(-)
diffs (140 lines):
diff -r 485b2d3dfd09 -r 11353b3c2109 ChangeLog
--- a/ChangeLog Fri Apr 26 15:39:35 2013 +0100
+++ b/ChangeLog Mon Apr 29 13:27:32 2013 +0200
@@ -1,3 +1,11 @@
+2013-04-29 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * Makefile.am:
+ (ICEDTEA_PATCHES): Add two new patches.
+ * patches/textLayoutGetCharacterCount.patch:
+ * patches/textLayoutLimits.patch:
+ Two JTreg tests for checking TextLayout class behaviour.
+
2013-04-26 Andrew John Hughes <gnu.andrew at redhat.com>
* Makefile.am:
diff -r 485b2d3dfd09 -r 11353b3c2109 Makefile.am
--- a/Makefile.am Fri Apr 26 15:39:35 2013 +0100
+++ b/Makefile.am Mon Apr 29 13:27:32 2013 +0200
@@ -544,7 +544,9 @@
patches/openjdk/6500343-bad_code_from_conditionals.patch \
patches/jaxws-tempfiles-ioutils-6.patch \
patches/object-factory-cl-internal.patch \
- patches/openjdk/8009530-icu_kern_table_support_broken.patch
+ patches/openjdk/8009530-icu_kern_table_support_broken.patch \
+ patches/textLayoutGetCharacterCount.patch \
+ patches/textLayoutLimits.patch
if WITH_ALT_HSBUILD
ICEDTEA_PATCHES += \
diff -r 485b2d3dfd09 -r 11353b3c2109 patches/textLayoutGetCharacterCount.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/textLayoutGetCharacterCount.patch Mon Apr 29 13:27:32 2013 +0200
@@ -0,0 +1,54 @@
+--- ./openjdk-old/jdk/test/java/awt/font/TextLayout/TextLayoutGetCharacterCount.java 2013-04-26 11:51:19.000000000 +0200
++++ ./openjdk/jdk/test/java/awt/font/TextLayout/TextLayoutGetCharacterCount.java 2013-04-26 11:51:19.000000000 +0200
+@@ -0,0 +1,51 @@
++/*
++ * Copyright 2013 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.Font;
++import java.awt.font.TextLayout;
++import java.awt.font.FontRenderContext;
++
++/**
++ * @test
++ * @run main TextLayoutGetCharacterCount
++ * @author Pavel Tisnovsky
++ *
++ * Test if TextLayout's method getCharacterCount() works properly.
++ */
++public class TextLayoutGetCharacterCount {
++ public static void main(String []args) {
++ Font font = new Font("Times New Roman", Font.BOLD, 10);
++ check(font, ".");
++ check(font, " ");
++ check(font, " ");
++ check(font, "JAVA");
++ check(font, " JAVA ");
++ }
++
++ public static void check(Font font, String string) {
++ TextLayout tl = new TextLayout(string, font, new FontRenderContext(null, false, false));
++ int characterCount = tl.getCharacterCount();
++ int expected = string.length();
++
++ if (characterCount != expected) {
++ throw new RuntimeException("getCharacterCount() returns " + characterCount + " instead of " + expected);
++ }
++ }
++}
++
diff -r 485b2d3dfd09 -r 11353b3c2109 patches/textLayoutLimits.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/textLayoutLimits.patch Mon Apr 29 13:27:32 2013 +0200
@@ -0,0 +1,49 @@
+--- ./openjdk-old/jdk/test/java/awt/font/TextLayout/TextLayoutLimits.java 2013-04-26 11:51:19.000000000 +0200
++++ ./openjdk/jdk/test/java/awt/font/TextLayout/TextLayoutLimits.java 2013-04-26 11:51:19.000000000 +0200
+@@ -0,0 +1,46 @@
++/*
++ * Copyright 2013 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.Font;
++import java.awt.font.TextLayout;
++import java.awt.font.FontRenderContext;
++
++/**
++ * @test
++ * @run main TextLayoutLimits
++ * @author Pavel Tisnovsky
++ *
++ * Test if TextLayout's method getBounds() works properly.
++ */
++public class TextLayoutLimits {
++ public static void main(String []args) {
++ Font font = new Font("Times New Roman", Font.BOLD, 10);
++ TextLayout tl = new TextLayout("JAVA", font, new FontRenderContext(null, false, false));
++
++ int width = (int) tl.getBounds().getWidth();
++ int height = (int) tl.getBounds().getHeight();
++ if (width <= 0) {
++ throw new RuntimeException("Width " + width + " is <=0");
++ }
++ if (height <= 0) {
++ throw new RuntimeException("Height " + height + " is <=0");
++ }
++ }
++}
++
More information about the distro-pkg-dev
mailing list