Package com.volantis.mcs.protocols.assets

Examples of com.volantis.mcs.protocols.assets.ImageAssetReference


        // Create the menu item to test.
        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


        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

        ((ConcreteMenuLabel)label).setIcon(icon);
        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);
View Full Code Here

     * supposed to be null it tests the exception state as well as get/set
     * combinations.
     */
    public void testGetNormalURL() {
        // String to use for the tests
        final ImageAssetReference testNormalURL =
                new LiteralImageAssetReference("normal");

        ImageAssetReference testString;

        ConcreteMenuIcon testInstance = createTestClass();

        // Test invalid state
        try {
View Full Code Here

     */
    public void testGetOverURL() {
        ConcreteMenuIcon testInstance = createTestClass();

        // Test null valued
        ImageAssetReference testString = testInstance.getOverURL();
        assertNull("The test string should be null", testString);

        // Test specific value
        final ImageAssetReferenceMock overURL =
                new ImageAssetReferenceMock("overURL",
View Full Code Here

    public void testSuccessfulRender() throws Exception {
        // Create test buffer locator
        DOMOutputBuffer buffer = new TestDOMOutputBuffer();

        // Create the test items
        ImageAssetReference reference =
                entity.createImageAssetReference("separator");

        // Create test renderer object
        DefaultImageMenuItemGroupSeparatorRenderer renderer =
                new DefaultImageMenuItemGroupSeparatorRenderer(
View Full Code Here

    public void testFailedRender() throws Exception {
        // Create test buffer locator
        DOMOutputBuffer buffer = new TestDOMOutputBuffer();

        // Create the test items
        ImageAssetReference reference =
                entity.createImageAssetReference(null);

        // Create test renderer object
        DefaultImageMenuItemGroupSeparatorRenderer renderer =
                new DefaultImageMenuItemGroupSeparatorRenderer(
View Full Code Here

    public void testGetOver() {
        // Create a test instance
        RolloverComponentReference test = createTestInstance(TEST_NAME);
        assertNotNull("Rollover reference should exist", test);

        ImageAssetReference ref = test.getOver();
        assertNotNull("Reference should exist", ref);
    }
View Full Code Here

    public void testGetNormal() {
        // Create a test instance
        RolloverComponentReference test = createTestInstance(TEST_NAME);
        assertNotNull("Rollover reference should exist", test);

        ImageAssetReference ref = test.getNormal();
        assertNotNull("Reference should exist", ref);
    }
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

TOP

Related Classes of com.volantis.mcs.protocols.assets.ImageAssetReference

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.