Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Adds failing tests for #10771 and #11143
Browse files Browse the repository at this point in the history
Unfortunately a brief spin of the run loop is required for the layer reuse test. I've tried to tune this down for my machine; YMMV
  • Loading branch information
Andrew Kitchen committed Feb 23, 2018
1 parent dfb9b26 commit 48918fa
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions platform/ios/Integration Tests/MBGLIntegrationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,34 @@ - (void)testAddingRemovingOpenGLLayer {
addRemoveGLLayer();
}

//- (void)testOpenGLLayerDoesNotLeakWhenCreatedAndDestroyedWithoutAddingToStyle {
// XCTFail(@"Not yet implemented");
//}
- (void)testReusingOpenGLLayer {
NSTimeInterval waitInterval = 0.01;

MGLOpenGLStyleLayer *layer = [[MGLOpenGLStyleLayer alloc] initWithIdentifier:@"gl-layer"];
[self.style insertLayer:layer atIndex:0];

[[NSRunLoop currentRunLoop] runUntilDate:[[NSDate date] dateByAddingTimeInterval:waitInterval]];

[self.style removeLayer:layer];

[[NSRunLoop currentRunLoop] runUntilDate:[[NSDate date] dateByAddingTimeInterval:waitInterval]];

[self.style insertLayer:layer atIndex:0];

[[NSRunLoop currentRunLoop] runUntilDate:[[NSDate date] dateByAddingTimeInterval:waitInterval]];

[self.style removeLayer:layer];

[[NSRunLoop currentRunLoop] runUntilDate:[[NSDate date] dateByAddingTimeInterval:waitInterval]];
}

// This test does not strictly need to be in this test file/target. Including here for convenience.
- (void)testOpenGLLayerDoesNotLeakWhenCreatedAndDestroyedWithoutAddingToStyle {
MGLOpenGLStyleLayer *layer = [[MGLOpenGLStyleLayer alloc] initWithIdentifier:@"gl-layer"];
__weak id weakLayer = layer;
layer = nil;

XCTAssertNil(weakLayer);
}

@end

0 comments on commit 48918fa

Please sign in to comment.