Examples of DOMOutputBuffer


Examples of com.volantis.mcs.protocols.DOMOutputBuffer

     * be appended to the image URL.
     */
    public void testDoImageNoSuffix() throws ProtocolException {

        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
       
        ImageAttributes attrs = new ImageAttributes();
        attrs.setStyles(StylesBuilder.getInitialValueStyles());

        attrs.setSrc("http://www.images.com/test/image.jpg");
        protocol.doImage(buffer,attrs);

        Element root = buffer.getCurrentElement();
        Element el = (Element) root.getHead();
        assertNotNull("Image element should exist.", el );
        assertEquals("Image element should exist", "img", el.getName());
        assertEquals("Incorrect src attribute",
                "http://www.images.com/test/image.jpg", el.getAttributeValue("src"));
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

    }

    public void testDoImageSuffix() throws ProtocolException {

        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
       
        ImageAttributes attrs = new ImageAttributes();
        attrs.setStyles(StylesBuilder.getInitialValueStyles());

        attrs.setSrc("http://www.images.com/test/image.jpg");
        attrs.setAssetURLSuffix("?name=fred");
        protocol.doImage(buffer,attrs);

        Element root = buffer.getCurrentElement();
        Element el = (Element) root.getHead();
        assertNotNull("Image element should exist.", el );
        assertEquals("Image element should exist", "img", el.getName());
        assertEquals("Incorrect src attribute",
                "http://www.images.com/test/image.jpg?name=fred",
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

     * @throws ProtocolException
     */
    public void testImageValid() throws ProtocolException {
        // Set up the protocol and dependent objects.
        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
       
        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        attributes.setLocalSrc(true);
        attributes.setSrc("myImage.jpg");
        attributes.setAltText("Alternate Text");

        protocol.doImage(buffer, attributes);
       
        // valid src and alt generates <img src="url" alt="text" />
        Element root = buffer.getCurrentElement();
        Element element = (Element) root.getHead();

        DOMAssertionUtilities.assertElement("img", element);
        DOMAssertionUtilities.assertAttributeEquals("localsrc","myImage.jpg",element);
        DOMAssertionUtilities.assertAttributeEquals("alt","Alternate Text",element);
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

     * @throws ProtocolException
     */
    public void testImageNoSrc() throws ProtocolException {
        // Set up the protocol and dependent objects.
        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
       
        String expected = "Alternate Text";
       
        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setLocalSrc(true);
        attributes.setSrc(null);
        attributes.setAltText(expected);

        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

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

     * @throws ProtocolException
     */
    public void testImageNoSrcNoAlt() throws ProtocolException {
        // Set up the protocol and dependent objects.
        privateSetUp();
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
       
        // Initialise our protocol attributes with an id attribute.
        ImageAttributes attributes = new ImageAttributes();
        attributes.setLocalSrc(true);
        attributes.setSrc(null);
        attributes.setAltText("    ");

        protocol.doImage(buffer, attributes);
       
        // No src and whitespace text generates no output
        Element root = buffer.getCurrentElement();
        Element empty = (Element) root.getHead();
        assertNull("No output should be generated", empty);
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

    /**
     * Test the italic markup
     * @throws Exception
     */
    public void testItalic() throws Exception {
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        protocol.openItalic(buffer, new ItalicAttributes());

        buffer.appendEncoded("Test");
        protocol.closeItalic(buffer, new ItalicAttributes());
        String expected = "<i>Test</i>";
        assertEquals("Protocol string should match", expected,
                        bufferToString(buffer));

View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

    /**
     * Test the bold markup
     * @throws Exception
     */
    public void testBold() throws Exception {
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        protocol.openBold(buffer, new BoldAttributes());

        buffer.appendEncoded("Test");
        protocol.closeBold(buffer, new BoldAttributes());
        String expected = "<b>Test</b>";
        assertEquals("Protocol string should match", expected,
                        bufferToString(buffer));

View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

    /**
     * Test the big markup
     * @throws Exception
     */
    public void testBig() throws Exception {
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        protocol.openBig(buffer, new BigAttributes());

        buffer.appendEncoded("Test");
        protocol.closeBig(buffer, new BigAttributes());
        String expected = "<big>Test</big>";
        assertEquals("Protocol string should match", expected,
                        bufferToString(buffer));

View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

    /**
     * Test the small markup
     * @throws Exception
     */
    public void testSmall() throws Exception {
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        protocol.openSmall(buffer, new SmallAttributes());

        buffer.appendEncoded("Test");
        protocol.closeSmall(buffer, new SmallAttributes());
        String expected = "<small>Test</small>";
        assertEquals("Protocol string should match", expected,
                        bufferToString(buffer));

View Full Code Here

Examples of com.volantis.mcs.protocols.DOMOutputBuffer

     */
    public void testOpenPaneCellspacing() throws Exception {
        privateSetUp();
        context.setDevice(INTERNAL_DEVICE_FACTORY.createInternalDevice(
            new DefaultDevice(DEVICE_NAME, new HashMap(), null)));
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        PaneAttributes paneAttrs = new PaneAttributes();
        paneAttrs.setStyles(StylesBuilder.getDeprecatedStyles());
//        paneAttrs.setBorderWidth("5");
        paneAttrs.setPane(pane);

        protocol.openPane(buffer, paneAttrs);

        buffer.closeElement("td");
        buffer.closeElement("tr");
        Element table = buffer.closeElement("table");
        checkTableAttributes(table);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.