summaryrefslogtreecommitdiff
path: root/platform/ios/Integration Test Harness/MGLTestHarnessViewController.m
blob: d37c0039fbf922f7cb890650ad4a32465ed07d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#import "Mapbox.h"
#import "MGLMapViewDelegate.h"

#import "MGLTestHarnessViewController.h"
#import "MGLTestingSupport.h"

@interface MGLTestHarnessViewController ()<MGLMapViewDelegate>

@property (nonatomic) MGLMapView *mapView;

@end

@implementation MGLTestHarnessViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.mapView = [[MGLMapView alloc] initWithFrame:self.view.bounds];
    
    self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    self.mapView.accessibilityIdentifier = MGLTestingSupportMapViewID;
    [self.mapView setCenterCoordinate:CLLocationCoordinate2DMake(31, -100) zoomLevel:3 animated:NO];
    self.mapView.delegate = self;
    
    [self.view addSubview:self.mapView];
}


#pragma mark - mapview delgate handles

- (void)mapViewDidFinishRenderingMap:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered {
    testingSupportPostNotification(MGLTestingSupportNotificationMapViewRendered);
}

- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
    testingSupportPostNotification(MGLTestingSupportNotificationMapViewStyleLoaded);
}

- (void)mapView:(MGLMapView *)mapView regionWillChangeAnimated:(BOOL)animated {
    testingSupportPostNotification(MGLTestingSupportNotificationMapViewRegionWillChange);
}

- (void)mapView:(MGLMapView *)mapView regionIsChangingWithReason:(MGLCameraChangeReason)reason {
    testingSupportPostNotification(MGLTestingSupportNotificationMapViewRegionIsChanging);
}

- (void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
    testingSupportPostNotification(MGLTestingSupportNotificationMapViewRegionDidChanged);
}


@end