diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-01-11 15:30:55 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-11 15:30:55 -0800 |
commit | 57644b2804a3d27ff19a58e0f3015d83264833ab (patch) | |
tree | 0e321aee1226f85b6c4f70a03a5437021ea1c543 | |
parent | 71a5453690988970d46fe886f295b5a19f3ec206 (diff) | |
download | qtlocation-mapboxgl-57644b2804a3d27ff19a58e0f3015d83264833ab.tar.gz |
[macos] Run style layer tests headlessly (#7684)
* [macos] Run style layer tests headlessly
* [ios, macos] How about a manual expectation?
-rw-r--r-- | platform/darwin/test/MGLStyleLayerTests.m | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/platform/darwin/test/MGLStyleLayerTests.m b/platform/darwin/test/MGLStyleLayerTests.m index e9ac0794a7..11ca54022f 100644 --- a/platform/darwin/test/MGLStyleLayerTests.m +++ b/platform/darwin/test/MGLStyleLayerTests.m @@ -4,7 +4,9 @@ #define TEST_STRICT_NAMING_CONVENTIONS 0 -@implementation MGLStyleLayerTests +@implementation MGLStyleLayerTests { + XCTestExpectation *_styleLoadingExpectation; +} @dynamic layerType; @@ -20,21 +22,24 @@ _mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 256, 256) styleURL:styleURL]; [vc.view addSubview:_mapView]; #else - NSWindowController *windowController = [[NSWindowController alloc] initWithWindowNibName:@"MGLStyleLayerTests" owner:self]; - NSView *contentView = windowController.window.contentView; - _mapView = [[MGLMapView alloc] initWithFrame:contentView.bounds styleURL:styleURL]; - [contentView addSubview:_mapView]; - [windowController showWindow:nil]; + _mapView = [[MGLMapView alloc] initWithFrame:NSMakeRect(0, 0, 256, 256) styleURL:styleURL]; #endif _mapView.delegate = self; XCTAssertNil(_mapView.style); - [self keyValueObservingExpectationForObject:self.mapView keyPath:@"style" handler:^BOOL(MGLMapView * _Nonnull observedMapView, NSDictionary * _Nonnull change) { - return observedMapView.style != nil; - }]; + _styleLoadingExpectation = [self expectationWithDescription:@"Map view should finish loading style."]; [self waitForExpectationsWithTimeout:1 handler:nil]; } +- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style { + XCTAssertNotNil(mapView.style); + XCTAssertEqual(mapView.style, style); + XCTAssertNil(style.name); + + [_styleLoadingExpectation fulfill]; +} + - (void)tearDown { + _styleLoadingExpectation = nil; _mapView = nil; [super tearDown]; |