diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-04-27 16:01:07 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-05-05 01:07:29 -0700 |
commit | 3bf2e8839b31b3905036b1b20ccefdf1a0632d4b (patch) | |
tree | 97f2cd2803c8556f786d65a58e3b28f29892d9b5 | |
parent | 134cab9190573d26bad27d45a548903b3dd01d42 (diff) | |
download | qtlocation-mapboxgl-3bf2e8839b31b3905036b1b20ccefdf1a0632d4b.tar.gz |
[ios] Wait to tap user dot until it is centered
-rw-r--r-- | platform/ios/uitest/MGLUserLocationTests.m | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/platform/ios/uitest/MGLUserLocationTests.m b/platform/ios/uitest/MGLUserLocationTests.m index ccc6a0d023..4a833ad0c6 100644 --- a/platform/ios/uitest/MGLUserLocationTests.m +++ b/platform/ios/uitest/MGLUserLocationTests.m @@ -10,6 +10,7 @@ XCUIApplication *app = [[XCUIApplication alloc] init]; NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == YES"]; NSPredicate *isAbsent = [NSPredicate predicateWithFormat:@"exists == NO"]; + NSPredicate *hittable = [NSPredicate predicateWithFormat:@"hittable == YES"]; XCUIElement *userLocationAnnotationElement = app.buttons[@"MGLUserLocationAnnotationView"]; XCTAssertFalse(userLocationAnnotationElement.exists, @"User dot should be hidden by default."); @@ -18,11 +19,16 @@ XCTAssertEqualObjects(userTrackingModeElement.value, @"Off", @"User tracking mode should be off by default."); // Change to user location tracking mode. - [self expectationForPredicate:exists evaluatedWithObject:userLocationAnnotationElement handler:nil]; + [self expectationForPredicate:hittable evaluatedWithObject:userLocationAnnotationElement handler:nil]; + __block CGRect userDotAnnotationFrame; + [self expectationForPredicate:[NSPredicate predicateWithBlock:^BOOL(id _Nonnull evaluatedObject, NSDictionary<NSString *,id> * _Nullable bindings) { + // The user dot happens to lie underneath the Settings button until it is shown. + userDotAnnotationFrame = userLocationAnnotationElement.frame; + return CGRectContainsPoint(userDotAnnotationFrame, CGPointMake(190, 368)); + }] evaluatedWithObject:userLocationAnnotationElement handler:nil]; [userTrackingModeElement tap]; XCTAssertEqualObjects(userTrackingModeElement.value, @"Follow location", @"User location tracking mode should be on after tapping the user tracking mode button."); [self waitForExpectationsWithTimeout:3 handler:nil]; - CGRect userDotAnnotationFrame = userLocationAnnotationElement.frame; // Open the user dot’s callout view. XCUIElement *titleText = app.staticTexts[@"You Are Here"]; |