Package org.jamesii.gui.syntaxeditor

Examples of org.jamesii.gui.syntaxeditor.ReaderCharSequence


  public final void testReaderCharSequence() {
    // check 1000 random strings
    for (int i = 0; i < 1000; i++) {
      String s =
          Strings.generateRandomString(generator.nextInt(10000), generator);
      ReaderCharSequence rcs;
      try (StringReader reader = new StringReader(s)) {
        rcs = new ReaderCharSequence(reader);
      }

      assertTrue(s.contentEquals(rcs));
    }
  }
View Full Code Here


      Document doc = new PlainDocument();
      try {
        doc.remove(0, doc.getLength());
        doc.insertString(0, testString, null);
        DocumentReader reader = new DocumentReader(doc);
        ReaderCharSequence rcs = new ReaderCharSequence(reader);
        reader.close();

        assertTrue(testString.contentEquals(rcs));

        reader = new DocumentReader(doc);
View Full Code Here

      };
      try {
        doc.remove(0, doc.getLength());
        doc.insertString(0, testString, null);
        ReaderCharSequence rcs;
        try (DocumentReader reader = new DocumentReader(doc)) {
          for (int i = 0; i < 10; i++) {
            int r = (generator.nextInt(doc.getLength()));
            int l = (generator.nextInt(doc.getLength() - r));
            if (i % 2 == 0) {
              doc.remove(r, l);
            } else {
              String s =
                  Strings.generateRandomString(generator.nextInt(100),
                      generator);
              doc.insertString(r, s, null);
            }
          }
          rcs = new ReaderCharSequence(reader);
        }

        // the document reader should ignore changes made to document and still
        // return original testString
        assertTrue(
View Full Code Here

              generator);
      Document doc = new PlainDocument();
      try {
        doc.remove(0, doc.getLength());
        doc.insertString(0, testString, null);
        ReaderCharSequence rcs;
        try (DocumentReader reader = new DocumentReader(doc)) {
          for (int i = 0; i < 10; i++) {
            int r = generator.nextInt(doc.getLength());
            int l = generator.nextInt((doc.getLength() - r));
            if (i % 2 == 0) {
              doc.remove(r, l);
            } else {
              String s =
                  Strings.generateRandomString(generator.nextInt(100),
                      generator);
              doc.insertString(r, s, null);
            }
          }
          rcs = new ReaderCharSequence(reader);
        }

        // the document reader should ignore changes made to document and still
        // return original testString
        assertTrue(testString.contentEquals(rcs));
View Full Code Here

TOP

Related Classes of org.jamesii.gui.syntaxeditor.ReaderCharSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.