summaryrefslogtreecommitdiff
path: root/test/ios
diff options
context:
space:
mode:
authorAdam Hunter <adam@mapbox.com>2015-09-14 12:02:35 -0700
committerAdam Hunter <adam@mapbox.com>2015-09-15 17:45:22 -0700
commitc9b14125d826d2f9990f1366d13823b8714ee4d8 (patch)
treef1d3f7fb410b7b8817d355f8954d30db396c0bd9 /test/ios
parent765f884ac96c149af3c8e7c11f011bfe9c51b6eb (diff)
downloadqtlocation-mapboxgl-c9b14125d826d2f9990f1366d13823b8714ee4d8.tar.gz
Add test that setting the center coordinate cancels animations
Diffstat (limited to 'test/ios')
-rw-r--r--test/ios/MapViewTests.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m
index 98636d1a90..516ff1df84 100644
--- a/test/ios/MapViewTests.m
+++ b/test/ios/MapViewTests.m
@@ -220,6 +220,26 @@
@"panning map right should decrease center longitude");
}
+- (void)testSetCenterCancelsTransitions {
+ CLLocationCoordinate2D dc = CLLocationCoordinate2DMake(38.894368, -77.036487);
+ CLLocationCoordinate2D dc_west = CLLocationCoordinate2DMake(38.894368, -77.076487);
+ [tester.mapView setCenterCoordinate:dc animated:NO];
+ [tester.mapView setCenterCoordinate:dc_west animated:YES];
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.15 * NSEC_PER_SEC),
+ dispatch_get_main_queue(),
+ ^{
+ [tester.mapView setCenterCoordinate:dc animated:NO];
+ XCTAssertEqualWithAccuracy(dc.latitude,
+ tester.mapView.centerCoordinate.latitude,
+ 0.0005,
+ @"setting center coordinate should cancel transitions");
+ XCTAssertEqualWithAccuracy(dc.longitude,
+ tester.mapView.centerCoordinate.longitude,
+ 0.0005,
+ @"setting center coordinate should cancel transitions");
+ });
+}
+
- (void)testPanDisabled {
tester.mapView.scrollEnabled = NO;
CLLocationCoordinate2D centerCoordinate = tester.mapView.centerCoordinate;