summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLSymbolStyleLayerTests.mm
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-03-30 16:02:59 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-03-31 13:26:27 -0700
commit743d95405363e0eea1b80e8c28bde245211f7868 (patch)
tree98cc6ab0a8980916ca704efd887a029a40d05d0e /platform/darwin/test/MGLSymbolStyleLayerTests.mm
parentc4f9582bfa9be832eb2eb349249918db8b867ec9 (diff)
downloadqtlocation-mapboxgl-743d95405363e0eea1b80e8c28bde245211f7868.tar.gz
[core] Add DDS support for text-rotate
Diffstat (limited to 'platform/darwin/test/MGLSymbolStyleLayerTests.mm')
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.mm30
1 files changed, 24 insertions, 6 deletions
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.mm b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
index 18dfa1366f..c967be611d 100644
--- a/platform/darwin/test/MGLSymbolStyleLayerTests.mm
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.mm
@@ -1332,7 +1332,7 @@
MGLStyleValue<NSNumber *> *constantStyleValue = [MGLStyleValue<NSNumber *> valueWithRawValue:@0xff];
layer.textRotation = constantStyleValue;
- mbgl::style::PropertyValue<float> propertyValue = { 0xff };
+ mbgl::style::DataDrivenPropertyValue<float> propertyValue = { 0xff };
XCTAssertEqual(rawLayer->getTextRotate(), propertyValue,
@"Setting textRotation to a constant value should update text-rotate.");
XCTAssertEqualObjects(layer.textRotation, constantStyleValue,
@@ -1349,6 +1349,29 @@
XCTAssertEqualObjects(layer.textRotation, functionStyleValue,
@"textRotation should round-trip camera functions.");
+ functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeExponential sourceStops:@{@18: constantStyleValue} attributeName:@"keyName" options:nil];
+ layer.textRotation = functionStyleValue;
+
+ mbgl::style::ExponentialStops<float> exponentialStops = { {{18, 0xff}}, 1.0 };
+ propertyValue = mbgl::style::SourceFunction<float> { "keyName", exponentialStops };
+
+ XCTAssertEqual(rawLayer->getTextRotate(), propertyValue,
+ @"Setting textRotation to a source function should update text-rotate.");
+ XCTAssertEqualObjects(layer.textRotation, functionStyleValue,
+ @"textRotation should round-trip source functions.");
+
+ functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeExponential compositeStops:@{@10: @{@18: constantStyleValue}} attributeName:@"keyName" options:nil];
+ layer.textRotation = functionStyleValue;
+
+ std::map<float, float> innerStops { {18, 0xff} };
+ mbgl::style::CompositeExponentialStops<float> compositeStops { { {10.0, innerStops} }, 1.0 };
+
+ propertyValue = mbgl::style::CompositeFunction<float> { "keyName", compositeStops };
+
+ XCTAssertEqual(rawLayer->getTextRotate(), propertyValue,
+ @"Setting textRotation to a composite function should update text-rotate.");
+ XCTAssertEqualObjects(layer.textRotation, functionStyleValue,
+ @"textRotation should round-trip composite functions.");
layer.textRotation = nil;
@@ -1356,11 +1379,6 @@
@"Unsetting textRotation should return text-rotate to the default value.");
XCTAssertEqualObjects(layer.textRotation, defaultStyleValue,
@"textRotation should return the default value after being unset.");
-
- functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeIdentity sourceStops:nil attributeName:@"" options:nil];
- XCTAssertThrowsSpecificNamed(layer.textRotation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
- functionStyleValue = [MGLStyleValue<NSNumber *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
- XCTAssertThrowsSpecificNamed(layer.textRotation = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
}
// text-rotation-alignment