Examples of DocOpBuffer


Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

    assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
  }

  public void testAnnotationNormalization4() {
    AnnotationsNormalizer<DocOp> normalizer =
        new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS1);
    normalizer.annotationBoundary(ANNOTATIONS2);
    normalizer.annotationBoundary(ANNOTATIONS3);
    normalizer.retain(1);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

    assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
  }

  public void testEmptyRetainNormalization() {
    AnnotationsNormalizer<DocOp> normalizer =
        new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS1);
    normalizer.annotationBoundary(ANNOTATIONS2);
    normalizer.retain(0);
    normalizer.annotationBoundary(ANNOTATIONS3);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

    assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
  }

  public void testEmptyCharactersNormalization() {
    AnnotationsNormalizer<DocOp> normalizer =
        new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS1);
    normalizer.annotationBoundary(ANNOTATIONS2);
    normalizer.characters("");
    normalizer.annotationBoundary(ANNOTATIONS3);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

    assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(expected, docOp));
  }

  public void testEmptyDeleteCharactersNormalization() {
    AnnotationsNormalizer<DocOp> normalizer =
        new AnnotationsNormalizer<DocOp>(new DocOpBuffer());
    normalizer.retain(1);
    normalizer.annotationBoundary(ANNOTATIONS1);
    normalizer.annotationBoundary(ANNOTATIONS2);
    normalizer.deleteCharacters("");
    normalizer.annotationBoundary(ANNOTATIONS3);
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

    target.modifyDocument(documentId, operation);
  }

  @Override
  public CoreWaveletOperation getInverse() {
    DocOpInverter<DocOp> inverse = new DocOpInverter<DocOp>(new DocOpBuffer());
    operation.apply(inverse);
    return new CoreWaveletDocumentOperation(documentId, inverse.finish());
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

  /** Check that passing to buildSubtree delegates correctly for elements and text. */
  public void testOperationFromSubtree() {
    Bundle data = new Bundle();

    // for element:
    DocOpBuffer cursorA = new DocOpBuffer(), cursorB = new DocOpBuffer();
    DomOperationUtil.buildDomInitializationFromSubtree(data.D, data.A, cursorA);
    DomOperationUtil.buildDomInitializationFromElement(data.D, data.A.asElement(), cursorB, true);

    checkCursors(cursorA, cursorB);

    // for text:
    cursorA = new DocOpBuffer();
    cursorB = new DocOpBuffer();
    DomOperationUtil.buildDomInitializationFromSubtree(data.D, data.T, cursorA);
    DomOperationUtil.buildDomInitializationFromTextNode(data.D, data.T.asText(), cursorB);

    checkCursors(cursorA, cursorB);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

        A, A.getDocumentElement()).checkWalk(B, B.getDocumentElement());
  }

  // converts the DOM to a string.
  private static String toSimpleString(ReadableDocument<ContentNode, ?, ?> doc) {
    DocOpBuffer opBuffer = new DocOpBuffer();
    DomOperationUtil.buildDomInitializationFromSubtree(doc, doc.getDocumentElement(), opBuffer);
    return DocOpUtil.toXmlString(DocOpUtil.asInitialization(opBuffer.finish()));
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

public class DomOperationUtilTest extends TestCase {
  /** Check that generating an op from a text node calls characters with the text's data. */
  public void testOperationFromText() {
    Bundle data = new Bundle();

    DocOpBuffer cursorA = new DocOpBuffer(), cursorB = new DocOpBuffer();
    DomOperationUtil.buildDomInitializationFromTextNode(data.D, data.T.asText(), cursorA);
    cursorB.characters("child");

    checkCursors(cursorA, cursorB);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

  }

  /** Check that generating an op from just an element calls element start & end. */
  public void testOperationFromElementNotRecursive() {
    Bundle data = new Bundle();
    DocOpBuffer cursorA = new DocOpBuffer(), cursorB = new DocOpBuffer();
    DomOperationUtil.buildDomInitializationFromElement(data.D, data.A.asElement(), cursorA, false);
    cursorB.elementStart("a", Attributes.EMPTY_MAP);
    cursorB.elementEnd();

    checkCursors(cursorA, cursorB);

    // do likewise with B
    cursorA = new DocOpBuffer();
    cursorB = new DocOpBuffer();
    DomOperationUtil.buildDomInitializationFromElement(data.D, data.B.asElement(), cursorA, false);
    cursorB.elementStart("b", new AttributesImpl(Collections.singletonMap("x", "y")));
    cursorB.elementEnd();

    checkCursors(cursorA, cursorB);
  }
View Full Code Here

Examples of org.waveprotocol.wave.model.document.operation.impl.DocOpBuffer

  }

  /** Check that generating an op from just an element calls element start & end. */
  public void testOperationFromElementRecursive() {
    Bundle data = new Bundle();
    DocOpBuffer cursorA = new DocOpBuffer(), cursorB = new DocOpBuffer();
    DomOperationUtil.buildDomInitializationFromElement(data.D, data.A.asElement(), cursorA, true);
    cursorB.elementStart("a", Attributes.EMPTY_MAP);
    cursorB.characters("child");
    cursorB.elementStart("b", new AttributesImpl(Collections.singletonMap("x", "y")));
    cursorB.elementEnd();
    cursorB.elementEnd();

    checkCursors(cursorA, cursorB);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.