Examples of CountersFunction


Examples of com.volantis.styling.impl.functions.CountersFunction

    /**
     * Ensure that the counter function works with a counter with a single
     * value.
     */
    public void testSingleValueCounter() {
        StylingFunction function = new CountersFunction();

        // =====================================================================
        //   Set Expectations
        // =====================================================================

        evaluationContextMock.expects.getCounterValues("horse")
                .returns(new int[]{8});

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        List functionArgs = new ArrayList();
        functionArgs.add(getCounterIdentifier("horse"));
        functionArgs.add(STYLE_VALUE_FACTORY.getString(null, "."));
        functionArgs.add(ListStyleTypeKeywords.DECIMAL);
        StyleValue functionValue =
                function.evaluate(evaluationContextMock,
                        "counters", functionArgs);

        assertNotNull("Function should return a value", functionValue);
        assertTrue("Function should return a StyleString",
                functionValue instanceof StyleString);
View Full Code Here

Examples of com.volantis.styling.impl.functions.CountersFunction

    /**
     * Ensure that the counter function works with a counter with multiple
     * values.
     */
    public void testMultipleValueCounter() {
        StylingFunction function = new CountersFunction();

        // =====================================================================
        //   Set Expectations
        // ==========1===========================================================

        evaluationContextMock.expects.getCounterValues("cow")
                .returns(new int[]{1, 2, 3, 4, 5});

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        List functionArgs = new ArrayList();
        functionArgs.add(getCounterIdentifier("cow"));
        functionArgs.add(STYLE_VALUE_FACTORY.getString(null, "."));
        functionArgs.add(ListStyleTypeKeywords.DECIMAL);
        StyleValue functionValue =
                function.evaluate(evaluationContextMock,
                        "counters", functionArgs);

        assertNotNull("Function should return a value", functionValue);
        assertTrue("Function should return a StyleString",
                functionValue instanceof StyleString);
View Full Code Here

Examples of com.volantis.styling.impl.functions.CountersFunction

        // =====================================================================
        //   Test Expectations
        // =====================================================================

        StylingFunction function = new CountersFunction(formatterSelectorMock);

        List functionArgs = new ArrayList();
        functionArgs.add(getCounterIdentifier("hippopotamus"));
        functionArgs.add(STYLE_VALUE_FACTORY.getString(null, "."));
        functionArgs.add(ListStyleTypeKeywords.LOWER_ALPHA);

        StyleValue functionValue =
                function.evaluate(evaluationContextMock,
                        "counter", functionArgs);
        StyleString expected = STYLE_VALUE_FACTORY.getString(null, "0.A.B.C");
        assertEquals(expected, functionValue);
    }
View Full Code Here

Examples of com.volantis.styling.impl.functions.CountersFunction

        FunctionResolverBuilder builder =
                StylingFactory.getDefaultInstance().
                createFunctionResolverBuilder();
        builder.addFunction("attr", new AttrFunction());
        builder.addFunction("counter", new CounterFunction());
        builder.addFunction("counters", new CountersFunction());
        functionResolvers.add(builder.getResolver());
    }
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.