diff --git a/mapbox-gl-js b/mapbox-gl-js index 5f3bdb9b009..6878e612a1a 160000 --- a/mapbox-gl-js +++ b/mapbox-gl-js @@ -1 +1 @@ -Subproject commit 5f3bdb9b00915d702ae9b967c5ebc15ab33ba653 +Subproject commit 6878e612a1abfba76ba2604440abb68903b70268 diff --git a/platform/android/scripts/generate-style-code.js b/platform/android/scripts/generate-style-code.js index 3b0363cc19d..bfbdca3cc36 100755 --- a/platform/android/scripts/generate-style-code.js +++ b/platform/android/scripts/generate-style-code.js @@ -268,9 +268,13 @@ global.propertyValueDoc = function (property, value) { }; global.isDataDriven = function (property) { - return property['property-function'] === true; + return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven'; }; +global.isInterpolable = function(property) { + return property.expression && property.expression.interpolated; +} + global.isLightProperty = function (property) { return property['light-property'] === true; }; @@ -318,11 +322,11 @@ global.evaluatedType = function (property) { }; global.supportsZoomFunction = function (property) { - return property['zoom-function'] === true; + return property.expression && property.expression.parameters.indexOf('zoom') > -1; }; global.supportsPropertyFunction = function (property) { - return property['property-function'] === true; + return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven'; }; // Template processing // diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index c7b54b326a5..7ad7e90e4ec 100755 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -319,9 +319,9 @@ global.propertyDoc = function (propertyName, property, layerType, kind) { '* Conditional expressions\n' + '* Variable assignments and references to assigned variables\n'; const inputVariable = property.name === 'heatmap-color' ? '$heatmapDensity' : '$zoomLevel'; - if (property["property-function"]) { + if (isDataDriven(property)) { doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable and/or feature attributes\n`; - } else if (property.function === "interpolated") { + } else if (property.expression && property.expression.interpolated) { doc += `* Interpolation and step functions applied to the \`${inputVariable}\` variable\n\n` + 'This property does not support applying interpolation or step functions to feature attributes.'; } else { @@ -332,6 +332,10 @@ global.propertyDoc = function (propertyName, property, layerType, kind) { return doc; }; +global.isDataDriven = function (property) { + return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven'; +}; + global.propertyReqs = function (property, propertiesByName, type) { return 'This property is only applied to the style if ' + property.requires.map(function (req) { if (typeof req === 'string') { diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 42940083b59..3792906a538 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -121,7 +121,7 @@ namespace mbgl { - (void)set<%- camelize(property.name) %>:(NSExpression *)<%- objCName(property) %> { MGLAssertStyleLayerIsValid(); -<% if (property["property-function"]) { -%> +<% if (isDataDriven(property)) { -%> auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue>>(<%- objCName(property) %>); <% } else { -%> auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue>>(<%- objCName(property) %>); @@ -164,7 +164,7 @@ namespace mbgl { <% if (property.name === 'heatmap-color') { -%> auto mbglValue = MGLStyleValueTransformer().toPropertyValue(heatmapColor); -<% } else if (property["property-function"]) { -%> +<% } else if (isDataDriven(property)) { -%> auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue>>(<%- objCName(property) %>); <% } else { -%> auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue>>(<%- objCName(property) %>); diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm index de8080f4251..bf18b2d30e8 100644 --- a/platform/darwin/test/MGLBackgroundStyleLayerTests.mm +++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.mm @@ -50,13 +50,12 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getBackgroundColor(), propertyValue, @"Setting backgroundColor to a camera expression should update background-color."); XCTAssertEqualObjects(layer.backgroundColor, functionExpression, @"backgroundColor should round-trip camera expressions."); - layer.backgroundColor = nil; XCTAssertTrue(rawLayer->getBackgroundColor().isUndefined(), @@ -103,13 +102,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getBackgroundOpacity(), propertyValue, @"Setting backgroundOpacity to a camera expression should update background-opacity."); XCTAssertEqualObjects(layer.backgroundOpacity, functionExpression, @"backgroundOpacity should round-trip camera expressions."); - layer.backgroundOpacity = nil; XCTAssertTrue(rawLayer->getBackgroundOpacity().isUndefined(), @@ -156,13 +154,12 @@ - (void)testProperties { { 18, "Background Pattern" }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getBackgroundPattern(), propertyValue, @"Setting backgroundPattern to a camera expression should update background-pattern."); XCTAssertEqualObjects(layer.backgroundPattern, functionExpression, @"backgroundPattern should round-trip camera expressions."); - layer.backgroundPattern = nil; XCTAssertTrue(rawLayer->getBackgroundPattern().isUndefined(), diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.mm b/platform/darwin/test/MGLCircleStyleLayerTests.mm index d7bf2a5afd0..41f7238da21 100644 --- a/platform/darwin/test/MGLCircleStyleLayerTests.mm +++ b/platform/darwin/test/MGLCircleStyleLayerTests.mm @@ -71,7 +71,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleBlur(), propertyValue, @"Setting circleBlur to a camera expression should update circle-blur."); XCTAssertEqualObjects(layer.circleBlur, functionExpression, @@ -102,7 +102,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.circleBlur, pedanticFunctionExpression, @"circleBlur should round-trip camera-data expressions."); - layer.circleBlur = nil; XCTAssertTrue(rawLayer->getCircleBlur().isUndefined(), @@ -143,7 +142,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleColor(), propertyValue, @"Setting circleColor to a camera expression should update circle-color."); XCTAssertEqualObjects(layer.circleColor, functionExpression, @@ -174,7 +173,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.circleColor, pedanticFunctionExpression, @"circleColor should round-trip camera-data expressions."); - layer.circleColor = nil; XCTAssertTrue(rawLayer->getCircleColor().isUndefined(), @@ -215,7 +213,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleOpacity(), propertyValue, @"Setting circleOpacity to a camera expression should update circle-opacity."); XCTAssertEqualObjects(layer.circleOpacity, functionExpression, @@ -246,7 +244,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.circleOpacity, pedanticFunctionExpression, @"circleOpacity should round-trip camera-data expressions."); - layer.circleOpacity = nil; XCTAssertTrue(rawLayer->getCircleOpacity().isUndefined(), @@ -287,13 +284,12 @@ - (void)testProperties { { 18, mbgl::style::AlignmentType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCirclePitchAlignment(), propertyValue, @"Setting circlePitchAlignment to a camera expression should update circle-pitch-alignment."); XCTAssertEqualObjects(layer.circlePitchAlignment, functionExpression, @"circlePitchAlignment should round-trip camera expressions."); - layer.circlePitchAlignment = nil; XCTAssertTrue(rawLayer->getCirclePitchAlignment().isUndefined(), @@ -331,7 +327,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleRadius(), propertyValue, @"Setting circleRadius to a camera expression should update circle-radius."); XCTAssertEqualObjects(layer.circleRadius, functionExpression, @@ -362,7 +358,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.circleRadius, pedanticFunctionExpression, @"circleRadius should round-trip camera-data expressions."); - layer.circleRadius = nil; XCTAssertTrue(rawLayer->getCircleRadius().isUndefined(), @@ -403,13 +398,12 @@ - (void)testProperties { { 18, mbgl::style::CirclePitchScaleType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCirclePitchScale(), propertyValue, @"Setting circleScaleAlignment to a camera expression should update circle-pitch-scale."); XCTAssertEqualObjects(layer.circleScaleAlignment, functionExpression, @"circleScaleAlignment should round-trip camera expressions."); - layer.circleScaleAlignment = nil; XCTAssertTrue(rawLayer->getCirclePitchScale().isUndefined(), @@ -447,7 +441,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleStrokeColor(), propertyValue, @"Setting circleStrokeColor to a camera expression should update circle-stroke-color."); XCTAssertEqualObjects(layer.circleStrokeColor, functionExpression, @@ -478,7 +472,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.circleStrokeColor, pedanticFunctionExpression, @"circleStrokeColor should round-trip camera-data expressions."); - layer.circleStrokeColor = nil; XCTAssertTrue(rawLayer->getCircleStrokeColor().isUndefined(), @@ -519,7 +512,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleStrokeOpacity(), propertyValue, @"Setting circleStrokeOpacity to a camera expression should update circle-stroke-opacity."); XCTAssertEqualObjects(layer.circleStrokeOpacity, functionExpression, @@ -550,7 +543,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.circleStrokeOpacity, pedanticFunctionExpression, @"circleStrokeOpacity should round-trip camera-data expressions."); - layer.circleStrokeOpacity = nil; XCTAssertTrue(rawLayer->getCircleStrokeOpacity().isUndefined(), @@ -591,7 +583,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleStrokeWidth(), propertyValue, @"Setting circleStrokeWidth to a camera expression should update circle-stroke-width."); XCTAssertEqualObjects(layer.circleStrokeWidth, functionExpression, @@ -622,7 +614,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.circleStrokeWidth, pedanticFunctionExpression, @"circleStrokeWidth should round-trip camera-data expressions."); - layer.circleStrokeWidth = nil; XCTAssertTrue(rawLayer->getCircleStrokeWidth().isUndefined(), @@ -669,13 +660,12 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleTranslate(), propertyValue, @"Setting circleTranslation to a camera expression should update circle-translate."); XCTAssertEqualObjects(layer.circleTranslation, functionExpression, @"circleTranslation should round-trip camera expressions."); - layer.circleTranslation = nil; XCTAssertTrue(rawLayer->getCircleTranslate().isUndefined(), @@ -713,13 +703,12 @@ - (void)testProperties { { 18, mbgl::style::TranslateAnchorType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getCircleTranslateAnchor(), propertyValue, @"Setting circleTranslationAnchor to a camera expression should update circle-translate-anchor."); XCTAssertEqualObjects(layer.circleTranslationAnchor, functionExpression, @"circleTranslationAnchor should round-trip camera expressions."); - layer.circleTranslationAnchor = nil; XCTAssertTrue(rawLayer->getCircleTranslateAnchor().isUndefined(), diff --git a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm index 6081d104e12..ac858d0edc2 100644 --- a/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm +++ b/platform/darwin/test/MGLFillExtrusionStyleLayerTests.mm @@ -71,7 +71,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillExtrusionBase(), propertyValue, @"Setting fillExtrusionBase to a camera expression should update fill-extrusion-base."); XCTAssertEqualObjects(layer.fillExtrusionBase, functionExpression, @@ -102,7 +102,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.fillExtrusionBase, pedanticFunctionExpression, @"fillExtrusionBase should round-trip camera-data expressions."); - layer.fillExtrusionBase = nil; XCTAssertTrue(rawLayer->getFillExtrusionBase().isUndefined(), @@ -143,7 +142,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillExtrusionColor(), propertyValue, @"Setting fillExtrusionColor to a camera expression should update fill-extrusion-color."); XCTAssertEqualObjects(layer.fillExtrusionColor, functionExpression, @@ -174,7 +173,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.fillExtrusionColor, pedanticFunctionExpression, @"fillExtrusionColor should round-trip camera-data expressions."); - layer.fillExtrusionColor = nil; XCTAssertTrue(rawLayer->getFillExtrusionColor().isUndefined(), @@ -215,7 +213,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillExtrusionHeight(), propertyValue, @"Setting fillExtrusionHeight to a camera expression should update fill-extrusion-height."); XCTAssertEqualObjects(layer.fillExtrusionHeight, functionExpression, @@ -246,7 +244,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.fillExtrusionHeight, pedanticFunctionExpression, @"fillExtrusionHeight should round-trip camera-data expressions."); - layer.fillExtrusionHeight = nil; XCTAssertTrue(rawLayer->getFillExtrusionHeight().isUndefined(), @@ -287,13 +284,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillExtrusionOpacity(), propertyValue, @"Setting fillExtrusionOpacity to a camera expression should update fill-extrusion-opacity."); XCTAssertEqualObjects(layer.fillExtrusionOpacity, functionExpression, @"fillExtrusionOpacity should round-trip camera expressions."); - layer.fillExtrusionOpacity = nil; XCTAssertTrue(rawLayer->getFillExtrusionOpacity().isUndefined(), @@ -340,13 +336,12 @@ - (void)testProperties { { 18, "Fill Extrusion Pattern" }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillExtrusionPattern(), propertyValue, @"Setting fillExtrusionPattern to a camera expression should update fill-extrusion-pattern."); XCTAssertEqualObjects(layer.fillExtrusionPattern, functionExpression, @"fillExtrusionPattern should round-trip camera expressions."); - layer.fillExtrusionPattern = nil; XCTAssertTrue(rawLayer->getFillExtrusionPattern().isUndefined(), @@ -399,13 +394,12 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getFillExtrusionTranslate(), propertyValue, @"Setting fillExtrusionTranslation to a camera expression should update fill-extrusion-translate."); XCTAssertEqualObjects(layer.fillExtrusionTranslation, functionExpression, @"fillExtrusionTranslation should round-trip camera expressions."); - layer.fillExtrusionTranslation = nil; XCTAssertTrue(rawLayer->getFillExtrusionTranslate().isUndefined(), @@ -443,13 +437,12 @@ - (void)testProperties { { 18, mbgl::style::TranslateAnchorType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillExtrusionTranslateAnchor(), propertyValue, @"Setting fillExtrusionTranslationAnchor to a camera expression should update fill-extrusion-translate-anchor."); XCTAssertEqualObjects(layer.fillExtrusionTranslationAnchor, functionExpression, @"fillExtrusionTranslationAnchor should round-trip camera expressions."); - layer.fillExtrusionTranslationAnchor = nil; XCTAssertTrue(rawLayer->getFillExtrusionTranslateAnchor().isUndefined(), diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm index a5019f10323..45bae07f433 100644 --- a/platform/darwin/test/MGLFillStyleLayerTests.mm +++ b/platform/darwin/test/MGLFillStyleLayerTests.mm @@ -71,13 +71,12 @@ - (void)testProperties { { 18, false }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillAntialias(), propertyValue, @"Setting fillAntialiased to a camera expression should update fill-antialias."); XCTAssertEqualObjects(layer.fillAntialiased, functionExpression, @"fillAntialiased should round-trip camera expressions."); - layer.fillAntialiased = nil; XCTAssertTrue(rawLayer->getFillAntialias().isUndefined(), @@ -115,7 +114,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillColor(), propertyValue, @"Setting fillColor to a camera expression should update fill-color."); XCTAssertEqualObjects(layer.fillColor, functionExpression, @@ -146,7 +145,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.fillColor, pedanticFunctionExpression, @"fillColor should round-trip camera-data expressions."); - layer.fillColor = nil; XCTAssertTrue(rawLayer->getFillColor().isUndefined(), @@ -187,7 +185,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillOpacity(), propertyValue, @"Setting fillOpacity to a camera expression should update fill-opacity."); XCTAssertEqualObjects(layer.fillOpacity, functionExpression, @@ -218,7 +216,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.fillOpacity, pedanticFunctionExpression, @"fillOpacity should round-trip camera-data expressions."); - layer.fillOpacity = nil; XCTAssertTrue(rawLayer->getFillOpacity().isUndefined(), @@ -259,7 +256,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillOutlineColor(), propertyValue, @"Setting fillOutlineColor to a camera expression should update fill-outline-color."); XCTAssertEqualObjects(layer.fillOutlineColor, functionExpression, @@ -290,7 +287,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.fillOutlineColor, pedanticFunctionExpression, @"fillOutlineColor should round-trip camera-data expressions."); - layer.fillOutlineColor = nil; XCTAssertTrue(rawLayer->getFillOutlineColor().isUndefined(), @@ -331,13 +327,12 @@ - (void)testProperties { { 18, "Fill Pattern" }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillPattern(), propertyValue, @"Setting fillPattern to a camera expression should update fill-pattern."); XCTAssertEqualObjects(layer.fillPattern, functionExpression, @"fillPattern should round-trip camera expressions."); - layer.fillPattern = nil; XCTAssertTrue(rawLayer->getFillPattern().isUndefined(), @@ -390,13 +385,12 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getFillTranslate(), propertyValue, @"Setting fillTranslation to a camera expression should update fill-translate."); XCTAssertEqualObjects(layer.fillTranslation, functionExpression, @"fillTranslation should round-trip camera expressions."); - layer.fillTranslation = nil; XCTAssertTrue(rawLayer->getFillTranslate().isUndefined(), @@ -434,13 +428,12 @@ - (void)testProperties { { 18, mbgl::style::TranslateAnchorType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getFillTranslateAnchor(), propertyValue, @"Setting fillTranslationAnchor to a camera expression should update fill-translate-anchor."); XCTAssertEqualObjects(layer.fillTranslationAnchor, functionExpression, @"fillTranslationAnchor should round-trip camera expressions."); - layer.fillTranslationAnchor = nil; XCTAssertTrue(rawLayer->getFillTranslateAnchor().isUndefined(), diff --git a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm index e4b19172571..db157788729 100644 --- a/platform/darwin/test/MGLHeatmapStyleLayerTests.mm +++ b/platform/darwin/test/MGLHeatmapStyleLayerTests.mm @@ -71,13 +71,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHeatmapIntensity(), propertyValue, @"Setting heatmapIntensity to a camera expression should update heatmap-intensity."); XCTAssertEqualObjects(layer.heatmapIntensity, functionExpression, @"heatmapIntensity should round-trip camera expressions."); - layer.heatmapIntensity = nil; XCTAssertTrue(rawLayer->getHeatmapIntensity().isUndefined(), @@ -124,13 +123,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHeatmapOpacity(), propertyValue, @"Setting heatmapOpacity to a camera expression should update heatmap-opacity."); XCTAssertEqualObjects(layer.heatmapOpacity, functionExpression, @"heatmapOpacity should round-trip camera expressions."); - layer.heatmapOpacity = nil; XCTAssertTrue(rawLayer->getHeatmapOpacity().isUndefined(), @@ -177,7 +175,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHeatmapRadius(), propertyValue, @"Setting heatmapRadius to a camera expression should update heatmap-radius."); XCTAssertEqualObjects(layer.heatmapRadius, functionExpression, @@ -208,7 +206,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.heatmapRadius, pedanticFunctionExpression, @"heatmapRadius should round-trip camera-data expressions."); - layer.heatmapRadius = nil; XCTAssertTrue(rawLayer->getHeatmapRadius().isUndefined(), @@ -249,7 +246,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHeatmapWeight(), propertyValue, @"Setting heatmapWeight to a camera expression should update heatmap-weight."); XCTAssertEqualObjects(layer.heatmapWeight, functionExpression, @@ -280,7 +277,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.heatmapWeight, pedanticFunctionExpression, @"heatmapWeight should round-trip camera-data expressions."); - layer.heatmapWeight = nil; XCTAssertTrue(rawLayer->getHeatmapWeight().isUndefined(), diff --git a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm index 34937d16749..2495b32d971 100644 --- a/platform/darwin/test/MGLHillshadeStyleLayerTests.mm +++ b/platform/darwin/test/MGLHillshadeStyleLayerTests.mm @@ -53,13 +53,12 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHillshadeAccentColor(), propertyValue, @"Setting hillshadeAccentColor to a camera expression should update hillshade-accent-color."); XCTAssertEqualObjects(layer.hillshadeAccentColor, functionExpression, @"hillshadeAccentColor should round-trip camera expressions."); - layer.hillshadeAccentColor = nil; XCTAssertTrue(rawLayer->getHillshadeAccentColor().isUndefined(), @@ -106,13 +105,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHillshadeExaggeration(), propertyValue, @"Setting hillshadeExaggeration to a camera expression should update hillshade-exaggeration."); XCTAssertEqualObjects(layer.hillshadeExaggeration, functionExpression, @"hillshadeExaggeration should round-trip camera expressions."); - layer.hillshadeExaggeration = nil; XCTAssertTrue(rawLayer->getHillshadeExaggeration().isUndefined(), @@ -159,13 +157,12 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHillshadeHighlightColor(), propertyValue, @"Setting hillshadeHighlightColor to a camera expression should update hillshade-highlight-color."); XCTAssertEqualObjects(layer.hillshadeHighlightColor, functionExpression, @"hillshadeHighlightColor should round-trip camera expressions."); - layer.hillshadeHighlightColor = nil; XCTAssertTrue(rawLayer->getHillshadeHighlightColor().isUndefined(), @@ -212,13 +209,12 @@ - (void)testProperties { { 18, mbgl::style::HillshadeIlluminationAnchorType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHillshadeIlluminationAnchor(), propertyValue, @"Setting hillshadeIlluminationAnchor to a camera expression should update hillshade-illumination-anchor."); XCTAssertEqualObjects(layer.hillshadeIlluminationAnchor, functionExpression, @"hillshadeIlluminationAnchor should round-trip camera expressions."); - layer.hillshadeIlluminationAnchor = nil; XCTAssertTrue(rawLayer->getHillshadeIlluminationAnchor().isUndefined(), @@ -256,13 +252,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHillshadeIlluminationDirection(), propertyValue, @"Setting hillshadeIlluminationDirection to a camera expression should update hillshade-illumination-direction."); XCTAssertEqualObjects(layer.hillshadeIlluminationDirection, functionExpression, @"hillshadeIlluminationDirection should round-trip camera expressions."); - layer.hillshadeIlluminationDirection = nil; XCTAssertTrue(rawLayer->getHillshadeIlluminationDirection().isUndefined(), @@ -300,13 +295,12 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getHillshadeShadowColor(), propertyValue, @"Setting hillshadeShadowColor to a camera expression should update hillshade-shadow-color."); XCTAssertEqualObjects(layer.hillshadeShadowColor, functionExpression, @"hillshadeShadowColor should round-trip camera expressions."); - layer.hillshadeShadowColor = nil; XCTAssertTrue(rawLayer->getHillshadeShadowColor().isUndefined(), diff --git a/platform/darwin/test/MGLLineStyleLayerTests.mm b/platform/darwin/test/MGLLineStyleLayerTests.mm index 5490278e983..aa24bc8c15a 100644 --- a/platform/darwin/test/MGLLineStyleLayerTests.mm +++ b/platform/darwin/test/MGLLineStyleLayerTests.mm @@ -71,13 +71,12 @@ - (void)testProperties { { 18, mbgl::style::LineCapType::Square }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineCap(), propertyValue, @"Setting lineCap to a camera expression should update line-cap."); XCTAssertEqualObjects(layer.lineCap, functionExpression, @"lineCap should round-trip camera expressions."); - layer.lineCap = nil; XCTAssertTrue(rawLayer->getLineCap().isUndefined(), @@ -115,13 +114,12 @@ - (void)testProperties { { 18, mbgl::style::LineJoinType::Miter }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineJoin(), propertyValue, @"Setting lineJoin to a camera expression should update line-join."); XCTAssertEqualObjects(layer.lineJoin, functionExpression, @"lineJoin should round-trip camera expressions."); - layer.lineJoin = nil; XCTAssertTrue(rawLayer->getLineJoin().isUndefined(), @@ -153,13 +151,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineMiterLimit(), propertyValue, @"Setting lineMiterLimit to a camera expression should update line-miter-limit."); XCTAssertEqualObjects(layer.lineMiterLimit, functionExpression, @"lineMiterLimit should round-trip camera expressions."); - layer.lineMiterLimit = nil; XCTAssertTrue(rawLayer->getLineMiterLimit().isUndefined(), @@ -197,13 +194,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineRoundLimit(), propertyValue, @"Setting lineRoundLimit to a camera expression should update line-round-limit."); XCTAssertEqualObjects(layer.lineRoundLimit, functionExpression, @"lineRoundLimit should round-trip camera expressions."); - layer.lineRoundLimit = nil; XCTAssertTrue(rawLayer->getLineRoundLimit().isUndefined(), @@ -241,7 +237,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineBlur(), propertyValue, @"Setting lineBlur to a camera expression should update line-blur."); XCTAssertEqualObjects(layer.lineBlur, functionExpression, @@ -272,7 +268,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.lineBlur, pedanticFunctionExpression, @"lineBlur should round-trip camera-data expressions."); - layer.lineBlur = nil; XCTAssertTrue(rawLayer->getLineBlur().isUndefined(), @@ -313,7 +308,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineColor(), propertyValue, @"Setting lineColor to a camera expression should update line-color."); XCTAssertEqualObjects(layer.lineColor, functionExpression, @@ -344,7 +339,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.lineColor, pedanticFunctionExpression, @"lineColor should round-trip camera-data expressions."); - layer.lineColor = nil; XCTAssertTrue(rawLayer->getLineColor().isUndefined(), @@ -385,13 +379,12 @@ - (void)testProperties { { 18, {1, 2} }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getLineDasharray(), propertyValue, @"Setting lineDashPattern to a camera expression should update line-dasharray."); XCTAssertEqualObjects(layer.lineDashPattern, functionExpression, @"lineDashPattern should round-trip camera expressions."); - layer.lineDashPattern = nil; XCTAssertTrue(rawLayer->getLineDasharray().isUndefined(), @@ -429,7 +422,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineGapWidth(), propertyValue, @"Setting lineGapWidth to a camera expression should update line-gap-width."); XCTAssertEqualObjects(layer.lineGapWidth, functionExpression, @@ -460,7 +453,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.lineGapWidth, pedanticFunctionExpression, @"lineGapWidth should round-trip camera-data expressions."); - layer.lineGapWidth = nil; XCTAssertTrue(rawLayer->getLineGapWidth().isUndefined(), @@ -501,7 +493,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineOffset(), propertyValue, @"Setting lineOffset to a camera expression should update line-offset."); XCTAssertEqualObjects(layer.lineOffset, functionExpression, @@ -532,7 +524,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.lineOffset, pedanticFunctionExpression, @"lineOffset should round-trip camera-data expressions."); - layer.lineOffset = nil; XCTAssertTrue(rawLayer->getLineOffset().isUndefined(), @@ -573,7 +564,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineOpacity(), propertyValue, @"Setting lineOpacity to a camera expression should update line-opacity."); XCTAssertEqualObjects(layer.lineOpacity, functionExpression, @@ -604,7 +595,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.lineOpacity, pedanticFunctionExpression, @"lineOpacity should round-trip camera-data expressions."); - layer.lineOpacity = nil; XCTAssertTrue(rawLayer->getLineOpacity().isUndefined(), @@ -645,13 +635,12 @@ - (void)testProperties { { 18, "Line Pattern" }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLinePattern(), propertyValue, @"Setting linePattern to a camera expression should update line-pattern."); XCTAssertEqualObjects(layer.linePattern, functionExpression, @"linePattern should round-trip camera expressions."); - layer.linePattern = nil; XCTAssertTrue(rawLayer->getLinePattern().isUndefined(), @@ -704,13 +693,12 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getLineTranslate(), propertyValue, @"Setting lineTranslation to a camera expression should update line-translate."); XCTAssertEqualObjects(layer.lineTranslation, functionExpression, @"lineTranslation should round-trip camera expressions."); - layer.lineTranslation = nil; XCTAssertTrue(rawLayer->getLineTranslate().isUndefined(), @@ -748,13 +736,12 @@ - (void)testProperties { { 18, mbgl::style::TranslateAnchorType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineTranslateAnchor(), propertyValue, @"Setting lineTranslationAnchor to a camera expression should update line-translate-anchor."); XCTAssertEqualObjects(layer.lineTranslationAnchor, functionExpression, @"lineTranslationAnchor should round-trip camera expressions."); - layer.lineTranslationAnchor = nil; XCTAssertTrue(rawLayer->getLineTranslateAnchor().isUndefined(), @@ -792,7 +779,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getLineWidth(), propertyValue, @"Setting lineWidth to a camera expression should update line-width."); XCTAssertEqualObjects(layer.lineWidth, functionExpression, @@ -823,7 +810,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.lineWidth, pedanticFunctionExpression, @"lineWidth should round-trip camera-data expressions."); - layer.lineWidth = nil; XCTAssertTrue(rawLayer->getLineWidth().isUndefined(), diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.mm b/platform/darwin/test/MGLRasterStyleLayerTests.mm index c8e454743e9..cf5175812e3 100644 --- a/platform/darwin/test/MGLRasterStyleLayerTests.mm +++ b/platform/darwin/test/MGLRasterStyleLayerTests.mm @@ -53,13 +53,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getRasterBrightnessMax(), propertyValue, @"Setting maximumRasterBrightness to a camera expression should update raster-brightness-max."); XCTAssertEqualObjects(layer.maximumRasterBrightness, functionExpression, @"maximumRasterBrightness should round-trip camera expressions."); - layer.maximumRasterBrightness = nil; XCTAssertTrue(rawLayer->getRasterBrightnessMax().isUndefined(), @@ -97,13 +96,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getRasterBrightnessMin(), propertyValue, @"Setting minimumRasterBrightness to a camera expression should update raster-brightness-min."); XCTAssertEqualObjects(layer.minimumRasterBrightness, functionExpression, @"minimumRasterBrightness should round-trip camera expressions."); - layer.minimumRasterBrightness = nil; XCTAssertTrue(rawLayer->getRasterBrightnessMin().isUndefined(), @@ -141,13 +139,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getRasterContrast(), propertyValue, @"Setting rasterContrast to a camera expression should update raster-contrast."); XCTAssertEqualObjects(layer.rasterContrast, functionExpression, @"rasterContrast should round-trip camera expressions."); - layer.rasterContrast = nil; XCTAssertTrue(rawLayer->getRasterContrast().isUndefined(), @@ -194,13 +191,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getRasterFadeDuration(), propertyValue, @"Setting rasterFadeDuration to a camera expression should update raster-fade-duration."); XCTAssertEqualObjects(layer.rasterFadeDuration, functionExpression, @"rasterFadeDuration should round-trip camera expressions."); - layer.rasterFadeDuration = nil; XCTAssertTrue(rawLayer->getRasterFadeDuration().isUndefined(), @@ -238,13 +234,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getRasterHueRotate(), propertyValue, @"Setting rasterHueRotation to a camera expression should update raster-hue-rotate."); XCTAssertEqualObjects(layer.rasterHueRotation, functionExpression, @"rasterHueRotation should round-trip camera expressions."); - layer.rasterHueRotation = nil; XCTAssertTrue(rawLayer->getRasterHueRotate().isUndefined(), @@ -282,13 +277,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getRasterOpacity(), propertyValue, @"Setting rasterOpacity to a camera expression should update raster-opacity."); XCTAssertEqualObjects(layer.rasterOpacity, functionExpression, @"rasterOpacity should round-trip camera expressions."); - layer.rasterOpacity = nil; XCTAssertTrue(rawLayer->getRasterOpacity().isUndefined(), @@ -335,13 +329,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getRasterSaturation(), propertyValue, @"Setting rasterSaturation to a camera expression should update raster-saturation."); XCTAssertEqualObjects(layer.rasterSaturation, functionExpression, @"rasterSaturation should round-trip camera expressions."); - layer.rasterSaturation = nil; XCTAssertTrue(rawLayer->getRasterSaturation().isUndefined(), diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs index f70f0bba23a..0266a033eec 100644 --- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs +++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs @@ -69,7 +69,7 @@ NSExpression *constantExpression = [NSExpression expressionWithFormat:<%- objCTestValue(property, type, true, 3) %>]; layer.<%- objCName(property) %> = constantExpression; -<% if (property["property-function"]) { -%> +<% if (isDataDriven(property)) { -%> mbgl::style::DataDrivenPropertyValue<<%- mbglType(property) %>> propertyValue = { <%- mbglTestValue(property, type) %> }; <% } else { -%> mbgl::style::PropertyValue<<%- mbglType(property) %>> propertyValue = { <%- mbglTestValue(property, type) %> }; @@ -88,13 +88,13 @@ { 18, <%- mbglTestValue(property, type) %> }, }}; propertyValue = mbgl::style::CameraFunction<<%- mbglType(property) %>> { intervalStops }; - + XCTAssertEqual(rawLayer->get<%- camelize(originalPropertyName(property)) %>(), propertyValue, @"Setting <%- objCName(property) %> to a camera expression should update <%- originalPropertyName(property) %>."); XCTAssertEqualObjects(layer.<%- objCName(property) %>, functionExpression, @"<%- objCName(property) %> should round-trip camera expressions."); -<% if (property["property-function"] && isInterpolatable(property)) { -%> +<% if (isDataDriven(property) && isInterpolatable(property)) { -%> functionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:(keyName, 'linear', nil, %@)", @{@18: constantExpression}]; layer.<%- objCName(property) %> = functionExpression; @@ -120,7 +120,7 @@ pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.<%- objCName(property) %>, pedanticFunctionExpression, @"<%- objCName(property) %> should round-trip camera-data expressions."); -<% } -%> +<% } -%> <% if (!property.required) { -%> layer.<%- objCName(property) %> = nil; @@ -129,7 +129,7 @@ XCTAssertEqualObjects(layer.<%- objCName(property) %>, defaultExpression, @"<%- objCName(property) %> should return the default value after being unset."); <% } -%> -<% if (!property["property-function"]) { -%> +<% if (!isDataDriven(property)) { -%> functionExpression = [NSExpression expressionForKeyPath:@"bogus"]; XCTAssertThrowsSpecificNamed(layer.<%- objCName(property) %> = functionExpression, NSException, NSInvalidArgumentException, @"MGL<%- camelize(type) %>Layer should raise an exception if a camera-data expression is applied to a property that does not support key paths to feature attributes."); diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm index cf2f80125a6..e1a7ee4e0e6 100644 --- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm +++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm @@ -71,13 +71,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconAllowOverlap(), propertyValue, @"Setting iconAllowsOverlap to a camera expression should update icon-allow-overlap."); XCTAssertEqualObjects(layer.iconAllowsOverlap, functionExpression, @"iconAllowsOverlap should round-trip camera expressions."); - layer.iconAllowsOverlap = nil; XCTAssertTrue(rawLayer->getIconAllowOverlap().isUndefined(), @@ -115,13 +114,12 @@ - (void)testProperties { { 18, mbgl::style::SymbolAnchorType::BottomRight }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconAnchor(), propertyValue, @"Setting iconAnchor to a camera expression should update icon-anchor."); XCTAssertEqualObjects(layer.iconAnchor, functionExpression, @"iconAnchor should round-trip camera expressions."); - layer.iconAnchor = nil; XCTAssertTrue(rawLayer->getIconAnchor().isUndefined(), @@ -153,13 +151,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconIgnorePlacement(), propertyValue, @"Setting iconIgnoresPlacement to a camera expression should update icon-ignore-placement."); XCTAssertEqualObjects(layer.iconIgnoresPlacement, functionExpression, @"iconIgnoresPlacement should round-trip camera expressions."); - layer.iconIgnoresPlacement = nil; XCTAssertTrue(rawLayer->getIconIgnorePlacement().isUndefined(), @@ -197,13 +194,12 @@ - (void)testProperties { { 18, "Icon Image" }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconImage(), propertyValue, @"Setting iconImageName to a camera expression should update icon-image."); XCTAssertEqualObjects(layer.iconImageName, functionExpression, @"iconImageName should round-trip camera expressions."); - layer.iconImageName = nil; XCTAssertTrue(rawLayer->getIconImage().isUndefined(), @@ -241,7 +237,7 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getIconOffset(), propertyValue, @"Setting iconOffset to a camera expression should update icon-offset."); XCTAssertEqualObjects(layer.iconOffset, functionExpression, @@ -272,7 +268,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconOffset, pedanticFunctionExpression, @"iconOffset should round-trip camera-data expressions."); - layer.iconOffset = nil; XCTAssertTrue(rawLayer->getIconOffset().isUndefined(), @@ -304,13 +299,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconOptional(), propertyValue, @"Setting iconOptional to a camera expression should update icon-optional."); XCTAssertEqualObjects(layer.iconOptional, functionExpression, @"iconOptional should round-trip camera expressions."); - layer.iconOptional = nil; XCTAssertTrue(rawLayer->getIconOptional().isUndefined(), @@ -348,13 +342,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconPadding(), propertyValue, @"Setting iconPadding to a camera expression should update icon-padding."); XCTAssertEqualObjects(layer.iconPadding, functionExpression, @"iconPadding should round-trip camera expressions."); - layer.iconPadding = nil; XCTAssertTrue(rawLayer->getIconPadding().isUndefined(), @@ -392,13 +385,12 @@ - (void)testProperties { { 18, mbgl::style::AlignmentType::Auto }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconPitchAlignment(), propertyValue, @"Setting iconPitchAlignment to a camera expression should update icon-pitch-alignment."); XCTAssertEqualObjects(layer.iconPitchAlignment, functionExpression, @"iconPitchAlignment should round-trip camera expressions."); - layer.iconPitchAlignment = nil; XCTAssertTrue(rawLayer->getIconPitchAlignment().isUndefined(), @@ -436,7 +428,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconRotate(), propertyValue, @"Setting iconRotation to a camera expression should update icon-rotate."); XCTAssertEqualObjects(layer.iconRotation, functionExpression, @@ -467,7 +459,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconRotation, pedanticFunctionExpression, @"iconRotation should round-trip camera-data expressions."); - layer.iconRotation = nil; XCTAssertTrue(rawLayer->getIconRotate().isUndefined(), @@ -499,13 +490,12 @@ - (void)testProperties { { 18, mbgl::style::AlignmentType::Auto }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconRotationAlignment(), propertyValue, @"Setting iconRotationAlignment to a camera expression should update icon-rotation-alignment."); XCTAssertEqualObjects(layer.iconRotationAlignment, functionExpression, @"iconRotationAlignment should round-trip camera expressions."); - layer.iconRotationAlignment = nil; XCTAssertTrue(rawLayer->getIconRotationAlignment().isUndefined(), @@ -543,7 +533,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconSize(), propertyValue, @"Setting iconScale to a camera expression should update icon-size."); XCTAssertEqualObjects(layer.iconScale, functionExpression, @@ -574,7 +564,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconScale, pedanticFunctionExpression, @"iconScale should round-trip camera-data expressions."); - layer.iconScale = nil; XCTAssertTrue(rawLayer->getIconSize().isUndefined(), @@ -606,13 +595,12 @@ - (void)testProperties { { 18, mbgl::style::IconTextFitType::Both }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconTextFit(), propertyValue, @"Setting iconTextFit to a camera expression should update icon-text-fit."); XCTAssertEqualObjects(layer.iconTextFit, functionExpression, @"iconTextFit should round-trip camera expressions."); - layer.iconTextFit = nil; XCTAssertTrue(rawLayer->getIconTextFit().isUndefined(), @@ -656,13 +644,12 @@ - (void)testProperties { { 18, { 1, 1, 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getIconTextFitPadding(), propertyValue, @"Setting iconTextFitPadding to a camera expression should update icon-text-fit-padding."); XCTAssertEqualObjects(layer.iconTextFitPadding, functionExpression, @"iconTextFitPadding should round-trip camera expressions."); - layer.iconTextFitPadding = nil; XCTAssertTrue(rawLayer->getIconTextFitPadding().isUndefined(), @@ -700,13 +687,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconKeepUpright(), propertyValue, @"Setting keepsIconUpright to a camera expression should update icon-keep-upright."); XCTAssertEqualObjects(layer.keepsIconUpright, functionExpression, @"keepsIconUpright should round-trip camera expressions."); - layer.keepsIconUpright = nil; XCTAssertTrue(rawLayer->getIconKeepUpright().isUndefined(), @@ -744,13 +730,12 @@ - (void)testProperties { { 18, false }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextKeepUpright(), propertyValue, @"Setting keepsTextUpright to a camera expression should update text-keep-upright."); XCTAssertEqualObjects(layer.keepsTextUpright, functionExpression, @"keepsTextUpright should round-trip camera expressions."); - layer.keepsTextUpright = nil; XCTAssertTrue(rawLayer->getTextKeepUpright().isUndefined(), @@ -788,13 +773,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextMaxAngle(), propertyValue, @"Setting maximumTextAngle to a camera expression should update text-max-angle."); XCTAssertEqualObjects(layer.maximumTextAngle, functionExpression, @"maximumTextAngle should round-trip camera expressions."); - layer.maximumTextAngle = nil; XCTAssertTrue(rawLayer->getTextMaxAngle().isUndefined(), @@ -832,7 +816,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextMaxWidth(), propertyValue, @"Setting maximumTextWidth to a camera expression should update text-max-width."); XCTAssertEqualObjects(layer.maximumTextWidth, functionExpression, @@ -863,7 +847,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.maximumTextWidth, pedanticFunctionExpression, @"maximumTextWidth should round-trip camera-data expressions."); - layer.maximumTextWidth = nil; XCTAssertTrue(rawLayer->getTextMaxWidth().isUndefined(), @@ -895,13 +878,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getSymbolAvoidEdges(), propertyValue, @"Setting symbolAvoidsEdges to a camera expression should update symbol-avoid-edges."); XCTAssertEqualObjects(layer.symbolAvoidsEdges, functionExpression, @"symbolAvoidsEdges should round-trip camera expressions."); - layer.symbolAvoidsEdges = nil; XCTAssertTrue(rawLayer->getSymbolAvoidEdges().isUndefined(), @@ -939,13 +921,12 @@ - (void)testProperties { { 18, mbgl::style::SymbolPlacementType::Line }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getSymbolPlacement(), propertyValue, @"Setting symbolPlacement to a camera expression should update symbol-placement."); XCTAssertEqualObjects(layer.symbolPlacement, functionExpression, @"symbolPlacement should round-trip camera expressions."); - layer.symbolPlacement = nil; XCTAssertTrue(rawLayer->getSymbolPlacement().isUndefined(), @@ -983,13 +964,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getSymbolSpacing(), propertyValue, @"Setting symbolSpacing to a camera expression should update symbol-spacing."); XCTAssertEqualObjects(layer.symbolSpacing, functionExpression, @"symbolSpacing should round-trip camera expressions."); - layer.symbolSpacing = nil; XCTAssertTrue(rawLayer->getSymbolSpacing().isUndefined(), @@ -1027,13 +1007,12 @@ - (void)testProperties { { 18, "Text Field" }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextField(), propertyValue, @"Setting text to a camera expression should update text-field."); XCTAssertEqualObjects(layer.text, functionExpression, @"text should round-trip camera expressions."); - layer.text = nil; XCTAssertTrue(rawLayer->getTextField().isUndefined(), @@ -1065,13 +1044,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextAllowOverlap(), propertyValue, @"Setting textAllowsOverlap to a camera expression should update text-allow-overlap."); XCTAssertEqualObjects(layer.textAllowsOverlap, functionExpression, @"textAllowsOverlap should round-trip camera expressions."); - layer.textAllowsOverlap = nil; XCTAssertTrue(rawLayer->getTextAllowOverlap().isUndefined(), @@ -1109,13 +1087,12 @@ - (void)testProperties { { 18, mbgl::style::SymbolAnchorType::BottomRight }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextAnchor(), propertyValue, @"Setting textAnchor to a camera expression should update text-anchor."); XCTAssertEqualObjects(layer.textAnchor, functionExpression, @"textAnchor should round-trip camera expressions."); - layer.textAnchor = nil; XCTAssertTrue(rawLayer->getTextAnchor().isUndefined(), @@ -1147,13 +1124,12 @@ - (void)testProperties { { 18, { "Text Font", "Tnof Txet" } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getTextFont(), propertyValue, @"Setting textFontNames to a camera expression should update text-font."); XCTAssertEqualObjects(layer.textFontNames, functionExpression, @"textFontNames should round-trip camera expressions."); - layer.textFontNames = nil; XCTAssertTrue(rawLayer->getTextFont().isUndefined(), @@ -1185,7 +1161,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextSize(), propertyValue, @"Setting textFontSize to a camera expression should update text-size."); XCTAssertEqualObjects(layer.textFontSize, functionExpression, @@ -1216,7 +1192,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textFontSize, pedanticFunctionExpression, @"textFontSize should round-trip camera-data expressions."); - layer.textFontSize = nil; XCTAssertTrue(rawLayer->getTextSize().isUndefined(), @@ -1248,13 +1223,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextIgnorePlacement(), propertyValue, @"Setting textIgnoresPlacement to a camera expression should update text-ignore-placement."); XCTAssertEqualObjects(layer.textIgnoresPlacement, functionExpression, @"textIgnoresPlacement should round-trip camera expressions."); - layer.textIgnoresPlacement = nil; XCTAssertTrue(rawLayer->getTextIgnorePlacement().isUndefined(), @@ -1292,13 +1266,12 @@ - (void)testProperties { { 18, mbgl::style::TextJustifyType::Right }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextJustify(), propertyValue, @"Setting textJustification to a camera expression should update text-justify."); XCTAssertEqualObjects(layer.textJustification, functionExpression, @"textJustification should round-trip camera expressions."); - layer.textJustification = nil; XCTAssertTrue(rawLayer->getTextJustify().isUndefined(), @@ -1330,7 +1303,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextLetterSpacing(), propertyValue, @"Setting textLetterSpacing to a camera expression should update text-letter-spacing."); XCTAssertEqualObjects(layer.textLetterSpacing, functionExpression, @@ -1361,7 +1334,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textLetterSpacing, pedanticFunctionExpression, @"textLetterSpacing should round-trip camera-data expressions."); - layer.textLetterSpacing = nil; XCTAssertTrue(rawLayer->getTextLetterSpacing().isUndefined(), @@ -1393,13 +1365,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextLineHeight(), propertyValue, @"Setting textLineHeight to a camera expression should update text-line-height."); XCTAssertEqualObjects(layer.textLineHeight, functionExpression, @"textLineHeight should round-trip camera expressions."); - layer.textLineHeight = nil; XCTAssertTrue(rawLayer->getTextLineHeight().isUndefined(), @@ -1443,7 +1414,7 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getTextOffset(), propertyValue, @"Setting textOffset to a camera expression should update text-offset."); XCTAssertEqualObjects(layer.textOffset, functionExpression, @@ -1474,7 +1445,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textOffset, pedanticFunctionExpression, @"textOffset should round-trip camera-data expressions."); - layer.textOffset = nil; XCTAssertTrue(rawLayer->getTextOffset().isUndefined(), @@ -1506,13 +1476,12 @@ - (void)testProperties { { 18, true }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextOptional(), propertyValue, @"Setting textOptional to a camera expression should update text-optional."); XCTAssertEqualObjects(layer.textOptional, functionExpression, @"textOptional should round-trip camera expressions."); - layer.textOptional = nil; XCTAssertTrue(rawLayer->getTextOptional().isUndefined(), @@ -1550,13 +1519,12 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextPadding(), propertyValue, @"Setting textPadding to a camera expression should update text-padding."); XCTAssertEqualObjects(layer.textPadding, functionExpression, @"textPadding should round-trip camera expressions."); - layer.textPadding = nil; XCTAssertTrue(rawLayer->getTextPadding().isUndefined(), @@ -1594,13 +1562,12 @@ - (void)testProperties { { 18, mbgl::style::AlignmentType::Auto }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextPitchAlignment(), propertyValue, @"Setting textPitchAlignment to a camera expression should update text-pitch-alignment."); XCTAssertEqualObjects(layer.textPitchAlignment, functionExpression, @"textPitchAlignment should round-trip camera expressions."); - layer.textPitchAlignment = nil; XCTAssertTrue(rawLayer->getTextPitchAlignment().isUndefined(), @@ -1638,7 +1605,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextRotate(), propertyValue, @"Setting textRotation to a camera expression should update text-rotate."); XCTAssertEqualObjects(layer.textRotation, functionExpression, @@ -1669,7 +1636,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textRotation, pedanticFunctionExpression, @"textRotation should round-trip camera-data expressions."); - layer.textRotation = nil; XCTAssertTrue(rawLayer->getTextRotate().isUndefined(), @@ -1701,13 +1667,12 @@ - (void)testProperties { { 18, mbgl::style::AlignmentType::Auto }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextRotationAlignment(), propertyValue, @"Setting textRotationAlignment to a camera expression should update text-rotation-alignment."); XCTAssertEqualObjects(layer.textRotationAlignment, functionExpression, @"textRotationAlignment should round-trip camera expressions."); - layer.textRotationAlignment = nil; XCTAssertTrue(rawLayer->getTextRotationAlignment().isUndefined(), @@ -1745,13 +1710,12 @@ - (void)testProperties { { 18, mbgl::style::TextTransformType::Lowercase }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextTransform(), propertyValue, @"Setting textTransform to a camera expression should update text-transform."); XCTAssertEqualObjects(layer.textTransform, functionExpression, @"textTransform should round-trip camera expressions."); - layer.textTransform = nil; XCTAssertTrue(rawLayer->getTextTransform().isUndefined(), @@ -1783,7 +1747,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconColor(), propertyValue, @"Setting iconColor to a camera expression should update icon-color."); XCTAssertEqualObjects(layer.iconColor, functionExpression, @@ -1814,7 +1778,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconColor, pedanticFunctionExpression, @"iconColor should round-trip camera-data expressions."); - layer.iconColor = nil; XCTAssertTrue(rawLayer->getIconColor().isUndefined(), @@ -1855,7 +1818,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconHaloBlur(), propertyValue, @"Setting iconHaloBlur to a camera expression should update icon-halo-blur."); XCTAssertEqualObjects(layer.iconHaloBlur, functionExpression, @@ -1886,7 +1849,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconHaloBlur, pedanticFunctionExpression, @"iconHaloBlur should round-trip camera-data expressions."); - layer.iconHaloBlur = nil; XCTAssertTrue(rawLayer->getIconHaloBlur().isUndefined(), @@ -1927,7 +1889,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconHaloColor(), propertyValue, @"Setting iconHaloColor to a camera expression should update icon-halo-color."); XCTAssertEqualObjects(layer.iconHaloColor, functionExpression, @@ -1958,7 +1920,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconHaloColor, pedanticFunctionExpression, @"iconHaloColor should round-trip camera-data expressions."); - layer.iconHaloColor = nil; XCTAssertTrue(rawLayer->getIconHaloColor().isUndefined(), @@ -1999,7 +1960,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconHaloWidth(), propertyValue, @"Setting iconHaloWidth to a camera expression should update icon-halo-width."); XCTAssertEqualObjects(layer.iconHaloWidth, functionExpression, @@ -2030,7 +1991,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconHaloWidth, pedanticFunctionExpression, @"iconHaloWidth should round-trip camera-data expressions."); - layer.iconHaloWidth = nil; XCTAssertTrue(rawLayer->getIconHaloWidth().isUndefined(), @@ -2071,7 +2031,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconOpacity(), propertyValue, @"Setting iconOpacity to a camera expression should update icon-opacity."); XCTAssertEqualObjects(layer.iconOpacity, functionExpression, @@ -2102,7 +2062,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.iconOpacity, pedanticFunctionExpression, @"iconOpacity should round-trip camera-data expressions."); - layer.iconOpacity = nil; XCTAssertTrue(rawLayer->getIconOpacity().isUndefined(), @@ -2149,13 +2108,12 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getIconTranslate(), propertyValue, @"Setting iconTranslation to a camera expression should update icon-translate."); XCTAssertEqualObjects(layer.iconTranslation, functionExpression, @"iconTranslation should round-trip camera expressions."); - layer.iconTranslation = nil; XCTAssertTrue(rawLayer->getIconTranslate().isUndefined(), @@ -2193,13 +2151,12 @@ - (void)testProperties { { 18, mbgl::style::TranslateAnchorType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getIconTranslateAnchor(), propertyValue, @"Setting iconTranslationAnchor to a camera expression should update icon-translate-anchor."); XCTAssertEqualObjects(layer.iconTranslationAnchor, functionExpression, @"iconTranslationAnchor should round-trip camera expressions."); - layer.iconTranslationAnchor = nil; XCTAssertTrue(rawLayer->getIconTranslateAnchor().isUndefined(), @@ -2237,7 +2194,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextColor(), propertyValue, @"Setting textColor to a camera expression should update text-color."); XCTAssertEqualObjects(layer.textColor, functionExpression, @@ -2268,7 +2225,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textColor, pedanticFunctionExpression, @"textColor should round-trip camera-data expressions."); - layer.textColor = nil; XCTAssertTrue(rawLayer->getTextColor().isUndefined(), @@ -2309,7 +2265,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextHaloBlur(), propertyValue, @"Setting textHaloBlur to a camera expression should update text-halo-blur."); XCTAssertEqualObjects(layer.textHaloBlur, functionExpression, @@ -2340,7 +2296,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textHaloBlur, pedanticFunctionExpression, @"textHaloBlur should round-trip camera-data expressions."); - layer.textHaloBlur = nil; XCTAssertTrue(rawLayer->getTextHaloBlur().isUndefined(), @@ -2381,7 +2336,7 @@ - (void)testProperties { { 18, { 1, 0, 0, 1 } }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextHaloColor(), propertyValue, @"Setting textHaloColor to a camera expression should update text-halo-color."); XCTAssertEqualObjects(layer.textHaloColor, functionExpression, @@ -2412,7 +2367,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textHaloColor, pedanticFunctionExpression, @"textHaloColor should round-trip camera-data expressions."); - layer.textHaloColor = nil; XCTAssertTrue(rawLayer->getTextHaloColor().isUndefined(), @@ -2453,7 +2407,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextHaloWidth(), propertyValue, @"Setting textHaloWidth to a camera expression should update text-halo-width."); XCTAssertEqualObjects(layer.textHaloWidth, functionExpression, @@ -2484,7 +2438,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textHaloWidth, pedanticFunctionExpression, @"textHaloWidth should round-trip camera-data expressions."); - layer.textHaloWidth = nil; XCTAssertTrue(rawLayer->getTextHaloWidth().isUndefined(), @@ -2525,7 +2478,7 @@ - (void)testProperties { { 18, 0xff }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextOpacity(), propertyValue, @"Setting textOpacity to a camera expression should update text-opacity."); XCTAssertEqualObjects(layer.textOpacity, functionExpression, @@ -2556,7 +2509,6 @@ - (void)testProperties { pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}]; XCTAssertEqualObjects(layer.textOpacity, pedanticFunctionExpression, @"textOpacity should round-trip camera-data expressions."); - layer.textOpacity = nil; XCTAssertTrue(rawLayer->getTextOpacity().isUndefined(), @@ -2603,13 +2555,12 @@ - (void)testProperties { { 18, { 1, 1 } }, }}; propertyValue = mbgl::style::CameraFunction> { intervalStops }; - + XCTAssertEqual(rawLayer->getTextTranslate(), propertyValue, @"Setting textTranslation to a camera expression should update text-translate."); XCTAssertEqualObjects(layer.textTranslation, functionExpression, @"textTranslation should round-trip camera expressions."); - layer.textTranslation = nil; XCTAssertTrue(rawLayer->getTextTranslate().isUndefined(), @@ -2647,13 +2598,12 @@ - (void)testProperties { { 18, mbgl::style::TranslateAnchorType::Viewport }, }}; propertyValue = mbgl::style::CameraFunction { intervalStops }; - + XCTAssertEqual(rawLayer->getTextTranslateAnchor(), propertyValue, @"Setting textTranslationAnchor to a camera expression should update text-translate-anchor."); XCTAssertEqualObjects(layer.textTranslationAnchor, functionExpression, @"textTranslationAnchor should round-trip camera expressions."); - layer.textTranslationAnchor = nil; XCTAssertTrue(rawLayer->getTextTranslateAnchor().isUndefined(), diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 6ddb787f197..7fdaac20a9b 100755 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -16,7 +16,7 @@ function parseCSSColor(str) { } global.isDataDriven = function (property) { - return property['property-function'] === true; + return property['property-type'] === 'data-driven' || property['property-type'] === 'cross-faded-data-driven'; }; global.isLightProperty = function (property) {