summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2018-02-13 16:14:29 -0500
committerJason Wray <jason@mapbox.com>2018-02-15 12:20:41 -0500
commit2c69b9985943133715a25ec771a3a83979eabeb8 (patch)
tree827d7ec1f9a2e8106bae8e5ff6f6c0ac81a35588
parent709164e75a9da36e16a914b08666b21b87108c2f (diff)
downloadqtlocation-mapboxgl-2c69b9985943133715a25ec771a3a83979eabeb8.tar.gz
[ios] Fix iOS 8's broken pluralization in MGLCoordinateFormatterTests
-rw-r--r--platform/darwin/test/MGLCoordinateFormatterTests.m21
1 files changed, 18 insertions, 3 deletions
diff --git a/platform/darwin/test/MGLCoordinateFormatterTests.m b/platform/darwin/test/MGLCoordinateFormatterTests.m
index ac083fa103..d693f739ec 100644
--- a/platform/darwin/test/MGLCoordinateFormatterTests.m
+++ b/platform/darwin/test/MGLCoordinateFormatterTests.m
@@ -24,7 +24,12 @@
coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239);
XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°54′48″N, 77°1′57″W");
XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°54′48″ north, 77°1′57″ west");
- XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees, 54 minutes, and 48 seconds north by 77 degrees, 1 minute, and 57 seconds west");
+ if (@available(iOS 9.0, *)) {
+ XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees, 54 minutes, and 48 seconds north by 77 degrees, 1 minute, and 57 seconds west");
+ } else {
+ // Foundation in iOS 8 does not know how to pluralize coordinates.
+ XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degree(s), 54 minute(s), and 48 second(s) north by 77 degree(s), 1 minute(s), and 57 second(s) west");
+ }
shortFormatter.allowsSeconds = NO;
mediumFormatter.allowsSeconds = NO;
@@ -33,7 +38,12 @@
coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239);
XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"38°55′N, 77°2′W");
XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"38°55′ north, 77°2′ west");
- XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees and 55 minutes north by 77 degrees and 2 minutes west");
+ if (@available(iOS 9.0, *)) {
+ XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degrees and 55 minutes north by 77 degrees and 2 minutes west");
+ } else {
+ // Foundation in iOS 8 does not know how to pluralize coordinates.
+ XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"38 degree(s) and 55 minute(s) north by 77 degree(s) and 2 minute(s) west");
+ }
shortFormatter.allowsMinutes = NO;
mediumFormatter.allowsMinutes = NO;
@@ -42,7 +52,12 @@
coordinate = CLLocationCoordinate2DMake(38.9131982, -77.0325453144239);
XCTAssertEqualObjects([shortFormatter stringFromCoordinate:coordinate], @"39°N, 77°W");
XCTAssertEqualObjects([mediumFormatter stringFromCoordinate:coordinate], @"39° north, 77° west");
- XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degrees north by 77 degrees west");
+ if (@available(iOS 9.0, *)) {
+ XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degrees north by 77 degrees west");
+ } else {
+ // Foundation in iOS 8 does not know how to pluralize coordinates.
+ XCTAssertEqualObjects([longFormatter stringFromCoordinate:coordinate], @"39 degree(s) north by 77 degree(s) west");
+ }
}
@end