blob: 55754cfc715db4909e2914639965a0c45486334d (
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
|
#import "MGLMapViewIntegrationTest.h"
@interface MGLStyleLoadingIntegrationTests : MGLMapViewIntegrationTest
@property (nonatomic) XCTestExpectation *styleLoadingExpectation;
@end
@implementation MGLStyleLoadingIntegrationTests
- (void)setUp {
[super setUp];
self.mapView = [[MBXTestMapView alloc] initWithFrame:UIScreen.mainScreen.bounds];
self.mapView.delegate = self;
if (!self.mapView.style) {
[self waitForMapViewToFinishLoadingStyleWithTimeout:10];
}
}
- (void)tearDown {
self.styleLoadingExpectation = nil;
}
- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
XCTAssertNotNil(mapView.style);
XCTAssertEqual(mapView.style, style);
[self.styleLoadingExpectation fulfill];
}
- (void)waitForMapViewToFinishLoadingStyleWithTimeout:(NSTimeInterval)timeout {
XCTAssertNil(self.styleLoadingExpectation);
self.styleLoadingExpectation = [self expectationWithDescription:@"Map view should finish loading style."];
[self waitForExpectations:@[self.styleLoadingExpectation] timeout:timeout];
}
- (MGLStyle *)style {
return self.mapView.style;
}
@end
|