Search in sources :

Example 1 with DocumentData

use of org.terasology.rendering.nui.widgets.browser.data.DocumentData in project Terasology by MovingBlocks.

the class HTMLParserTest method testParseSimpleParagraph.

@Test
public void testParseSimpleParagraph() throws IOException, SAXException, ParserConfigurationException {
    DocumentData documentData = htmlParser.parseHTMLDocument("<body><p>Text</p></body>");
    assertEquals(1, documentData.getParagraphs().size());
    ParagraphData paragraph = documentData.getParagraphs().iterator().next();
    assertTrue(paragraph instanceof FlowParagraphData);
}
Also used : DocumentData(org.terasology.rendering.nui.widgets.browser.data.DocumentData) FlowParagraphData(org.terasology.rendering.nui.widgets.browser.data.basic.FlowParagraphData) ParagraphData(org.terasology.rendering.nui.widgets.browser.data.ParagraphData) FlowParagraphData(org.terasology.rendering.nui.widgets.browser.data.basic.FlowParagraphData) Test(org.junit.Test)

Example 2 with DocumentData

use of org.terasology.rendering.nui.widgets.browser.data.DocumentData in project Terasology by MovingBlocks.

the class HTMLParserTest method testParseTwoParagraphs.

@Test
public void testParseTwoParagraphs() throws IOException, SAXException, ParserConfigurationException {
    DocumentData documentData = htmlParser.parseHTMLDocument("<body><p>Text</p><p>Second</p></body>");
    assertEquals(2, documentData.getParagraphs().size());
}
Also used : DocumentData(org.terasology.rendering.nui.widgets.browser.data.DocumentData) Test(org.junit.Test)

Example 3 with DocumentData

use of org.terasology.rendering.nui.widgets.browser.data.DocumentData in project Terasology by MovingBlocks.

the class HTMLParserTest method testParseEmptyDocument.

@Test
public void testParseEmptyDocument() throws IOException, SAXException, ParserConfigurationException {
    DocumentData documentData = htmlParser.parseHTMLDocument("<body></body>");
    assertEquals(0, documentData.getParagraphs().size());
}
Also used : DocumentData(org.terasology.rendering.nui.widgets.browser.data.DocumentData) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 DocumentData (org.terasology.rendering.nui.widgets.browser.data.DocumentData)3 ParagraphData (org.terasology.rendering.nui.widgets.browser.data.ParagraphData)1 FlowParagraphData (org.terasology.rendering.nui.widgets.browser.data.basic.FlowParagraphData)1