use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent 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());
}
use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent in project mylyn.docs by eclipse.
the class SubstitutionWithoutCssSpanStrategyTest method test.
@Test
public void test() {
SubstitutionWithoutCssSpanStrategy strategy = new SubstitutionWithoutCssSpanStrategy(SpanType.BOLD);
EventDocumentBuilder builder = new EventDocumentBuilder();
strategy.beginSpan(builder, SpanType.ITALIC, new Attributes("1", "class", "style", "lang"));
List<DocumentBuilderEvent> events = builder.getDocumentBuilderEvents().getEvents();
assertEquals(ImmutableList.of(new BeginSpanEvent(SpanType.BOLD, new Attributes("1", "class", null, "lang"))), events);
}
use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent in project mylyn.docs by eclipse.
the class SourceBlocksTest method process.
@Test
public void process() {
EventDocumentBuilder builder = new EventDocumentBuilder();
sourceBlocks.process(ProcessingContext.builder().build(), builder, LineSequence.create("one\nb2\nmore\n\nb1 and\n\n\nb2"));
ImmutableList<DocumentBuilderEvent> expectedEvents = //
ImmutableList.of(//
new BeginBlockEvent(BlockType.PARAGRAPH, new Attributes()), //
new CharactersEvent("b2"), //
new CharactersEvent("more"), //
new EndBlockEvent(), //
new BeginBlockEvent(BlockType.QUOTE, new Attributes()), //
new CharactersEvent("b1 and"), //
new EndBlockEvent(), //
new BeginBlockEvent(BlockType.PARAGRAPH, new Attributes()), //
new CharactersEvent("b2"), new EndBlockEvent());
assertEquals(Joiner.on("\n").join(builder.getDocumentBuilderEvents().getEvents()), expectedEvents, builder.getDocumentBuilderEvents().getEvents());
}
use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent in project mylyn.docs by eclipse.
the class CommonMarkLanguageTest method assertEvents.
private void assertEvents(String content, boolean asDocument, DocumentBuilderEvent... events) {
MarkupParser parser = new MarkupParser(language);
EventDocumentBuilder builder = new EventDocumentBuilder();
parser.setBuilder(builder);
parser.parse(content, asDocument);
List<DocumentBuilderEvent> expectedEvents = Arrays.asList(events);
List<DocumentBuilderEvent> actualEvents = builder.getDocumentBuilderEvents().getEvents();
assertEquals(format("Expected {0} but got {1}", toMessage(expectedEvents), toMessage(actualEvents)), expectedEvents, actualEvents);
}
use of org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent in project mylyn.docs by eclipse.
the class EventDocumentBuilderTest method assertEvents.
private void assertEvents(DocumentBuilderEvent... events) {
List<DocumentBuilderEvent> expectedEvents = Arrays.asList(events);
assertEquals(expectedEvents, builder.getDocumentBuilderEvents().getEvents());
EventDocumentBuilder builder2 = new EventDocumentBuilder();
for (DocumentBuilderEvent event : events) {
event.invoke(builder2);
}
assertEquals(expectedEvents, builder2.getDocumentBuilderEvents().getEvents());
}
Aggregations