Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] remove location delegate test to improve reliability #3581

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions test/ios/MapViewTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,6 @@ - (void)beforeEach {
tester.mapView.delegate = self;
}

- (void)approveLocationIfNeeded {
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) {
[UIAutomationHelper acknowledgeSystemAlert];
[tester waitForTimeInterval:1];
}
XCTAssertTrue([CLLocationManager locationServicesEnabled]);
XCTAssertEqual([CLLocationManager authorizationStatus], kCLAuthorizationStatusAuthorizedAlways);
}

- (void)testDirectionSet {
[self waitForNotificationThatRegionDidChangeAnimatedWhileExecutingBlock:^{
[tester.mapView setDirection:270 animated:YES];
Expand Down Expand Up @@ -544,42 +535,4 @@ - (void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
userInfo:@{ @"animated" : @(animated) }];
}

- (void)testDelegatesStartStopLocatingUser {
NSNotification *notification = [system waitForNotificationName:@"mapViewWillStartLocatingUser"
object:tester.mapView
whileExecutingBlock:^{
tester.mapView.showsUserLocation = YES;
[self approveLocationIfNeeded];
}];

XCTAssertEqualObjects(notification.name,
@"mapViewWillStartLocatingUser",
@"mapViewWillStartLocatingUser delegate should receive message");
XCTAssertNotNil([tester.mapView valueForKeyPath:@"locationManager"],
"map view location manager should not be nil");

notification = [system waitForNotificationName:@"mapViewDidStopLocatingUser"
object:tester.mapView
whileExecutingBlock:^{
tester.mapView.showsUserLocation = NO;
}];

XCTAssertEqualObjects(notification.name,
@"mapViewDidStopLocatingUser",
@"mapViewDidStopLocatingUser delegate should receive message");
XCTAssertEqual(tester.mapView.userTrackingMode,
MGLUserTrackingModeNone,
@"user tracking mode should be none");
XCTAssertNil([tester.mapView valueForKeyPath:@"locationManager"],
"map view location manager should be nil");
}

- (void)mapViewWillStartLocatingUser:(MGLMapView *)mapView {
[[NSNotificationCenter defaultCenter] postNotificationName:@"mapViewWillStartLocatingUser" object:mapView];
}

- (void)mapViewDidStopLocatingUser:(MGLMapView *)mapView {
[[NSNotificationCenter defaultCenter] postNotificationName:@"mapViewDidStopLocatingUser" object:mapView];
}

@end