Package com.volantis.mcs.protocols.menu.shared.model

Examples of com.volantis.mcs.protocols.menu.shared.model.ConcreteElementDetails


        // Not checking for null as this protocol explicitly supports menu
        // rendering - so a null here would be a test failure anyway.

        // Set styles to force Openwave
        ConcreteElementDetails elementDetails = new ConcreteElementDetails();

        elementDetails.setStyles(StylesBuilder.getCompleteStyles(
                "mcs-menu-link-style: numeric-shortcut"));

        // Create a test menu
        ConcreteMenu testMenu = new ConcreteMenu(elementDetails);

        // Test renderer returned
        MenuRenderer renderer = selector.selectMenuRenderer(testMenu);

        // Check the renderer exists.  JavaDoc on MenuRendererSelector
        // says it may not be null.
        assertNotNull("Should be a renderer here (1)", renderer);

        // Check appropriate renderer returned
        assertTrue("Wrong renderer returned (1)",
                   renderer instanceof OpenwaveMenuRenderer);

        // Set styles to force WML
        elementDetails = new ConcreteElementDetails();
        elementDetails.setStyles(StylesBuilder.getCompleteStyles(
                "mcs-menu-link-style: default"));

        // Create a test menu
        testMenu = new ConcreteMenu(elementDetails);
View Full Code Here


     * @throws Exception
     */
    public void testRollover() throws Exception {

        // 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");
View Full Code Here

    private void testLinkRendering(
            final TestSpanMenuItemRendererPair spanMenuItemRenderer)
            throws Exception {

        // Create the menu item to test.
        final ConcreteElementDetails elementDetails =
                createTestElementDetails();
        final ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setShortcut(new LiteralTextAssetReference("the shortcut"));
View Full Code Here

        checkRender(false);
    }

    private void checkRender(boolean withStyle) throws Exception {

        ConcreteElementDetails elementDetails;
        if (withStyle) {
            elementDetails = new ConcreteElementDetails();
            elementDetails.setElementName("the tag name");
            elementDetails.setStyles(StylesBuilder.getEmptyStyles());
        } else {
            elementDetails = null;
        }

        String content = "test menu item";
View Full Code Here

     * Convenience method to avoid code duplication in tests which extend
     * this abstract test class.
     * @return a fully populated ElementDetails instance for use in tests
     */
    public static ConcreteElementDetails createTestElementDetails(){
        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setId("the id");
        elementDetails.setStyles(StylesBuilder.getInitialValueStyles());
        elementDetails.setElementName("the tag name");
        return elementDetails;
    }
View Full Code Here

     * @throws Exception
     */
    public void testInner() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setShortcut(new LiteralTextAssetReference("the shortcut"));
        item.setTitle("the title");
View Full Code Here

     * @throws Exception
     */
    public void testOuter() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
       
        // Create the renderer we are to test.
View Full Code Here

     * @throws Exception
     */
    public void testEmulation() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setElementName("the tag name");
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
       
        // Create the renderer we are to test.
View Full Code Here

     */
    public void testSegments() throws Exception {
        final String elementTagName = "the tag name";

        // Create the menu item for the test
        ConcreteElementDetails elementDetails = new ConcreteElementDetails();
        elementDetails.setElementName(elementTagName);
        elementDetails.setStyles(StylesBuilder.getEmptyStyles());
        ConcreteMenuItem item = new ConcreteMenuItem(
                elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("the href"));
        item.setSegment("anotherframe");

View Full Code Here

     * @throws Exception if there was a problem rendering the menu item
     */
    public void testMCSAttributesAnnotatedWithStyles() throws Exception {

        // Create the menu item to test.
        ConcreteElementDetails elementDetails = createTestElementDetails();
        ConcreteMenuItem item =
                new ConcreteMenuItem(elementDetails, new MenuLabelStub());
        item.setHref(new LiteralLinkAssetReference("http://www.bbc.co.uk"));

        // Create the renderer we are to test.
        DefaultAnchorMenuItemRenderer renderer =
                new DefaultAnchorMenuItemRenderer(
                        new TestDeprecatedAnchorOutput(), true, null);

        // Render.
        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();

        renderer.open(buffer, item);

        AnchorAttributes attributes = (AnchorAttributes)PrivateAccessor.
                getField(renderer, "attributes");
        assertNotNull("MCS Attributes should not be null", attributes);
        Styles styles = attributes.getStyles();

        assertNotNull("The Styles on the MCS Attributes must not be null",
                styles);
        assertEquals("The styles on the MCS Attributes must be the same " +
                "as the styles on the ElementDetails",
                elementDetails.getStyles(), styles);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.menu.shared.model.ConcreteElementDetails

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.