Search in sources :

Example 1 with BlockStrategies

use of org.eclipse.mylyn.wikitext.html.internal.BlockStrategies in project mylyn.docs by eclipse.

the class BlockStrategiesTest method createEmpty.

@Test
public void createEmpty() {
    BlockStrategies strategies = new BlockStrategies(Sets.<BlockType>newHashSet());
    assertUnsupported(strategies, BlockType.PARAGRAPH);
}
Also used : BlockStrategies(org.eclipse.mylyn.wikitext.html.internal.BlockStrategies) Test(org.junit.Test)

Example 2 with BlockStrategies

use of org.eclipse.mylyn.wikitext.html.internal.BlockStrategies in project mylyn.docs by eclipse.

the class BlockStrategiesTest method lists.

@Test
public void lists() {
    for (BlockType listType : new BlockType[] { BlockType.BULLETED_LIST, BlockType.NUMERIC_LIST }) {
        BlockStrategies strategies = new BlockStrategies(Sets.newHashSet(listType));
        assertSupported(strategies, listType);
        assertSupported(strategies, BlockType.LIST_ITEM);
    }
}
Also used : BlockType(org.eclipse.mylyn.wikitext.parser.DocumentBuilder.BlockType) BlockStrategies(org.eclipse.mylyn.wikitext.html.internal.BlockStrategies) Test(org.junit.Test)

Example 3 with BlockStrategies

use of org.eclipse.mylyn.wikitext.html.internal.BlockStrategies in project mylyn.docs by eclipse.

the class BlockStrategiesTest method assertFallback.

protected void assertFallback(BlockType supportedType, BlockType blockType) {
    BlockStrategies strategies = new BlockStrategies(Sets.newHashSet(supportedType));
    BlockStrategy strategy = strategies.getStrategy(blockType, new Attributes());
    assertNotNull(strategy);
    assertEquals(blockType.name(), SubstitutionBlockStrategy.class, strategy.getClass());
    assertEquals(blockType.name(), supportedType, ((SubstitutionBlockStrategy) strategy).getBlockType());
}
Also used : Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) BlockStrategies(org.eclipse.mylyn.wikitext.html.internal.BlockStrategies) UnsupportedBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.UnsupportedBlockStrategy) NoOpBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.NoOpBlockStrategy) BlockStrategy(org.eclipse.mylyn.wikitext.html.internal.BlockStrategy) SupportedBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SupportedBlockStrategy) SubstitutionBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy)

Example 4 with BlockStrategies

use of org.eclipse.mylyn.wikitext.html.internal.BlockStrategies in project mylyn.docs by eclipse.

the class BlockStrategiesTest method fallBackToUnsupported.

@Test
public void fallBackToUnsupported() {
    BlockStrategies strategies = new BlockStrategies(Sets.newHashSet(BlockType.PARAGRAPH));
    BlockStrategy strategy = strategies.getStrategy(BlockType.TABLE_ROW, new Attributes());
    assertNotNull(strategy);
    assertTrue(UnsupportedBlockStrategy.class.equals(strategy.getClass()));
}
Also used : UnsupportedBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.UnsupportedBlockStrategy) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) BlockStrategies(org.eclipse.mylyn.wikitext.html.internal.BlockStrategies) UnsupportedBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.UnsupportedBlockStrategy) NoOpBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.NoOpBlockStrategy) BlockStrategy(org.eclipse.mylyn.wikitext.html.internal.BlockStrategy) SupportedBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SupportedBlockStrategy) SubstitutionBlockStrategy(org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy) Test(org.junit.Test)

Example 5 with BlockStrategies

use of org.eclipse.mylyn.wikitext.html.internal.BlockStrategies in project mylyn.docs by eclipse.

the class BlockStrategiesTest method createNonEmpty.

@Test
public void createNonEmpty() {
    BlockStrategies strategies = new BlockStrategies(Sets.newHashSet(BlockType.PARAGRAPH, BlockType.CODE));
    assertSupported(strategies, BlockType.PARAGRAPH);
    assertSupported(strategies, BlockType.CODE);
    for (BlockType blockType : BlockType.values()) {
        assertNotNull(strategies.getStrategy(blockType, new Attributes()));
    }
}
Also used : BlockType(org.eclipse.mylyn.wikitext.parser.DocumentBuilder.BlockType) Attributes(org.eclipse.mylyn.wikitext.parser.Attributes) BlockStrategies(org.eclipse.mylyn.wikitext.html.internal.BlockStrategies) Test(org.junit.Test)

Aggregations

BlockStrategies (org.eclipse.mylyn.wikitext.html.internal.BlockStrategies)9 Test (org.junit.Test)8 Attributes (org.eclipse.mylyn.wikitext.parser.Attributes)5 SubstitutionBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.SubstitutionBlockStrategy)4 BlockStrategy (org.eclipse.mylyn.wikitext.html.internal.BlockStrategy)3 NoOpBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.NoOpBlockStrategy)3 SupportedBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.SupportedBlockStrategy)3 UnsupportedBlockStrategy (org.eclipse.mylyn.wikitext.html.internal.UnsupportedBlockStrategy)3 BlockType (org.eclipse.mylyn.wikitext.parser.DocumentBuilder.BlockType)3