Package com.volantis.mcs.dom2theme.impl.optimizer

Examples of com.volantis.mcs.dom2theme.impl.optimizer.ShorthandOptimizer



        outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        ShorthandOptimizer optimizer = new FontOptimizer(checker,
                shorthandsMock);

        // A pseudo class must set all the properties that are set so in this
        // case it should use the shorthand.
        checker.prepare(parentValues, TargetEntity.PSEUDO_CLASS);

        optimizer.optimize(TargetEntity.PSEUDO_CLASS, inputValues, outputValues,
                deviceValuesMock);

        assertEquals("font:medium FooBar", outputValues.getStandardCSS());
    }
View Full Code Here


        supportedShorthands.add(StyleShorthands.PADDING);

        final TestPropertyClearerChecker checker =
                new TestPropertyClearerChecker();

        ShorthandOptimizer allShorthands =
                new EdgeShorthandOptimizer(StyleShorthands.PADDING,
                        checker, supportedShorthands);

        ShorthandOptimizer noShorthands =
                new EdgeShorthandOptimizer(StyleShorthands.PADDING,
                        checker, new MutableShorthandSet());

        ShorthandRendererTestSuiteBuilder builder =
                new ShorthandRendererTestSuiteBuilder(
View Full Code Here

        TestPropertyClearerChecker checker = new TestPropertyClearerChecker();

        PropertiesNormalizer normalizer = new BorderNormalizer(ALL_PROPERTIES);

        ShorthandOptimizer allShorthandsOptimizer =
                new BorderOptimizer(checker, allShorthands);

        ShorthandOptimizer noShorthandOptimizer =
                new BorderOptimizer(checker, noShorthands);

        ShorthandRendererTestSuiteBuilder builder =
                new ShorthandRendererTestSuiteBuilder(normalizer,
                        new BorderRenderer(),
View Full Code Here

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

        ShorthandOptimizer optimizer = new HeterogeneousShorthandOptimizer(
                StyleShorthands.BACKGROUND, checkerMock,
                shorthandSetMock);

        setPropertyValue(inputValues,
                StylePropertyDetails.BACKGROUND_ATTACHMENT,
                OptimizerHelper.ANY,
                PropertyStatus.REQUIRED);

        setPropertyValue(inputValues,
                StylePropertyDetails.BACKGROUND_IMAGE,
                BackgroundImageKeywords.NONE,
                PropertyStatus.REQUIRED);

        MutableStyleProperties outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        optimizer.optimize(TargetEntity.ELEMENT, inputValues, outputValues,
                deviceValuesMock);

        assertEquals("background-attachment:scroll;background-image:none",
                outputValues.getStandardCSS());
    }
View Full Code Here

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

        ShorthandOptimizer optimizer = new HeterogeneousShorthandOptimizer(
                StyleShorthands.BACKGROUND, checkerMock,
                shorthandSetMock);

        setPropertyValue(inputValues,
                StylePropertyDetails.BACKGROUND_ATTACHMENT,
                BackgroundAttachmentKeywords.FIXED,
                PropertyStatus.CLEARABLE);

        setPropertyValue(inputValues,
                StylePropertyDetails.BACKGROUND_COLOR,
                StyleColorNames.RED,
                PropertyStatus.REQUIRED);

        MutableStyleProperties outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        optimizer.optimize(TargetEntity.ELEMENT, inputValues, outputValues,
                deviceValuesMock);

        assertEquals("background-color:red",
                outputValues.getStandardCSS());
    }
View Full Code Here


        MutableStyleProperties outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        ShorthandOptimizer optimizer = new FontOptimizer(checker,
                shorthandsMock);

        checker.prepare(rootStyleProperties, TargetEntity.ELEMENT);

        optimizer.optimize(TargetEntity.ELEMENT, inputValues, outputValues,
                deviceValuesMock);

        assertEquals("font:caption;font-size:medium",
                outputValues.getStandardCSS());
    }
View Full Code Here


        MutableStyleProperties outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        ShorthandOptimizer optimizer = new FontOptimizer(checker,
                shorthandsMock);

        checker.prepare(rootStyleProperties, TargetEntity.ELEMENT);

        optimizer.optimize(TargetEntity.ELEMENT, inputValues, outputValues,
                deviceValuesMock);

        assertEquals("font:medium/90% Foo", outputValues.getStandardCSS());
    }
View Full Code Here


        outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        ShorthandOptimizer optimizer = new FontOptimizer(checker,
                shorthandsMock);

        // When only the font-family property is needed for individual
        // properties then use that instead of the font shorthand.
        checker.prepare(parentValues, TargetEntity.ELEMENT);

        optimizer.optimize(TargetEntity.ELEMENT, inputValues, outputValues,
                deviceValuesMock);

        assertEquals("font-size:medium", outputValues.getStandardCSS());
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom2theme.impl.optimizer.ShorthandOptimizer

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.