public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: addition to DefaultStyledDocument test
@ 2005-12-21 22:14 Anthony Balkissoon
  0 siblings, 0 replies; only message in thread
From: Anthony Balkissoon @ 2005-12-21 22:14 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 364 bytes --]

This addition to this test helped me track down a problem in classpath.

2005-12-20  Anthony Balkissoon  <abalkiss@redhat.com>

	*
gnu/testlet/javax/swing/text/DefaultStyledDocument/ElementBuffer/ElementStructure3.java: Added another check to this test and also added a 
	harness.debug statement for an exception we're throwing now that we 
	shouldn't be.

--Tony

[-- Attachment #2: ElementBufferStructure3Addition2.diff --]
[-- Type: text/x-patch, Size: 2038 bytes --]

Index: gnu/testlet/javax/swing/text/DefaultStyledDocument/ElementBuffer/ElementStructure3.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/text/DefaultStyledDocument/ElementBuffer/ElementStructure3.java,v
retrieving revision 1.2
diff -u -r1.2 ElementStructure3.java
--- gnu/testlet/javax/swing/text/DefaultStyledDocument/ElementBuffer/ElementStructure3.java     21 Dec 2005 21:29:36 -0000      1.2
+++ gnu/testlet/javax/swing/text/DefaultStyledDocument/ElementBuffer/ElementStructure3.java     21 Dec 2005 22:10:48 -0000
@@ -51,8 +51,8 @@
     Segment txt = new Segment();
     try
       {
-        getText(ev.getOffset(), ev.getLength(), txt);
+        getText(ev.getOffset(), ev.getLength() + 1, txt);
       }
     catch (BadLocationException ble)
       {
       }

-    for (int i = txt.offset; i < txt.offset + txt.count; i ++)
+    int i = txt.offset;
+    for (; i < txt.offset + txt.count - 1; i ++)
       {
         if (txt.array[i] == '\n')
           newLines ++;
       }
     h2.check (newLines == 1);
+    h2.check (txt.array[i] == '\n');
     super.insertUpdate(ev, attr);
   }

@@ -112,12 +114,19 @@
    */
   public void test(TestHarness harness)
   {
-    h2 = harness;
-    JTextPane tp = new JTextPane();
-    tp.setDocument(new ElementStructure3());
-    tp.setText("Questions are <font size=\"+1\" color=\"blue\">a " +
-               "burden</font> to others,\n" +
-               "answers <font size=\"+2\" color=\"red\">a " +
-               "prison</font> for oneself.");
+    try
+      {
+        h2 = harness;
+        JTextPane tp = new JTextPane();
+        tp.setDocument(new ElementStructure3());
+        tp.setText("Questions are <font size=\"+1\" color=\"blue\">a " +
+                   "burden</font> to others,\n" +
+                   "answers <font size=\"+2\" color=\"red\">a " +
+                   "prison</font> for oneself.");
+      }
+    catch (Throwable t)
+      {
+        harness.debug(t);
+      }
   }
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-21 22:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-21 22:14 FYI: addition to DefaultStyledDocument test Anthony Balkissoon

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).