This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: javax.swing.text.GapContent.remove - added test


Hi,
I added another case to the testclass above which demonstrates a problem in
Classpath' GapContent implementation.

2006-02-20  Robert Schuster  <robertschuster@fsfe.org>

        * gnu/testlet/javax/swing/text/GapContent/remove.java:
        (testGeneral): Added test.

cya
Robert
Index: gnu/testlet/javax/swing/text/GapContent/remove.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/text/GapContent/remove.java,v
retrieving revision 1.1
diff -u -r1.1 remove.java
--- gnu/testlet/javax/swing/text/GapContent/remove.java	24 Jan 2006 16:31:34 -0000	1.1
+++ gnu/testlet/javax/swing/text/GapContent/remove.java	20 Feb 2006 01:09:10 -0000
@@ -29,6 +29,7 @@
 
 import javax.swing.text.BadLocationException;
 import javax.swing.text.GapContent;
+import javax.swing.text.Position;
 
 public class remove implements Testlet
 {
@@ -113,6 +114,32 @@
     harness.check(pass);
     harness.check(gc.length(), 8);
     
+
+    int offset = 0;
+    try
+    {
+      gc = new GapContent();
+      gc.insertString(0, "abc\ndef\n");
+
+      // create position on the 'd'.
+      Position pos = gc.createPosition(4);
+
+      // remove the 'd'
+      gc.remove(4, 1);
+
+      offset = pos.getOffset();
+    }
+    catch(BadLocationException ble)
+    {
+      // If that happens something is pretty odd
+      offset = -1;
+    }
+    finally
+    {
+      // offset of our position should *NOT* have changed
+      harness.check(offset, 4);
+    }
+
   }
   
   /**
@@ -139,4 +166,4 @@
     harness.check(pass);
   }
 
-}
\ No newline at end of file
+}

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]