summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAntonio Zugaldia <antonio@silicalabs.com>2015-09-16 09:29:53 -0400
committerAntonio Zugaldia <antonio@silicalabs.com>2015-09-16 09:29:53 -0400
commit99053f47f7a407f3e0a6fbdede5627366349f680 (patch)
tree22f35a12da06d2c66480903c740c0d85f9a8eccb /test
parent97d53be25eaec4d4ee434d2a44ec7ca1cb2b6d0a (diff)
downloadqtlocation-mapboxgl-99053f47f7a407f3e0a6fbdede5627366349f680.tar.gz
merge with master
Diffstat (limited to 'test')
-rw-r--r--test/ios/MapViewTests.m27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m
index 98636d1a90..d0913670c5 100644
--- a/test/ios/MapViewTests.m
+++ b/test/ios/MapViewTests.m
@@ -220,6 +220,33 @@
@"panning map right should decrease center longitude");
}
+- (void)testSetCenterCancelsTransitions {
+ XCTestExpectation *cameraIsInDCExpectation = [self expectationWithDescription:@"camera reset to DC"];
+
+ 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");
+ [cameraIsInDCExpectation fulfill];
+ });
+
+ [self waitForExpectationsWithTimeout:1.0 handler:^(NSError *error) {
+ ;
+ }];
+}
+
- (void)testPanDisabled {
tester.mapView.scrollEnabled = NO;
CLLocationCoordinate2D centerCoordinate = tester.mapView.centerCoordinate;