summaryrefslogtreecommitdiff
path: root/platform/darwin
diff options
context:
space:
mode:
authorAndrew Kitchen <andrew.kitchen@mapbox.com>2018-01-03 17:16:30 -0800
committerAndrew Kitchen <akitchen@gmail.com>2018-01-19 20:28:57 -0500
commit2c48871c065c6efec42c5660c9560ecdfaa8d359 (patch)
tree4a04691c5de64c101146c68c47a429eaddc24e44 /platform/darwin
parent40a0b2deb78ac3b03dc4966797edb8e0dc8a415e (diff)
downloadqtlocation-mapboxgl-2c48871c065c6efec42c5660c9560ecdfaa8d359.tar.gz
Adds an integration test harness to the iOS project
This will allow us to write lightweight integration tests between MGLMapView and the core renderer. Also includes a test for the recent custom layer memory fix, reverting the fix in order to demonstrate the failing test.
Diffstat (limited to 'platform/darwin')
-rw-r--r--platform/darwin/src/MGLOpenGLStyleLayer.mm9
-rw-r--r--platform/darwin/src/MGLStyle.mm4
-rw-r--r--platform/darwin/src/MGLStyle_Private.h3
3 files changed, 14 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLOpenGLStyleLayer.mm b/platform/darwin/src/MGLOpenGLStyleLayer.mm
index 8933a77382..2bc76c9912 100644
--- a/platform/darwin/src/MGLOpenGLStyleLayer.mm
+++ b/platform/darwin/src/MGLOpenGLStyleLayer.mm
@@ -47,7 +47,8 @@ void MGLDrawCustomStyleLayer(void *context, const mbgl::style::CustomLayerRender
when creating an OpenGL style layer.
*/
void MGLFinishCustomStyleLayer(void *context) {
- MGLOpenGLStyleLayer *layer = (__bridge_transfer MGLOpenGLStyleLayer *)context;
+ //TODO: AK: revert once failing test established
+ MGLOpenGLStyleLayer *layer = (__bridge MGLOpenGLStyleLayer *)context;
[layer willMoveFromMapView:layer.style.mapView];
}
@@ -101,7 +102,8 @@ void MGLFinishCustomStyleLayer(void *context) {
MGLPrepareCustomStyleLayer,
MGLDrawCustomStyleLayer,
MGLFinishCustomStyleLayer,
- (__bridge_retained void *)self);
+ //TODO: AK: revert once failing test established
+ (__bridge void *)self);
return self = [super initWithPendingLayer:std::move(layer)];
}
@@ -116,7 +118,10 @@ void MGLFinishCustomStyleLayer(void *context) {
[NSException raise:@"MGLLayerReuseException"
format:@"%@ cannot be added to more than one MGLStyle at a time.", self];
}
+ //TODO: AK: remove once failing test established
+ _style.openGLLayers[self.identifier] = nil;
_style = style;
+ _style.openGLLayers[self.identifier] = self;
}
- (void)addToStyle:(MGLStyle *)style belowLayer:(MGLStyleLayer *)otherLayer {
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index 5221e838f8..50d8abf72b 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -77,6 +77,8 @@
@property (nonatomic, readonly, weak) MGLMapView *mapView;
@property (nonatomic, readonly) mbgl::style::Style *rawStyle;
@property (readonly, copy, nullable) NSURL *URL;
+//TODO: AK: remove once failing test established
+@property (nonatomic, readwrite, strong) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLOpenGLStyleLayer *) *openGLLayers;
@property (nonatomic) NS_MUTABLE_DICTIONARY_OF(NSString *, NS_DICTIONARY_OF(NSObject *, MGLTextLanguage *) *) *localizedLayersByIdentifier;
@end
@@ -168,6 +170,8 @@ static NSURL *MGLStyleURL_trafficNight;
if (self = [super init]) {
_mapView = mapView;
_rawStyle = rawStyle;
+ //TODO: AK: remove once failing test established
+ _openGLLayers = [NSMutableDictionary dictionary];
_localizedLayersByIdentifier = [NSMutableDictionary dictionary];
}
return self;
diff --git a/platform/darwin/src/MGLStyle_Private.h b/platform/darwin/src/MGLStyle_Private.h
index 4cbe953a44..16035241f8 100644
--- a/platform/darwin/src/MGLStyle_Private.h
+++ b/platform/darwin/src/MGLStyle_Private.h
@@ -26,6 +26,9 @@ namespace mbgl {
- (nullable NS_ARRAY_OF(MGLAttributionInfo *) *)attributionInfosWithFontSize:(CGFloat)fontSize linkColor:(nullable MGLColor *)linkColor;
+//TODO: AK: remove once failing test established
+@property (nonatomic, readonly, strong) NS_MUTABLE_DICTIONARY_OF(NSString *, MGLOpenGLStyleLayer *) *openGLLayers;
+
- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration;
@end