Package com.volantis.mcs.protocols.assets.implementation

Examples of com.volantis.mcs.protocols.assets.implementation.TestNormalImageAssetReference


        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setElementName("the tag name");
        elementDetails.setStyles(StylesBuilder.getEmptyStyles());
        ConcreteMenuIcon icon = new ConcreteMenuIcon(elementDetails);
        ImageAssetReference normalRef =
                new TestNormalImageAssetReference("the normal url");
        ImageAssetReference overRef =
                new TestNormalImageAssetReference("the over url");
        icon.setNormalURL(normalRef);
        icon.setOverURL(overRef);
        ConcreteMenuItem item = new ConcreteMenuItem(
                new ElementDetailsStub(), new ConcreteMenuLabel(
                        new ElementDetailsStub(), createMenuText(), icon));

        // Create the renderer we are to test.
        MenuItemComponentRenderer renderer = createImageMenuItemRenderer(
                new TestDeprecatedImageOutput(), false);

        // Do a render.
        String actual = getRenderOutputAsString(renderer, item);
        //System.out.println(actual);

        // Assemble the expected value (rendered menu item).
        String expected =
                "<test-image " +
                        // Old code used to do this - but too bodgy for new code
                        // and no time to fix it properly..
                        // "border=\"0\" " +
                        "event-" + EventConstants.ON_MOUSE_OUT + "=" +
                            "\"this.src='" + normalRef.getURL() + "'\" " +
                        "event-" + EventConstants.ON_MOUSE_OVER + "=" +
                            "\"this.src='" + overRef.getURL() + "'\" " +
                        "src=\"" + normalRef.getURL() + "\" " +
                        "tag-name=\"the tag name\"" +
                    "/>";
        expected = DOMUtilities.provideDOMNormalizedString(expected);
        //System.out.println(expected);
View Full Code Here


        builder.startIcon();
        // this is required or we crash trying to extract the element name in
        // the renderer
        builder.setElementDetails("menu-icon", null,
                StylesBuilder.getInitialValueStyles());
        builder.setNormalImageURL(new TestNormalImageAssetReference(
                imageComponent));
        builder.endIcon();

        builder.endLabel();
View Full Code Here

        if (textToUse == null) {
            text.setText(ONE);
        } else {
            text.setText(textToUse);
        }
        ImageAssetReference reference = new TestNormalImageAssetReference(
                testIcon);
        icon.setNormalURL(reference);

        return new ConcreteMenuLabel(createElementDetails(), text, icon);
    }
View Full Code Here

        testIcon = label.getIcon();
        assertNotNull("Icon should not be null", testIcon);
        assertEquals("Icons should be the same", icon, testIcon);

        ImageAssetReference secondIconReference =
                new TestNormalImageAssetReference("another icon reference");
        ConcreteMenuIcon secondIcon = new ConcreteMenuIcon(elementDetails);
        secondIcon.setNormalURL(secondIconReference);

        ((ConcreteMenuLabel)label).setIcon(secondIcon);
        testIcon = label.getIcon();
View Full Code Here

     * Helper method used to populate a menu icon in the most minimal manner
     * such that it is valid.
     */
    protected void configureMinimalIcon() throws BuilderException {
        // The currently open icon must have a normal image URL
        ImageAssetReference reference = new TestNormalImageAssetReference(
                "dummy");
        builder.setNormalImageURL(reference);
    }
View Full Code Here

    public void testSetNormalImageURL() throws Exception {
        doBuildDataMethodTest(new BuildDataMethodTester() {
            /**
             * Sample data for use in testing
             */
            ImageAssetReference reference = new TestNormalImageAssetReference(
                    "url");
            // javadoc inherited
            public void invoke() throws Exception {
                builder.setNormalImageURL(reference);
            }
View Full Code Here

    public void testSetOverImageURL() throws Exception {
        doBuildDataMethodTest(new BuildDataMethodTester() {
            /**
             * Sample data for use in testing
             */
            ImageAssetReference reference = new TestNormalImageAssetReference(
                    "url");

            // javadoc inherited
            public void invoke() throws Exception {
                builder.setOverImageURL(reference);
View Full Code Here

        elementDetails.setElementName("the tag name");
        elementDetails.setId("the id");
        elementDetails.setStyles(StylesBuilder.getEmptyStyles());
        ConcreteMenuIcon icon = new ConcreteMenuIcon(elementDetails);
        ImageAssetReference imageRef =
                new TestNormalImageAssetReference("the normal url");
        icon.setNormalURL(imageRef);
        ConcreteMenuItem item = new ConcreteMenuItem(
                new ElementDetailsStub(), new ConcreteMenuLabel(
                        new ElementDetailsStub(), createMenuText(),
                        icon));

        // Create the renderer we are to test.
        MenuItemComponentRenderer renderer = createImageMenuItemRenderer(
                new TestDeprecatedImageOutput(), false);

        // Do a render.
        String actual = getRenderOutputAsString(renderer, item);
        //System.out.println(actual);

        // Assemble the expected value (rendered menu item).
        String expected =
                "<test-image " +
                        "src=\"" + imageRef.getURL() + "\" " +
                        "id=\"the id\"" + " " +
//                        "style-class=\"the style class\"" + " " +
                        "tag-name=\"the tag name\"" +
                    "/>";
        expected = DOMUtilities.provideDOMNormalizedString(expected);
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.assets.implementation.TestNormalImageAssetReference

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.