Search in sources :

Example 1 with DocumentBuilderEvents

use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents in project mylyn.docs by eclipse.

the class DocumentBuilderEventsTest method testToString.

@Test
public void testToString() {
    BeginDocumentEvent event = new BeginDocumentEvent();
    DocumentBuilderEvents events = new DocumentBuilderEvents(Lists.<DocumentBuilderEvent>newArrayList(event));
    assertNotNull(events.toString());
    assertTrue(events.toString().contains(event.toString()));
}
Also used : DocumentBuilderEvents(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents) BeginDocumentEvent(org.eclipse.mylyn.wikitext.parser.builder.event.BeginDocumentEvent) Test(org.junit.Test)

Example 2 with DocumentBuilderEvents

use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents in project mylyn.docs by eclipse.

the class DocumentBuilderEventsTest method createsWithProvidedEvents.

@Test
public void createsWithProvidedEvents() {
    BeginDocumentEvent event = new BeginDocumentEvent();
    List<DocumentBuilderEvent> allEvents = Lists.<DocumentBuilderEvent>newArrayList(event);
    DocumentBuilderEvents events = new DocumentBuilderEvents(allEvents);
    assertEquals(allEvents, events.getEvents());
}
Also used : DocumentBuilderEvent(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent) DocumentBuilderEvents(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents) BeginDocumentEvent(org.eclipse.mylyn.wikitext.parser.builder.event.BeginDocumentEvent) Test(org.junit.Test)

Example 3 with DocumentBuilderEvents

use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents in project mylyn.docs by eclipse.

the class DocumentBuilderEventsTest method getEventsImmutable.

@Test
public void getEventsImmutable() {
    DocumentBuilderEvents events = new DocumentBuilderEvents(Lists.<DocumentBuilderEvent>newArrayList());
    thrown.expect(UnsupportedOperationException.class);
    events.getEvents().clear();
}
Also used : DocumentBuilderEvents(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents) Test(org.junit.Test)

Example 4 with DocumentBuilderEvents

use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents in project mylyn.docs by eclipse.

the class ConfluenceLanguageIntegrationTest method parseToEvents.

private DocumentBuilderEvents parseToEvents(String markup) {
    EventDocumentBuilder eventBuilder = new EventDocumentBuilder();
    MarkupParser parser = new MarkupParser(new ConfluenceLanguage(), eventBuilder);
    parser.parse(markup);
    DocumentBuilderEvents events = eventBuilder.getDocumentBuilderEvents();
    return events;
}
Also used : DocumentBuilderEvents(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents) EventDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder) MarkupParser(org.eclipse.mylyn.wikitext.parser.MarkupParser)

Example 5 with DocumentBuilderEvents

use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents in project mylyn.docs by eclipse.

the class CompositeSpanStrategyTest method test.

@Test
public void test() {
    CompositeSpanStrategy strategy = new CompositeSpanStrategy(Lists.<SpanStrategy>newArrayList(new SubstitutionWithoutCssSpanStrategy(SpanType.BOLD), new SubstitutionWithoutCssSpanStrategy(SpanType.ITALIC)));
    EventDocumentBuilder builder = new EventDocumentBuilder();
    strategy.beginSpan(builder, SpanType.DELETED, new Attributes());
    strategy.endSpan(builder);
    DocumentBuilderEvents events = builder.getDocumentBuilderEvents();
    assertEquals(ImmutableList.of(new BeginSpanEvent(SpanType.BOLD, new Attributes()), new BeginSpanEvent(SpanType.ITALIC, new Attributes()), new EndSpanEvent(), new EndSpanEvent()), events.getEvents());
}
Also used : DocumentBuilderEvents(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents) EventDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder) CompositeSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.CompositeSpanStrategy) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) BeginSpanEvent(org.eclipse.mylyn.wikitext.parser.builder.event.BeginSpanEvent) EndSpanEvent(org.eclipse.mylyn.wikitext.parser.builder.event.EndSpanEvent) SubstitutionWithoutCssSpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy) Test(org.junit.Test)

Aggregations

DocumentBuilderEvents (org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvents)6 Test (org.junit.Test)5 EventDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder)2 BeginDocumentEvent (org.eclipse.mylyn.wikitext.parser.builder.event.BeginDocumentEvent)2 CompositeSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.CompositeSpanStrategy)1 SubstitutionWithoutCssSpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionWithoutCssSpanStrategy)1 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)1 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)1 BeginSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.BeginSpanEvent)1 DocumentBuilderEvent (org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent)1 EndSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.EndSpanEvent)1