summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLFillStyleLayerTests.mm
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2018-03-30 16:43:55 -0700
committerGitHub <noreply@github.com>2018-03-30 16:43:55 -0700
commit59e92904c360e5aad94a1b789276bf6147120d7c (patch)
treefcb675741c492692324d841f8aaae905a3ccf8f4 /platform/darwin/test/MGLFillStyleLayerTests.mm
parentb6866f764e5a804399ed60bbbce43a379b568ece (diff)
downloadqtlocation-mapboxgl-59e92904c360e5aad94a1b789276bf6147120d7c.tar.gz
Eviscerate mbgl expression to Foundation JSON object conversion (#11389)
* [ios, macos] Eviscerate mbgl expression to Foundation JSON object conversion * [ios, macos] Remove literal special case MGLJSONObjectFromMBGLValue() is just a literal translation from C++ types to Foundation types; no need for expression-specific literal wrapping. * [ios, macos] Implemented RGB(A) operators * [ios, macos] More robust color conversion * [macos] Create calibrated RGB from expression on Sierra * [macos] Calibrate colors in expressions at runtime * [ios, macos] Special-case number conversion without fallbacks * [ios, macos] Test mgl_number expressions * [ios, macos] Updated tests for aftermarket expressions * [ios, macos] Relax roundtripping requirement for serialize() * [ios, macos] Fixed interpolation expression tests * [ios, macos] Removed dead code * [ios, macos] Fixed color conversion on Sierra
Diffstat (limited to 'platform/darwin/test/MGLFillStyleLayerTests.mm')
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.mm18
1 files changed, 12 insertions, 6 deletions
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm
index 8fa349c135..1c2342bb0f 100644
--- a/platform/darwin/test/MGLFillStyleLayerTests.mm
+++ b/platform/darwin/test/MGLFillStyleLayerTests.mm
@@ -129,7 +129,8 @@
XCTAssertEqual(rawLayer->getFillColor(), propertyValue,
@"Setting fillColor to a data expression should update fill-color.");
- XCTAssertEqualObjects(layer.fillColor, functionExpression,
+ NSExpression *pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:(CAST(keyName, 'NSNumber'), 'linear', nil, %@)", @{@18: constantExpression}];
+ XCTAssertEqualObjects(layer.fillColor, pedanticFunctionExpression,
@"fillColor should round-trip data expressions.");
functionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: functionExpression}];
@@ -142,7 +143,8 @@
XCTAssertEqual(rawLayer->getFillColor(), propertyValue,
@"Setting fillColor to a camera-data expression should update fill-color.");
- XCTAssertEqualObjects(layer.fillColor, functionExpression,
+ pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}];
+ XCTAssertEqualObjects(layer.fillColor, pedanticFunctionExpression,
@"fillColor should round-trip camera-data expressions.");
@@ -199,7 +201,8 @@
XCTAssertEqual(rawLayer->getFillOpacity(), propertyValue,
@"Setting fillOpacity to a data expression should update fill-opacity.");
- XCTAssertEqualObjects(layer.fillOpacity, functionExpression,
+ NSExpression *pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:(CAST(keyName, 'NSNumber'), 'linear', nil, %@)", @{@18: constantExpression}];
+ XCTAssertEqualObjects(layer.fillOpacity, pedanticFunctionExpression,
@"fillOpacity should round-trip data expressions.");
functionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: functionExpression}];
@@ -212,7 +215,8 @@
XCTAssertEqual(rawLayer->getFillOpacity(), propertyValue,
@"Setting fillOpacity to a camera-data expression should update fill-opacity.");
- XCTAssertEqualObjects(layer.fillOpacity, functionExpression,
+ pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}];
+ XCTAssertEqualObjects(layer.fillOpacity, pedanticFunctionExpression,
@"fillOpacity should round-trip camera-data expressions.");
@@ -269,7 +273,8 @@
XCTAssertEqual(rawLayer->getFillOutlineColor(), propertyValue,
@"Setting fillOutlineColor to a data expression should update fill-outline-color.");
- XCTAssertEqualObjects(layer.fillOutlineColor, functionExpression,
+ NSExpression *pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:(CAST(keyName, 'NSNumber'), 'linear', nil, %@)", @{@18: constantExpression}];
+ XCTAssertEqualObjects(layer.fillOutlineColor, pedanticFunctionExpression,
@"fillOutlineColor should round-trip data expressions.");
functionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: functionExpression}];
@@ -282,7 +287,8 @@
XCTAssertEqual(rawLayer->getFillOutlineColor(), propertyValue,
@"Setting fillOutlineColor to a camera-data expression should update fill-outline-color.");
- XCTAssertEqualObjects(layer.fillOutlineColor, functionExpression,
+ pedanticFunctionExpression = [NSExpression expressionWithFormat:@"mgl_interpolate:withCurveType:parameters:stops:($zoomLevel, 'linear', nil, %@)", @{@10: pedanticFunctionExpression}];
+ XCTAssertEqualObjects(layer.fillOutlineColor, pedanticFunctionExpression,
@"fillOutlineColor should round-trip camera-data expressions.");