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: addition to DefaultStyledDocument test


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
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);
+      }
   }
 }

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