diff options
author | Andrew Kitchen <andrew.kitchen@mapbox.com> | 2018-02-22 19:02:08 -0800 |
---|---|---|
committer | Andrew Kitchen <andrew.kitchen@mapbox.com> | 2018-02-22 19:02:08 -0800 |
commit | 48918fae8ba3f2ed216a68a5d41d4dedafbddc09 (patch) | |
tree | df8013e683c286ef8eca78c7bc6939122bc2855a | |
parent | dfb9b26e675a152a925fcc5b84c3e14b8b9779d2 (diff) | |
download | qtlocation-mapboxgl-48918fae8ba3f2ed216a68a5d41d4dedafbddc09.tar.gz |
Adds failing tests for #10771 and #11143
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
-rw-r--r-- | platform/ios/Integration Tests/MBGLIntegrationTests.m | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/platform/ios/Integration Tests/MBGLIntegrationTests.m b/platform/ios/Integration Tests/MBGLIntegrationTests.m index db6cc13930..deb362cd64 100644 --- a/platform/ios/Integration Tests/MBGLIntegrationTests.m +++ b/platform/ios/Integration Tests/MBGLIntegrationTests.m @@ -70,8 +70,34 @@ 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 |