use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder 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());
}
use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder 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());
}
use of org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder in project mylyn.docs by eclipse.
the class FontElementStrategyTest method spanStrategyBuildsNonHtml.
@Test
public void spanStrategyBuildsNonHtml() {
EventDocumentBuilder builder = new EventDocumentBuilder();
SpanStrategy spanStrategy = strategy.spanStrategy();
spanStrategy.beginSpan(builder, SpanType.SPAN, new Attributes(null, null, "color: red", null));
builder.characters("test");
spanStrategy.endSpan(builder);
assertEquals(Arrays.asList(new BeginSpanEvent(SpanType.SPAN, new Attributes(null, null, "color: red", null)), new CharactersEvent("test"), new EndSpanEvent()), builder.getDocumentBuilderEvents().getEvents());
}
Aggregations