diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2016-04-26 18:09:32 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2016-05-05 01:07:29 -0700 |
commit | 94cf711f4b443d9de505774241ec88b5ce2cfdab (patch) | |
tree | 8d2648e4b67fb7a880a9002d7407291a819f9c4f | |
parent | f4ce3e272897b293a62ce8b301061e10ee809691 (diff) | |
download | qtlocation-mapboxgl-94cf711f4b443d9de505774241ec88b5ce2cfdab.tar.gz |
[ios] Speed up UI tests
During UI tests, disable UI tests and skip state restoration so we don’t have to reset the position for each test.
-rw-r--r-- | platform/ios/app/MBXAppDelegate.m | 5 | ||||
-rw-r--r-- | platform/ios/app/MBXViewController.m | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/platform/ios/app/MBXAppDelegate.m b/platform/ios/app/MBXAppDelegate.m index c2834bfa7f..8837476d2f 100644 --- a/platform/ios/app/MBXAppDelegate.m +++ b/platform/ios/app/MBXAppDelegate.m @@ -22,6 +22,11 @@ NSString * const MBXMapboxAccessTokenDefaultsKey = @"MBXMapboxAccessToken"; } [MGLAccountManager setAccessToken:accessToken]; } + + // Speed things up if we’re being run by a UI test bundle. + if ([[[NSProcessInfo processInfo] environment][@"MAPBOX_DISABLE_ANIMATIONS"] boolValue]) { + [UIView setAnimationsEnabled:NO]; + } return YES; } diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index a0fe6b22bf..34ba07470a 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -136,6 +136,10 @@ static const struct { - (void)restoreState:(__unused NSNotification *)notification { + if ([[[NSProcessInfo processInfo] environment][@"MAPBOX_CLEAN_START"] boolValue]) { + return; + } + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSData *archivedCamera = [defaults objectForKey:@"MBXCamera"]; MGLMapCamera *camera = archivedCamera ? [NSKeyedUnarchiver unarchiveObjectWithData:archivedCamera] : nil; |