Hey,
This patch fixes two bugs in java.awt.font.TextHitInfo. The first one
is in the equals(TextHitInfo) method. If TextHitInfo == null, then
false is returned. The second fix was in the beforeOffset method. The
first parameter of the new TextHitInfo should be decreased by 1.
These changes now cause a couple of failing Harmony's tests to pass. I
have also committed mauve tests.
Cheers,
Tania
2006-11-24 Tania Bento <[EMAIL PROTECTED]>
* java/awt/font/TextHitInfo.java
(equals(TextHitInfo)): If TextHitInfo parameter is null, return
false.
(beforeOffset): Decreased first parameter by 1.
Index: java/awt/font/TextHitInfo.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/font/TextHitInfo.java,v
retrieving revision 1.6
diff -u -r1.6 TextHitInfo.java
--- java/awt/font/TextHitInfo.java 2 Jul 2005 20:32:29 -0000 1.6
+++ java/awt/font/TextHitInfo.java 24 Nov 2006 21:26:30 -0000
@@ -81,6 +81,9 @@
public boolean equals(TextHitInfo hitInfo)
{
+ if (hitInfo == null)
+ return false;
+
return (charIndex == hitInfo.getCharIndex ())
&& (leadingEdge == hitInfo.isLeadingEdge ());
}
@@ -97,7 +100,7 @@
public static TextHitInfo beforeOffset(int offset)
{
- return new TextHitInfo (offset, false);
+ return new TextHitInfo ((offset - 1), false);
}
public static TextHitInfo afterOffset(int offset)