diff options
Diffstat (limited to 'platform/darwin/test/MGLStyleLayerTests.mm.ejs')
-rw-r--r-- | platform/darwin/test/MGLStyleLayerTests.mm.ejs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs index 89b6cbe7e4..c97813eca2 100644 --- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs +++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs @@ -68,7 +68,11 @@ @"<%- originalPropertyName(property) %> should be unset initially."); NSExpression *defaultExpression = layer.<%- objCName(property) %>; +<% if (property.type === 'formatted') { -%> + NSExpression *constantExpression = [NSExpression expressionWithFormat:<%- objCTestValue(property, 'string', true, 3) %>]; +<% } else { -%> NSExpression *constantExpression = [NSExpression expressionWithFormat:<%- objCTestValue(property, type, true, 3) %>]; +<% } -%> layer.<%- objCName(property) %> = constantExpression; mbgl::style::PropertyValue<<%- mbglType(property) %>> propertyValue = { <%- mbglTestValue(property, type) %> }; XCTAssertEqual(rawLayer->get<%- camelize(originalPropertyName(property)) %>(), propertyValue, @@ -83,7 +87,11 @@ { using namespace mbgl::style::expression::dsl; propertyValue = mbgl::style::PropertyExpression<<%- mbglType(property) %>>( +<% if (property.type === 'formatted') { -%> + step(zoom(), format(<%- mbglExpressionTestValue(property, type) %>), 18.0, format(<%- mbglExpressionTestValue(property, type) %>)) +<% } else { -%> step(zoom(), literal(<%- mbglExpressionTestValue(property, type) %>), 18.0, literal(<%- mbglExpressionTestValue(property, type) %>)) +<% } -%> ); } @@ -160,13 +168,23 @@ { using namespace mbgl::style::expression::dsl; propertyValue = mbgl::style::PropertyExpression<<%- mbglType(property) %>>( +<% if (property.type === 'formatted') { -%> + format(toString(get(literal("token")))) +<% } else { -%> toString(get(literal("token"))) +<% } -%> ); } XCTAssertEqual(rawLayer->get<%- camelize(originalPropertyName(property)) %>(), propertyValue, @"Setting <%- objCName(property) %> to a constant string with tokens should convert to an expression."); - XCTAssertEqualObjects(layer.<%- objCName(property) %>, [NSExpression expressionWithFormat:@"CAST(token, \"NSString\")"], + +<% if (property.type === 'formatted') { -%> + NSExpression* tokenExpression = [NSExpression expressionWithFormat:@"MGL_FUNCTION('format', CAST(token, 'NSString'), %@)", @{}]; +<% } else { -%> + NSExpression* tokenExpression = [NSExpression expressionWithFormat:@"CAST(token, \"NSString\")"]; +<% } -%> + XCTAssertEqualObjects(layer.<%- objCName(property) %>, tokenExpression, @"Setting <%- objCName(property) %> to a constant string with tokens should convert to an expression."); <% } -%> } |