Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.Text


        while (actualNode instanceof Element) {
            lastNodeClass = actualNode.getClass();
            actualNode = ((Element)actualNode).getHead();
        }
        assertNotNull("Node not a Text: " + lastNodeClass, actualNode);
        Text text = (Text)actualNode;
        assertEquals(expectedText,
                     new String(text.getContents(), 0, text.getLength()));
        return text;
    }
View Full Code Here


        return "application/smil";
    }

    // javadoc inherited
    protected void checkResultForPre(final DOMOutputBuffer buffer) {
        final Text text = (Text) buffer.getRoot().getHead();
        assertEquals("     before          child     text          after     ",
            new String(text.getContents(), 0, text.getLength()));
    }
View Full Code Here

        protocol.doImage(buffer, attributes);

        // No src with alt text generates text as there is currently no support
        // for <span> in HDML.
        Element root = buffer.getCurrentElement();
        Text altText = (Text) root.getHead();

        String txtAltText = new String(altText.getContents(),
                                       0, expected.length());
        assertEquals("Incorrect Text", expected, txtAltText);
    }
View Full Code Here

    protected void checkRenderAltText(String altText, DOMOutputBuffer buffer) {
        // We changed the default for (X)HTML to render a logical SPAN to
        // avoid adding whitespace around the text. I believe SPAN might be
        // better as the default, but this would be a larger change.
        Element root = buffer.getCurrentElement();
        Text text = (Text) root.getHead();
        checkTextEquals(altText, text);
    }
View Full Code Here

                "</testRoot>";
    }

    // javadoc inherited
    protected void checkResultForPre(final DOMOutputBuffer buffer) {
        final Text text = (Text) buffer.getRoot().getHead();
        assertEquals("     before          child     text          after     ",
            new String(text.getContents(), 0, text.getLength()));
    }
View Full Code Here

    // Inherit Javadoc.
    void checkAppendToResult(Node node) {
        // Ensure we have created separate DOM elements for our XML content
        // rather than just a single text node "blob".
        Element e = DOMAssertionUtilities.assertElement("tag", node);
        Text t = DOMAssertionUtilities.assertText("content", e.getHead());
        e = DOMAssertionUtilities.assertElement("empty",t.getNext());
        t = DOMAssertionUtilities.assertText("more content",e.getNext());
    }
View Full Code Here

        protocol.doImage(buffer, attributes);

        // No src with alt text generates <span>text</span>
        Element root = buffer.getCurrentElement();
        Text altText = (Text)root.getHead();
        String txtAltText = new String(altText.getContents(),
                0, expected.length());
        assertEquals("Incorrect Text", expected, txtAltText);
    }
View Full Code Here

        String testTextString = "test menu item";

        // Create the test DOM for the text buffer
        TestDOMOutputBuffer textBuffer = new TestDOMOutputBuffer();
        Element b = textBuffer.allocateElement("b");
        Text textElement = domFactory.createText();
        textElement.append(testTextString);
        b.addTail(textElement);
        textBuffer.addElement(b);

        // Create the test text, label, and then the menu item
        MenuText text = entity.createTestMenuText(textBuffer);
View Full Code Here

     * Complex method test.
     */
    public void testGetSiblingInstance() {
        Element element = domFactory.createElement();
        Element elementResult;
        Text text = domFactory.createText();
        Text textResult;
        String textMessage = "atishoo, atishoo, we all fall down";
        BasicMapperElement me = new BasicMapperElement("tr", element, false);
        BasicMapperElement mt = new BasicMapperElement("td", text, true);
        Node result;
        char[] textResultMessage;

        element.setName("br");
        text.append(textMessage);

        result = me.getSiblingInstance();

        assertTrue("result should be an element",
                   (result instanceof Element));

        elementResult = (Element)result;

        assertTrue("sibling returned should not be the one passed in",
                   (element != elementResult));

        assertEquals("sibling instance should have same name",
                     elementResult.getName(),
                     element.getName());

        result = mt.getSiblingInstance();

        assertTrue("result should be a text node",
                   (result instanceof Text));

        textResult = (Text)result;

        assertTrue("sibling returned should not be the one passed in",
                   (text != textResult));

        assertEquals("sibling instance should have same content",
                     textResult.getLength(),
                     text.getLength());

        textResultMessage = textResult.getContents();

        for (int i = 0;
             i < textMessage.length();
             i++) {
          assertEquals("content different at index " + i,
View Full Code Here

     * {@link Node} is an instance of
     * {@link Text} which contains only whitespace
     * characters.
     */
    public void testIsWhitespaceTextNode() throws Exception {
        Text text = domFactory.createText();
        text.append("some content");
        TransVisitor visitor = getProtocolSpecificFactory().getVisitor(protocol);
        boolean result = visitor.isWhitespaceTextNode(text);
        assertTrue("Node was not a whitespace only text node.", !result);
       
        Element element = domFactory.createElement();
        result = visitor.isWhitespaceTextNode(element);
        assertTrue("Node was not a whitespace only text node.", !result);
       
        Text whitespace = domFactory.createText();
        text.append("   ");
        result = visitor.isWhitespaceTextNode(whitespace);
        assertTrue("Node was a whitespace only text node.", result);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.