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

Commit

Permalink
[ios] remove location delegate test to improve reliability
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbunny committed Jan 15, 2016
1 parent a88e58e commit 60dd429
Showing 1 changed file with 0 additions and 47 deletions.
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

0 comments on commit 60dd429

Please sign in to comment.