diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-09-17 17:14:28 -0700 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-09-25 14:28:56 -0700 |
commit | 86fa05dfeafbb8a13165a2289dbeca34475eaff2 (patch) | |
tree | ee3440030182ec3524f010865f8500e42601bb4b | |
parent | 35ec89b1242ab374abb36dcbffc372987d026dfb (diff) | |
download | qtlocation-mapboxgl-86fa05dfeafbb8a13165a2289dbeca34475eaff2.tar.gz |
[ios] Add a few tests
-rw-r--r-- | platform/darwin/test/MGLExpressionTests.mm | 6 | ||||
-rw-r--r-- | platform/darwin/test/MGLShapeSourceTests.mm | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index b3558e2bf4..b4455f9da4 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -356,6 +356,12 @@ using namespace std::string_literals; XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } { + NSExpression *expression = [NSExpression expressionForFunction:@"sum:" arguments:@[@1, @2, @2, @3, @4, @7, @9]]; + NSArray *jsonExpression = @[@"+", @1, @2, @2, @3, @4, @7, @9]; + XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @28); + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); + } + { NSExpression *expression = [NSExpression expressionWithFormat:@"count({1, 2, 2, 3, 4, 7, 9})"]; NSArray *jsonExpression = @[@"length", @[@"literal", @[@1, @2, @2, @3, @4, @7, @9]]]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); diff --git a/platform/darwin/test/MGLShapeSourceTests.mm b/platform/darwin/test/MGLShapeSourceTests.mm index 3459fb1733..3bf3ef04bd 100644 --- a/platform/darwin/test/MGLShapeSourceTests.mm +++ b/platform/darwin/test/MGLShapeSourceTests.mm @@ -13,8 +13,12 @@ @implementation MGLShapeSourceTests - (void)testGeoJSONOptionsFromDictionary { + NSExpression *reduceExpression = [NSExpression expressionForFunction:@"sum:" arguments:@[[NSExpression expressionForKeyPath:@"featureAccumulated"], [NSExpression expressionForKeyPath:@"sumValue"]]]; + NSExpression *mapExpression = [NSExpression expressionForKeyPath:@"mag"]; + NSArray *clusterPropertyArray = @[reduceExpression, mapExpression]; NSDictionary *options = @{MGLShapeSourceOptionClustered: @YES, MGLShapeSourceOptionClusterRadius: @42, + MGLShapeSourceOptionClusterProperties: @{@"sumValue": clusterPropertyArray}, MGLShapeSourceOptionMaximumZoomLevelForClustering: @98, MGLShapeSourceOptionMaximumZoomLevel: @99, MGLShapeSourceOptionBuffer: @1976, @@ -29,6 +33,7 @@ XCTAssertEqual(mbglOptions.buffer, 1976); XCTAssertEqual(mbglOptions.tolerance, 0.42); XCTAssertTrue(mbglOptions.lineMetrics); + XCTAssertTrue(!mbglOptions.clusterProperties.empty()); options = @{MGLShapeSourceOptionClustered: @"number 1"}; XCTAssertThrows(MGLGeoJSONOptionsFromDictionary(options)); |