summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-11-02 18:15:31 -0700
committerMinh Nguyễn <mxn@1ec5.org>2017-11-02 18:15:31 -0700
commit096d48661f844ae94056cf41687f2e810be7a5e4 (patch)
tree2d0978888fed2132d9a16260f9bcf349274bb488
parentb585ccf86c8017679ff152e41ff1327851b026a0 (diff)
downloadqtlocation-mapboxgl-096d48661f844ae94056cf41687f2e810be7a5e4.tar.gz
[ios] Added tests for place, road accessibility values
-rw-r--r--platform/ios/test/MGLMapAccessibilityElementTests.m51
1 files changed, 51 insertions, 0 deletions
diff --git a/platform/ios/test/MGLMapAccessibilityElementTests.m b/platform/ios/test/MGLMapAccessibilityElementTests.m
index 67bbb08710..02656e5452 100644
--- a/platform/ios/test/MGLMapAccessibilityElementTests.m
+++ b/platform/ios/test/MGLMapAccessibilityElementTests.m
@@ -28,4 +28,55 @@
XCTAssertEqualObjects(element.accessibilityLabel, @"Cincinnati", @"Accessibility label should be romanized.");
}
+- (void)testPlaceFeatureValues {
+ MGLPointFeature *feature = [[MGLPointFeature alloc] init];
+ feature.attributes = @{
+ @"type": @"village_green",
+ };
+ MGLPlaceFeatureAccessibilityElement *element = [[MGLPlaceFeatureAccessibilityElement alloc] initWithAccessibilityContainer:self feature:feature];
+ XCTAssertEqualObjects(element.accessibilityValue, @"village green");
+
+ feature = [[MGLPointFeature alloc] init];
+ feature.attributes = @{
+ @"maki": @"cat",
+ };
+ element = [[MGLPlaceFeatureAccessibilityElement alloc] initWithAccessibilityContainer:self feature:feature];
+ XCTAssertEqualObjects(element.accessibilityValue, @"cat");
+
+ feature = [[MGLPointFeature alloc] init];
+ feature.attributes = @{
+ @"elevation_ft": @31337,
+ @"elevation_m": @1337,
+ };
+ element = [[MGLPlaceFeatureAccessibilityElement alloc] initWithAccessibilityContainer:self feature:feature];
+ XCTAssertEqualObjects(element.accessibilityValue, @"31,337 feet");
+}
+
+- (void)testRoadFeatureValues {
+ CLLocationCoordinate2D coordinates[] = {
+ CLLocationCoordinate2DMake(0, 0),
+ CLLocationCoordinate2DMake(0, 1),
+ CLLocationCoordinate2DMake(1, 2),
+ CLLocationCoordinate2DMake(2, 2),
+ };
+ MGLPolylineFeature *roadFeature = [MGLPolylineFeature polylineWithCoordinates:coordinates count:sizeof(coordinates) / sizeof(coordinates[0])];
+ roadFeature.attributes = @{
+ @"ref": @"42",
+ };
+ MGLRoadFeatureAccessibilityElement *element = [[MGLRoadFeatureAccessibilityElement alloc] initWithAccessibilityContainer:self feature:roadFeature];
+ XCTAssertEqualObjects(element.accessibilityValue, @"Route 42, southwest to northeast");
+
+ CLLocationCoordinate2D opposingCoordinates[] = {
+ CLLocationCoordinate2DMake(1, 0),
+ CLLocationCoordinate2DMake(2, 1),
+ };
+ MGLPolylineFeature *opposingRoadFeature = [MGLPolylineFeature polylineWithCoordinates:opposingCoordinates count:sizeof(opposingCoordinates) / sizeof(opposingCoordinates[0])];
+ MGLMultiPolylineFeature *dividedRoadFeature = [MGLMultiPolylineFeature multiPolylineWithPolylines:@[roadFeature, opposingRoadFeature]];
+ dividedRoadFeature.attributes = @{
+ @"ref": @"42",
+ };
+ element = [[MGLRoadFeatureAccessibilityElement alloc] initWithAccessibilityContainer:self feature:dividedRoadFeature];
+ XCTAssertEqualObjects(element.accessibilityValue, @"Route 42, Divided road, southwest to northeast");
+}
+
@end