* FYI: new GapContent.insertString test
@ 2006-03-29 15:27 Robert Schuster
0 siblings, 0 replies; only message in thread
From: Robert Schuster @ 2006-03-29 15:27 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1.1: Type: text/plain, Size: 455 bytes --]
Hi,
the attached patch contains a new test which checks for the wrong behavior which
caused PR 26888. Additionally I made another part of that class more robust
agains unexpected exceptions.
The ChangeLog:
2006-03-29 Robert Schuster <robertschuster@fsfe.org>
* gnu/testlet/javax/swing/text/GapContent/insertString.java:
(testGeneral): Let test fail when unexpected exception occurs.
(testSpecialInsert): New test.
cya
Robert
[-- Attachment #1.2: mauve-gapcontent-insert.diff --]
[-- Type: text/x-patch, Size: 2026 bytes --]
Index: gnu/testlet/javax/swing/text/GapContent/insertString.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/text/GapContent/insertString.java,v
retrieving revision 1.4
diff -u -r1.4 insertString.java
--- gnu/testlet/javax/swing/text/GapContent/insertString.java 2 Feb 2006 10:45:51 -0000 1.4
+++ gnu/testlet/javax/swing/text/GapContent/insertString.java 29 Mar 2006 15:22:14 -0000
@@ -2,6 +2,7 @@
// Copyright (C) 2005 Roman Kennke <kennke@aicas.com>
// Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2006 Robert Schuster <robertschuster@fsfe.org>
// This file is part of Mauve.
@@ -27,6 +28,7 @@
import javax.swing.text.BadLocationException;
import javax.swing.text.GapContent;
+import javax.swing.text.Position;
/**
* Tests if GapContent.insertString works correctly.
@@ -67,6 +69,8 @@
testBigInsert(harness);
testComplexInsert(harness);
testGeneral(harness);
+
+ testSpecialInsert(harness);
}
/**
@@ -202,6 +206,11 @@
{
pass = true;
}
+ catch (Exception _)
+ {
+ pass = false;
+ }
+
harness.check(pass);
// insert at index of last character - this is OK
@@ -268,4 +277,32 @@
harness.check(pass);
}
+ public void testSpecialInsert(TestHarness harness)
+ {
+ harness.checkPoint("specialInsert");
+ int posValue = -1;
+
+ try
+ {
+ GapContent gc = new GapContent();
+ gc.insertString(0, "foo\nbar\n");
+ gc.remove(0, 4);
+
+ // Gap starts at 0 now and the following Position
+ // instance is created at the end of the gap.
+ Position pos = gc.createPosition(0);
+
+ // This insertion should not move the offset
+ // of the Position object.
+ gc.insertString(0, "z");
+
+ posValue = pos.getOffset();
+ }
+ catch(BadLocationException ble)
+ {
+ }
+ harness.check(posValue, 0);
+ }
+
+
}
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-03-29 15:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-29 15:27 FYI: new GapContent.insertString test Robert Schuster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).