aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2019-05-31 10:23:53 -0700
committerjmkiley <jordan.kiley@mapbox.com>2019-06-03 11:21:00 -0700
commit1740cc370393af609035ffcff54184984a295a2a (patch)
treef0f238a37e098a5da0febe289d3504b93df2e8fe
parent370b52f8a210639a239ccd1eb93e57904ef1ccd6 (diff)
[ios] added measureBlock, cleaned up file
-rw-r--r--platform/ios/Integration Tests/MGLTabBarControllerTests.m69
1 files changed, 27 insertions, 42 deletions
diff --git a/platform/ios/Integration Tests/MGLTabBarControllerTests.m b/platform/ios/Integration Tests/MGLTabBarControllerTests.m
index 73d949e54..4b6180d09 100644
--- a/platform/ios/Integration Tests/MGLTabBarControllerTests.m
+++ b/platform/ios/Integration Tests/MGLTabBarControllerTests.m
@@ -7,15 +7,13 @@
- (void)setUp {
[super setUp];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"IntegrationTest" bundle:[NSBundle mainBundle]];
-// [MGLAccountManager setAccessToken:@"pk.eyJ1Ijoiam9yZGFua2lsZXkiLCJhIjoiY2o1c3V0dG53MWJqczJxcGxmcXF5bGpmZyJ9.jgslVC7xNSQ2Rxayio_9Iw"];
- // Keep an eye on how well this plays with other tests that use other root view controllers.
[self.window setRootViewController:(UITabBarController *)[storyboard instantiateViewControllerWithIdentifier:@"TabController"]];
self.tabController = (UITabBarController *)self.window.rootViewController;
self.viewController = self.tabController.childViewControllers[0];
-
+
[self.viewController.view addSubview:self.mapView];
-
+
MGLPointAnnotation *annot = [[MGLPointAnnotation alloc] init];
annot.coordinate = self.mapView.centerCoordinate;
[self.mapView addAnnotation:annot];
@@ -28,54 +26,41 @@
- (void)testSwitchingTabs {
XCTestExpectation *expectation = [self expectationWithDescription:@"Able to switch the tabs repeatedly without lag"];
- // TODO: Add animated map transition, or call setNeedGLDisplay if animation
- __block NSInteger counter = 0;
+ __block NSInteger counter = 0;
+
+ __block NSTimer *repeatingTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 repeats:YES block:^(NSTimer * _Nonnull timer) {
- __block NSTimer *repeatingTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 repeats:YES block:^(NSTimer * _Nonnull timer) {
+ counter++;
+ NSLog(@"%li", counter);
+ self.tabController.selectedIndex = counter % 2;
+ if (counter > 41) {
- counter++;
- NSLog(@"%li", counter);
- self.tabController.selectedIndex = counter % 2;
- if (counter > 41) {
- // time call to updateDisplayLink to see if it takes longer that
-
- // subclass MGLMapView
- [repeatingTimer invalidate];
- repeatingTimer = nil;
-
- MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:CLLocationCoordinate2DMake(10, 10) altitude:100 pitch:0 heading:0];
- [self.mapView flyToCamera:camera withDuration:4 completionHandler:^{
- [expectation fulfill];
- }];
-
- // I get an exception here because it is called multiple times
-// [self measureBlock:^{
-// [self measureMetrics:@[XCTPerformanceMetric_WallClockTime] automaticallyStartMeasuring:NO forBlock:^{
-// [self startMeasuring];
-// [self.mapView updateFromDisplayLink:nil];
-
-// [self stopMeasuring];
-// }];
- }
- }];
-
+ [repeatingTimer invalidate];
+ repeatingTimer = nil;
+
+ MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:CLLocationCoordinate2DMake(10, 10) altitude:100 pitch:0 heading:0];
+ [self.mapView flyToCamera:camera withDuration:4 completionHandler:^{
+ [expectation fulfill];
+ }];
+
+ // Need to check
+ [self measureBlock:^{
+ [self.mapView updateFromDisplayLink:nil];
+ }];
+ }
+ }];
[self waitForExpectations:@[expectation] timeout:10];
-
-}
-
-- (void)switchTabsRepeatedly {
-
}
- (MGLAnnotationView *)mapView:(MGLMapView *)mapView viewForAnnotation:(id <MGLAnnotation>)annotation {
-
+
MGLAnnotationView *annotView = [mapView dequeueReusableAnnotationViewWithIdentifier:@"annot-view"];
- if (!annotView) {
- annotView = [[MGLAnnotationView alloc] initWithReuseIdentifier:@"annot-view"];
+ if (!annotView) {
+ annotView = [[MGLAnnotationView alloc] initWithReuseIdentifier:@"annot-view"];
annotView.frame = CGRectMake(0, 0, 10, 10);
}
-
+
return annotView;
}