Search in sources :

Example 1 with CharactersEvent

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

the class CharactersEventTest method equals.

@Test
public void equals() {
    assertEquality(new CharactersEvent("test it"), new CharactersEvent("test it"));
    assertInequality(new CharactersEvent("test it"), new CharactersEvent("test it again"));
}
Also used : CharactersEvent(org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent) Test(org.junit.Test)

Example 2 with CharactersEvent

use of org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent 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());
}
Also used : DocumentBuilderEvent(org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent) CharactersEvent(org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent) EventDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder) EndBlockEvent(org.eclipse.mylyn.wikitext.parser.builder.event.EndBlockEvent) BeginBlockEvent(org.eclipse.mylyn.wikitext.parser.builder.event.BeginBlockEvent) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) Test(org.junit.Test)

Example 3 with CharactersEvent

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

the class EventDocumentBuilderTest method characters.

@Test
public void characters() {
    builder.characters("test 123");
    assertEvents(new CharactersEvent("test 123"));
}
Also used : CharactersEvent(org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent) Test(org.junit.Test)

Example 4 with CharactersEvent

use of org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent 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());
}
Also used : SpanStrategy(org.eclipse.mylyn.wikitext.html.internal.SpanStrategy) CharactersEvent(org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent) EventDocumentBuilder(org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder) 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) Test(org.junit.Test)

Example 5 with CharactersEvent

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

the class MultiplexingDocumentBuilderTest method characters.

@Test
public void characters() {
    multiplexer.characters("test 123");
    assertEvents(new CharactersEvent("test 123"));
}
Also used : CharactersEvent(org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent) Test(org.junit.Test)

Aggregations

CharactersEvent (org.eclipse.mylyn.wikitext.parser.builder.event.CharactersEvent)5 Test (org.junit.Test)5 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)2 EventDocumentBuilder (org.eclipse.mylyn.wikitext.parser.builder.EventDocumentBuilder)2 SpanStrategy (org.eclipse.mylyn.wikitext.html.internal.SpanStrategy)1 BeginBlockEvent (org.eclipse.mylyn.wikitext.parser.builder.event.BeginBlockEvent)1 BeginSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.BeginSpanEvent)1 DocumentBuilderEvent (org.eclipse.mylyn.wikitext.parser.builder.event.DocumentBuilderEvent)1 EndBlockEvent (org.eclipse.mylyn.wikitext.parser.builder.event.EndBlockEvent)1 EndSpanEvent (org.eclipse.mylyn.wikitext.parser.builder.event.EndSpanEvent)1