diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-11-20 01:28:01 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-02-18 14:14:09 -0800 |
commit | d790132eda070c652b1d3a6ac44dc5d7e66335f4 (patch) | |
tree | 9536dbea1399cc9bb0e0a1f22609f1da51896d61 /platform/ios/uitest | |
parent | 28ad35fc0461aa89b490e3b187fca5374f18596d (diff) | |
download | qtlocation-mapboxgl-d790132eda070c652b1d3a6ac44dc5d7e66335f4.tar.gz |
[ios, macos] Short-circuit redundant camera changes
Avoid canceling transitions (and triggering preexisting completion handlers) until we get a chance to ensure that a new transition really does have to begin. Consistently avoid mbgl transitions for redundant camera changes. Upon bailing, schedule the completion handler to run asynchronously on a delay equivalent to the requested animation duration.
Added a “functional” equality method to MGLMapCamera that avoids trivial differences.
Fixed invocations of XCTAssertEqualWithAccuracy() that incorrectly expressed the accuracy as a number of digits rather than a scalar tolerance.
Diffstat (limited to 'platform/ios/uitest')
-rw-r--r-- | platform/ios/uitest/MapViewTests.m | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/platform/ios/uitest/MapViewTests.m b/platform/ios/uitest/MapViewTests.m index 21310b47a6..779107bc01 100644 --- a/platform/ios/uitest/MapViewTests.m +++ b/platform/ios/uitest/MapViewTests.m @@ -320,6 +320,23 @@ @"setting zoom should take effect"); } +- (void)testCameraDebouncing { + MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:CLLocationCoordinate2DMake(45, -122) + fromDistance:100 + pitch:30 + heading:45]; + tester.mapView.camera = camera; + XCTAssertEqualObjects(tester.mapView.camera, camera); + + [tester.mapView setCamera:camera withDuration:10 animationTimingFunction:nil completionHandler:^{ + XCTAssert(NO, @"Camera animation should not be canceled by redundantly setting the camera to the current camera."); + }]; + XCTAssertEqualObjects(tester.mapView.camera, camera); + + tester.mapView.camera = camera; + XCTAssertEqualObjects(tester.mapView.camera, camera); +} + - (void)testMarkerSelection { CGPoint point = CGPointMake(100, 100); MGLPointAnnotation *marker = [MGLPointAnnotation new]; |