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] |
This was probably sent to the wrong list. cya Robert
--- Begin Message ---
- From: Anthony Balkissoon <abalkiss at redhat dot com>
- To: classpath-patches at gnu dot org
- Date: Wed, 11 Jan 2006 17:11:28 -0500
- Subject: Re: [cp-patches] FYI: Another DefaultStyledDocument ElementBuffer fix
- References: <1137011940.4018.14.camel@localhost.localdomain>
On Wed, 2006-01-11 at 15:39 -0500, Anthony Balkissoon wrote: > These changes to DefaultStyledDocument make all the local tests I have > here pass. I will commit these tests to Mauve now. I'm having trouble committing to Mauve (I don't think I registered a public key from my home computer) so I'll commit these tomorrow. But I'll attach them here in case anyone wants to take a look. --Tony// Tags: JDK1.2 // Copyright (C) 2005 Red Hat. // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // Mauve is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Mauve; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301 USA. package gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import gnu.testlet.TestHarness; import gnu.testlet.Testlet; public class StyledDocument1 extends DefaultStyledDocument implements Testlet { // A variable to keep track of the number of times text has been inserted static int numInserts = 0; static TestHarness h2; // Creates a new StyledDocument1 using an ElementBuffer2 as the buffer public StyledDocument1() { super(); buffer = new ElementBuffer2(createDefaultRoot()); } // A class to be the buffer of the styled document that also prints out some // debugging info and checks that internal structure is correct public class ElementBuffer2 extends ElementBuffer { public ElementBuffer2(Element root) { super(root); } protected void insertUpdate(ElementSpec[] data) { numInserts ++; if (numInserts == 1) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 10); h2.check (data[1].getType() == ElementSpec.EndTagType); h2.check (data[1].getDirection() == ElementSpec.OriginateDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.StartTagType); h2.check (data[2].getDirection() == ElementSpec.JoinFractureDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 0); h2.check (data[3].getType() == ElementSpec.ContentType); h2.check (data[3].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[3].getOffset() == 0); h2.check (data[3].getLength() == 9); } else if (numInserts == 2) { h2.check (data[0].getType() == ElementSpec.EndTagType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 0); h2.check (data[1].getType() == ElementSpec.StartTagType); h2.check (data[1].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.ContentType); h2.check (data[2].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 1); } super.insertUpdate(data); } } public void test(TestHarness harness) { h2 = harness; StyledDocument doc = new StyledDocument1(); try { doc.insertString(0, "aaaaaaaaa\nbbbbbbbbb", null); doc.insertString(10, "N", null); } catch (BadLocationException ex) { harness.debug(ex); } } }// Tags: JDK1.2 // Copyright (C) 2005 Red Hat. // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // Mauve is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Mauve; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301 USA. package gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import gnu.testlet.TestHarness; import gnu.testlet.Testlet; public class StyledDocument2 extends DefaultStyledDocument implements Testlet { // A variable to keep track of the number of times text has been inserted static int numInserts = 0; static TestHarness h2; // Creates a new StyledDocument2 using an ElementBuffer2 as the buffer public StyledDocument2() { super(); buffer = new ElementBuffer2(createDefaultRoot()); } protected void insertUpdate(DefaultDocumentEvent ev, AttributeSet attr) { super.insertUpdate(ev, attr); h2.check (getDefaultRootElement().getElement(0).getElementCount() == (numInserts + 1)); } // A class to be the buffer of the styled document that also prints out some // debugging info and checks that internal structure is correct public class ElementBuffer2 extends ElementBuffer { public ElementBuffer2(Element root) { super(root); } protected void insertUpdate(ElementSpec[] data) { numInserts ++; if (numInserts == 1) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 5); } else if (numInserts == 2) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 5); } super.insertUpdate(data); } } public void test(TestHarness harness) { h2 = harness; StyledDocument doc = new StyledDocument2(); SimpleAttributeSet atts = new SimpleAttributeSet(); try { atts.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE); doc.insertString(0, "bbbbb", atts); doc.insertString(5, "aaaaa", null); } catch (BadLocationException ex) { ex.printStackTrace(); } } }// Tags: JDK1.2 // Copyright (C) 2005 Red Hat. // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // Mauve is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Mauve; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301 USA. package gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import gnu.testlet.TestHarness; import gnu.testlet.Testlet; public class StyledDocument3 extends DefaultStyledDocument implements Testlet { // A variable to keep track of the number of times text has been inserted static int numInserts = 0; static TestHarness h2; // Creates a new StyledDocument3 using an ElementBuffer2 as the buffer public StyledDocument3() { super(); buffer = new ElementBuffer2(createDefaultRoot()); } // A class to be the buffer of the styled document that also prints out some // debugging info and checks that internal structure is correct public class ElementBuffer2 extends ElementBuffer { public ElementBuffer2(Element root) { super(root); } protected void insertUpdate(ElementSpec[] data) { numInserts ++; if (numInserts == 1) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 5); } else if (numInserts == 2) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 5); } else if (numInserts == 3) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 1); } else if (numInserts == 4) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 1); } super.insertUpdate(data); } } public void test(TestHarness harness) { h2 = harness; StyledDocument doc = new StyledDocument3(); SimpleAttributeSet atts = new SimpleAttributeSet(); try { atts.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE); doc.insertString(0, "bbbbb", atts); doc.insertString(5, "aaaaa", null); doc.insertString(5, "N", atts); atts.addAttribute(StyleConstants.Bold, Boolean.TRUE); doc.insertString(6, "M", atts); } catch (BadLocationException ex) { ex.printStackTrace(); } } }// Tags: JDK1.2 // Copyright (C) 2005 Red Hat. // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // Mauve is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Mauve; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301 USA. package gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import gnu.testlet.TestHarness; import gnu.testlet.Testlet; public class StyledDocument4 extends DefaultStyledDocument implements Testlet { // A variable to keep track of the number of times text has been inserted static int numInserts = 0; static TestHarness h2; // Creates a new StyledDocument4 using an ElementBuffer2 as the buffer public StyledDocument4() { super(); buffer = new ElementBuffer2(createDefaultRoot()); } // A class to be the buffer of the styled document that also prints out some // debugging info and checks that internal structure is correct public class ElementBuffer2 extends ElementBuffer { public ElementBuffer2(Element root) { super(root); } protected void insertUpdate(ElementSpec[] data) { numInserts ++; if (numInserts == 1) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 10); h2.check (data[1].getType() == ElementSpec.EndTagType); h2.check (data[1].getDirection() == ElementSpec.OriginateDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.StartTagType); h2.check (data[2].getDirection() == ElementSpec.JoinFractureDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 0); h2.check (data[3].getType() == ElementSpec.ContentType); h2.check (data[3].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[3].getOffset() == 0); h2.check (data[3].getLength() == 9); } else if (numInserts == 2) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 1); h2.check (data[1].getType() == ElementSpec.EndTagType); h2.check (data[1].getDirection() == ElementSpec.OriginateDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.StartTagType); h2.check (data[2].getDirection() == ElementSpec.JoinFractureDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 0); h2.check (data[3].getType() == ElementSpec.ContentType); h2.check (data[3].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[3].getOffset() == 0); h2.check (data[3].getLength() == 1); } super.insertUpdate(data); } } public void test(TestHarness harness) { h2 = harness; StyledDocument doc = new StyledDocument4(); try { doc.insertString(0, "aaaaaaaaa\nbbbbbbbbb", null); doc.insertString(5, "\nN", null); } catch (BadLocationException ex) { ex.printStackTrace(); } } }// Tags: JDK1.2 // Copyright (C) 2005 Red Hat. // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // Mauve is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Mauve; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301 USA. package gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import gnu.testlet.TestHarness; import gnu.testlet.Testlet; public class StyledDocument5 extends DefaultStyledDocument implements Testlet { // A variable to keep track of the number of times text has been inserted static int numInserts = 0; static TestHarness h2; // Creates a new StyledDocument5 using an ElementBuffer2 as the buffer public StyledDocument5() { super(); buffer = new ElementBuffer2(createDefaultRoot()); } // A class to be the buffer of the styled document that also prints out some // debugging info and checks that internal structure is correct public class ElementBuffer2 extends ElementBuffer { public ElementBuffer2(Element root) { super(root); } protected void insertUpdate(ElementSpec[] data) { numInserts ++; if (numInserts == 1) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 10); h2.check (data[1].getType() == ElementSpec.EndTagType); h2.check (data[1].getDirection() == ElementSpec.OriginateDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.StartTagType); h2.check (data[2].getDirection() == ElementSpec.JoinFractureDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 0); h2.check (data[3].getType() == ElementSpec.ContentType); h2.check (data[3].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[3].getOffset() == 0); h2.check (data[3].getLength() == 9); } else if (numInserts == 2) { h2.check (data[0].getType() == ElementSpec.EndTagType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 0); h2.check (data[1].getType() == ElementSpec.StartTagType); h2.check (data[1].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.ContentType); h2.check (data[2].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 1); } else if (numInserts == 3) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 1); h2.check (data[1].getType() == ElementSpec.EndTagType); h2.check (data[1].getDirection() == ElementSpec.OriginateDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.StartTagType); h2.check (data[2].getDirection() == ElementSpec.JoinFractureDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 0); h2.check (data[3].getType() == ElementSpec.ContentType); h2.check (data[3].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[3].getOffset() == 0); h2.check (data[3].getLength() == 9); } super.insertUpdate(data); } } public void test(TestHarness harness) { h2 = harness; StyledDocument doc = new StyledDocument5(); try { doc.insertString(0, "aaaaaaaaa\nbbbbbbbbb", null); doc.insertString(10, "N", null); doc.insertString(5, "\nhellooooo", null); } catch (BadLocationException ex) { harness.debug(ex); } } }// Tags: JDK1.2 // Copyright (C) 2005 Red Hat. // This file is part of Mauve. // Mauve is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2, or (at your option) // any later version. // Mauve is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with Mauve; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301 USA. package gnu.testlet.javax.swing.text.DefaultStyledDocument.ElementBuffer; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.*; import gnu.testlet.TestHarness; import gnu.testlet.Testlet; public class StyledDocument6 extends DefaultStyledDocument implements Testlet { // A variable to keep track of the number of times text has been inserted static int numInserts = 0; static TestHarness h2; // Creates a new StyledDocument6 using an ElementBuffer2 as the buffer public StyledDocument6() { super(); buffer = new ElementBuffer2(createDefaultRoot()); } // A class to be the buffer of the styled document that also prints out some // debugging info and checks that internal structure is correct public class ElementBuffer2 extends ElementBuffer { public ElementBuffer2(Element root) { super(root); } protected void insertUpdate(ElementSpec[] data) { numInserts ++; if (numInserts == 1) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 3); } else if (numInserts == 2) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 3); } else if (numInserts == 3) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.OriginateDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 3); } else if (numInserts == 4) { h2.check (data[0].getType() == ElementSpec.ContentType); h2.check (data[0].getDirection() == ElementSpec.JoinPreviousDirection); h2.check (data[0].getOffset() == 0); h2.check (data[0].getLength() == 1); h2.check (data[1].getType() == ElementSpec.EndTagType); h2.check (data[1].getDirection() == ElementSpec.OriginateDirection); h2.check (data[1].getOffset() == 0); h2.check (data[1].getLength() == 0); h2.check (data[2].getType() == ElementSpec.StartTagType); h2.check (data[2].getDirection() == ElementSpec.JoinFractureDirection); h2.check (data[2].getOffset() == 0); h2.check (data[2].getLength() == 0); h2.check (data[3].getType() == ElementSpec.ContentType); h2.check (data[3].getDirection() == ElementSpec.JoinNextDirection); h2.check (data[3].getOffset() == 0); h2.check (data[3].getLength() == 1); } super.insertUpdate(data); } } public void test(TestHarness harness) { h2 = harness; StyledDocument doc = new StyledDocument6(); SimpleAttributeSet atts = new SimpleAttributeSet(); try { doc.insertString(0, "aaa", null); atts.addAttribute(StyleConstants.Underline, Boolean.TRUE); doc.insertString(3, "bbb", atts); atts.removeAttributes(atts); atts.addAttribute(StyleConstants.StrikeThrough, Boolean.TRUE); doc.insertString(6, "ccc", atts); atts.removeAttributes(atts); atts.addAttribute(StyleConstants.Underline, Boolean.TRUE); doc.insertString(5, "\nB", atts); } catch (BadLocationException ex) { ex.printStackTrace(); } } }_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
--- End Message ---
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] |