This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
Re: FYI: TestLogicalFontMetrics
On Thu, 2006-03-16 at 15:55 -0500, Thomas Fitzsimmons wrote:
> Hi,
>
> I committed this new test to Mauve.
I adjusted the tolerance so that it is larger for larger fonts. Now all
tests should pass against GNU Classpath CVS HEAD.
Tom
2006-03-16 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/testlet/java/awt/FontMetrics/TestLogicalFontMetrics.java:
Make tolerance larger for larger font sizes.
Index: gnu/testlet/java/awt/FontMetrics/TestLogicalFontMetrics.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/FontMetrics/TestLogicalFontMetrics.java,v
retrieving revision 1.2
diff -u -r1.2 TestLogicalFontMetrics.java
--- gnu/testlet/java/awt/FontMetrics/TestLogicalFontMetrics.java 16 Mar 2006 20:53:36 -0000 1.2
+++ gnu/testlet/java/awt/FontMetrics/TestLogicalFontMetrics.java 16 Mar 2006 22:08:08 -0000
@@ -40,8 +40,6 @@
final int NUM_SIZES = 40;
final int NUM_STYLES = 4;
- final int TOLERANCE = 2;
-
// Set this to true to create ascents.txt, descents.txt and
// leading.txt for the five logical fonts in the four possible
// styles, in sizes 0 through NUM_SIZES - 1.
@@ -58,6 +56,14 @@
int index = 0;
+ public int getTolerance (int size)
+ {
+ if (size < 19)
+ return 2;
+ else
+ return 5;
+ }
+
public void test (TestHarness h)
{
Frame f = new Frame ();
@@ -1821,12 +1827,12 @@
f.getLeading() + ", ");
int ascent = f.getAscent();
- if (ascent < ascents[index] - TOLERANCE || ascent > ascents[index] + TOLERANCE)
+ if (ascent < ascents[index] - getTolerance(size) || ascent > ascents[index] + getTolerance(size))
harness.fail ("ascent: " + name + " " + style + " " + size
+ " expected: " + ascents[index] + " got: " + ascent);
int descent = f.getDescent();
- if (descent < descents[index] - TOLERANCE || descent > descents[index] + TOLERANCE)
+ if (descent < descents[index] - getTolerance(size) || descent > descents[index] + getTolerance(size))
harness.fail ("descent: " + name + " " + style + " " + size
+ " expected: " + descents[index] + " got: " + descent);