Пример #1
0
        public void CanUseNode(bool canUseExprTree)
        {
            // ARRANGE
            var stylesheet = MapCssHelper.GetStylesheetFromContent("node[test] { z-index: 0.1}\n", canUseExprTree);

            // ACT
            var node = MapCssHelper.GetNode(new Dictionary <string, string>()
            {
                { "test", "yes" },
            }.ToTags());

            // ASSERT
            Assert.IsTrue(stylesheet.GetModelRule(node, MapConsts.MaxZoomLevel).IsApplicable);
        }
Пример #2
0
        public void CanUseGradient()
        {
            // ARRANGE
            const string gradientString = "gradient(#f4f4f4, yellow 10%, green 20%)";
            var          stylesheet     = MapCssHelper
                                          .GetStylesheetFromContent(String.Format("node[test] {{ facade: {0};}}\n", gradientString));

            // ACT
            var node = MapCssHelper.GetNode(new Dictionary <string, string>()
            {
                { "test", "yes" },
            }.ToTags());

            // ASSERT
            var rule           = stylesheet.GetModelRule(node, MapConsts.MaxZoomLevel);
            var facadeGradient = rule.Evaluate <string>("facade");

            Assert.IsNotEmpty(facadeGradient);
            Assert.AreEqual(gradientString, facadeGradient);
        }
Пример #3
0
        public void CanEvaluateGradient()
        {
            // ARRANGE
            var stylesheet = MapCssHelper
                             .GetStylesheetFromContent(String.Format("node[test] {{ facade: eval(gradient(tag('colour')));}}\n"));

            // ACT
            var node = MapCssHelper.GetNode(new Dictionary <string, string>()
            {
                { "test", "yes" },
                { "colour", "#0fff8f" },
            }.ToTags());

            // ASSERT
            var rule           = stylesheet.GetModelRule(node, MapConsts.MaxZoomLevel);
            var facadeGradient = rule.Evaluate <string>("facade");

            Assert.IsNotEmpty(facadeGradient);
            Assert.AreEqual("gradient(#0fff8f, #0fff8f 50%, #099956)", facadeGradient);
        }