summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kitchen <andrew.kitchen@mapbox.com>2018-02-22 19:02:08 -0800
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2018-03-29 17:22:34 -0700
commit30ecd0cbdb0ea301aa6c894d84a234d07d1c3231 (patch)
tree51b1b274ed5b25f00128e75a8186ec79d226c871
parent23ccfce1765588511ce5055e20994894c6b2251e (diff)
downloadqtlocation-mapboxgl-30ecd0cbdb0ea301aa6c894d84a234d07d1c3231.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.m32
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