Esempio n. 1
0
        public void CanUseZoomLevel(string zoomStr, int start, int end, int currentZoomLevel, bool expectedResult)
        {
            // ARRANGE
            var stylesheet = MapCssHelper.GetStylesheetFromContent(
                String.Format("area|{0}[level>0] {{ z-index: 0.1}}\n", zoomStr));

            var area = MapCssHelper.GetArea(new Dictionary <string, string>()
            {
                { "level", "1" }
            }.ToTags());

            // ACT
            var rule = stylesheet.GetModelRule(area, currentZoomLevel);

            // ASSERT
            Assert.IsTrue(rule.IsApplicable == expectedResult);
        }
Esempio n. 2
0
        public void CanUseLess()
        {
            // ARRANGE
            var stylesheet = MapCssHelper.GetStylesheetFromContent("area[level<0] { z-index: 0.1}\n");

            // ACT
            var area1 = MapCssHelper.GetArea(new Dictionary <string, string>()
            {
                { "level", "-1" }
            }.ToTags());
            var area2 = MapCssHelper.GetArea(new Dictionary <string, string>()
            {
                { "level", "1" }
            }.ToTags());

            // ASSERT
            Assert.IsTrue(stylesheet.GetModelRule(area1, MapConsts.MaxZoomLevel).IsApplicable);
            Assert.IsFalse(stylesheet.GetModelRule(area2, MapConsts.MaxZoomLevel).IsApplicable);
        }
Esempio n. 3
0
        public void CanUseNotEqual()
        {
            // ARRANGE
            var stylesheet = MapCssHelper.GetStylesheetFromContent("area[landuse!=forest] { z-index: 0.1}\n");

            // ACT
            var area1 = MapCssHelper.GetArea(new Dictionary <string, string>()
            {
                { "landuse", "forest" }
            }.ToTags());
            var area2 = MapCssHelper.GetArea(new Dictionary <string, string>()
            {
                { "landuse", "grass" }
            }.ToTags());

            // ASSERT
            Assert.IsFalse(stylesheet.GetModelRule(area1, MapConsts.MaxZoomLevel).IsApplicable);
            Assert.IsTrue(stylesheet.GetModelRule(area2, MapConsts.MaxZoomLevel).IsApplicable);
        }
Esempio n. 4
0
        public void CanUseSingleValueInList(bool canUseExprTree)
        {
            // ARRANGE
            var stylesheet = MapCssHelper.GetStylesheetFromContent(
                "area[building] { behaviours:test1; non-important:test}", canUseExprTree);
            var building = MapCssHelper.GetArea(new Dictionary <string, string>()
            {
                { "building", "commercial" },
            }.ToTags());
            var rule = stylesheet.GetModelRule(building, MapConsts.MaxZoomLevel);

            // ACT
            var behaviours = rule.EvaluateList <string>("behaviours");

            // ASSERT
            var list = behaviours.ToList();

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual("test1", list[0]);
        }