summaryrefslogtreecommitdiff
path: root/platform/darwin/test
diff options
context:
space:
mode:
authorFredrik Karlsson <bjorn.fredrik.karlsson@gmail.com>2016-08-11 13:14:45 -0400
committerGitHub <noreply@github.com>2016-08-11 13:14:45 -0400
commit2354c87411ce88c581e02f93445a66a2158bd7b0 (patch)
treea7deb9a3b1b0f24e2a876dedc13fbd1c6b22947e /platform/darwin/test
parentb0cb8715ed74678b4d0f05829fa71a590e41b2f6 (diff)
downloadqtlocation-mapboxgl-2354c87411ce88c581e02f93445a66a2158bd7b0.tar.gz
Runtime styling API for iOS/macOS (#5727)
* [ios] wip runtime styling * [ios, macos] Outlined header templates * [ios, macos] cleanup and use appropiate data types * [ios, macos] removed refs to mbgl and added convenient color methods on UIColor and NSColor * [ios, macos] updated header template, included doc string * [ios, macos] outlined template for layer implementation files * [ios, macos] moved script to platform/darwin and updated comments * [ios, macos] Cleaned up the implementation template * [ios, macos] removed unused function and added support for more datatypes * [ios, macos] overhauling the type protocols * [ios, macos] removed unnecessary style classes * [ios, macos] added support for more types * [ios, macos] fixed string and number prop values * [ios, macos] enum getters * [ios, macos] added removeLayer() and removed unused layer ref * [ios, macos] fixed remaining layer types and converted style layer into a protocol * [ios, macos] fixed addLayer() and added example for line layer * [ios] GeoJSON source now works * [ios] fixed raster layer and raster source * [ios] fixed attr prop number and outlined prop function * [ios] wip functions * [ios] bool and float function fix * [ios] cleanup * [macos] fixed support for macos * [ios] fixed string functions * [ios] extended array functions * [ios] added tests and fixed a few bugs * [ios] less verbose functions and improved tests * [ios, macos] Removed unnecessary use of default arguments Default arguments aren’t supported in Node v4, and they aren’t needed here anyways, because we’re only testing for truthiness. * [ios, macos] Enum setters Rely on a macro instead of category methods to specialize the setter implementation for enum attributes, since generic types are disallowed in Objective-C method signatures and mbgl::style::PropertyType must be type-qualified. * [ios, macos] Got macOS closer to parity w/ iOS Added various classes and test classes to the macOS workspace. Also fixed lots of compiler errors and updated macosapp runtime styling example to use the new dictionary syntax for function stops. Updated all conversions from Objective-C stops to C++ stops to enumerate over the dictionary. Fixed compiler errors in enum setter implementations. Also corrected path to script in generated file comments. * [ios, macos] Added EJS templates to project * [ios, macos] Code formatting Made code format more consistent. * [ios, macos] Spelled out ID Cocoa convention is to always spell out “ID” as “identifier”, in part to avoid confusion with the id keyword. Also, URL is capitalized in most contexts, including property names. * [ios, macos] Grouped related headers together * [ios, macos] Cleaned up layer transformation Also added support for converting background layers into Objective-C. * [ios, macos] Cleaned up tests Also made the tests work on macOS by introducing a new window to host the map. * [ios, macos] Replaced TODOs with #warnings * [ios] convert array based property values * [ios, macos] color function/undefined getter * [ios, macos] fixed function/undefined getters for bool and float properties * [ios, macos] more function/undefined property getters * [ios, macos] more type conversion and cleanup * [ios, macos] disable macos runtime styling tests for now * [ios, macos] cleaned up style code script * [ios, macos] more type conversion * [ios] added a base layer to handle visibility min/max zoom * [macos] fixed base layer * [ios, macos] use accessor methods * [ios, macos] cleanup * [ios, macos] add geojson to ios and macos * [macos] rebase fix * [ios, macos] fixed enum getters and added tests for enums * [ios, macos] added an update method to base layer * [ios, macos] added some documentation * [ios, macos] docs * [ios, macos] removed refs to filters for now * [ios, macos] various tail work * [ios, macos] missing import and incorrect type
Diffstat (limited to 'platform/darwin/test')
-rw-r--r--platform/darwin/test/MGLBackgroundStyleLayerTests.m29
-rw-r--r--platform/darwin/test/MGLCircleStyleLayerTests.m37
-rw-r--r--platform/darwin/test/MGLFillStyleLayerTests.m37
-rw-r--r--platform/darwin/test/MGLLineStyleLayerTests.m51
-rw-r--r--platform/darwin/test/MGLRasterStyleLayerTests.m37
-rw-r--r--platform/darwin/test/MGLRuntimeStylingHelper.h25
-rw-r--r--platform/darwin/test/MGLRuntimeStylingHelper.m56
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.h10
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.m21
-rw-r--r--platform/darwin/test/MGLSymbolStyleLayerTests.m119
10 files changed, 422 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLBackgroundStyleLayerTests.m b/platform/darwin/test/MGLBackgroundStyleLayerTests.m
new file mode 100644
index 0000000000..e36ca53022
--- /dev/null
+++ b/platform/darwin/test/MGLBackgroundStyleLayerTests.m
@@ -0,0 +1,29 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "MGLStyleLayerTests.h"
+
+@interface MGLBackgroundLayerTests : MGLStyleLayerTests
+@end
+
+@implementation MGLBackgroundLayerTests
+
+- (void)testBackgroundLayer {
+ NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
+ NSURL *url = [NSURL fileURLWithPath:filePath];
+ MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"sourceID" URL:url];
+ MGLBackgroundStyleLayer *layer = [[MGLBackgroundStyleLayer alloc] initWithLayerIdentifier:@"layerID" sourceIdentifier:@"sourceID"];
+ [self.mapView.style addSource:source];
+ [self.mapView.style addLayer:layer];
+
+ layer.backgroundColor = MGLRuntimeStylingHelper.testColor;
+ layer.backgroundPattern = MGLRuntimeStylingHelper.testString;
+ layer.backgroundOpacity = MGLRuntimeStylingHelper.testNumber;
+
+ MGLBackgroundStyleLayer *gLayer = [self.mapView.style layerWithIdentifier:@"layerID"];
+ XCTAssertEqualObjects(gLayer.backgroundColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.backgroundPattern, MGLRuntimeStylingHelper.testString);
+ XCTAssertEqualObjects(gLayer.backgroundOpacity, MGLRuntimeStylingHelper.testNumber);
+}
+
+@end
diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.m b/platform/darwin/test/MGLCircleStyleLayerTests.m
new file mode 100644
index 0000000000..f7ebcf822a
--- /dev/null
+++ b/platform/darwin/test/MGLCircleStyleLayerTests.m
@@ -0,0 +1,37 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "MGLStyleLayerTests.h"
+
+@interface MGLCircleLayerTests : MGLStyleLayerTests
+@end
+
+@implementation MGLCircleLayerTests
+
+- (void)testCircleLayer {
+ NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
+ NSURL *url = [NSURL fileURLWithPath:filePath];
+ MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"sourceID" URL:url];
+ MGLCircleStyleLayer *layer = [[MGLCircleStyleLayer alloc] initWithLayerIdentifier:@"layerID" sourceIdentifier:@"sourceID"];
+ [self.mapView.style addSource:source];
+ [self.mapView.style addLayer:layer];
+
+ layer.circleRadius = MGLRuntimeStylingHelper.testNumber;
+ layer.circleColor = MGLRuntimeStylingHelper.testColor;
+ layer.circleBlur = MGLRuntimeStylingHelper.testNumber;
+ layer.circleOpacity = MGLRuntimeStylingHelper.testNumber;
+ layer.circleTranslate = MGLRuntimeStylingHelper.testOffset;
+ layer.circleTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLCircleStyleLayerCircleTranslateAnchorViewport type:@encode(MGLCircleStyleLayerCircleTranslateAnchor)];
+ layer.circlePitchScale = [MGLRuntimeStylingHelper testEnum:MGLCircleStyleLayerCirclePitchScaleViewport type:@encode(MGLCircleStyleLayerCirclePitchScale)];
+
+ MGLCircleStyleLayer *gLayer = [self.mapView.style layerWithIdentifier:@"layerID"];
+ XCTAssertEqualObjects(gLayer.circleRadius, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.circleColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.circleBlur, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.circleOpacity, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.circleTranslate, MGLRuntimeStylingHelper.testOffset);
+ XCTAssert([(NSValue *)gLayer.circleTranslateAnchor objCType] == [[MGLRuntimeStylingHelper testEnum:MGLCircleStyleLayerCircleTranslateAnchorViewport type:@encode(MGLCircleStyleLayerCircleTranslateAnchor)] objCType]);
+ XCTAssert([(NSValue *)gLayer.circlePitchScale objCType] == [[MGLRuntimeStylingHelper testEnum:MGLCircleStyleLayerCirclePitchScaleViewport type:@encode(MGLCircleStyleLayerCirclePitchScale)] objCType]);
+}
+
+@end
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.m b/platform/darwin/test/MGLFillStyleLayerTests.m
new file mode 100644
index 0000000000..5a03d96354
--- /dev/null
+++ b/platform/darwin/test/MGLFillStyleLayerTests.m
@@ -0,0 +1,37 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "MGLStyleLayerTests.h"
+
+@interface MGLFillLayerTests : MGLStyleLayerTests
+@end
+
+@implementation MGLFillLayerTests
+
+- (void)testFillLayer {
+ NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
+ NSURL *url = [NSURL fileURLWithPath:filePath];
+ MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"sourceID" URL:url];
+ MGLFillStyleLayer *layer = [[MGLFillStyleLayer alloc] initWithLayerIdentifier:@"layerID" sourceIdentifier:@"sourceID"];
+ [self.mapView.style addSource:source];
+ [self.mapView.style addLayer:layer];
+
+ layer.fillAntialias = MGLRuntimeStylingHelper.testBool;
+ layer.fillOpacity = MGLRuntimeStylingHelper.testNumber;
+ layer.fillColor = MGLRuntimeStylingHelper.testColor;
+ layer.fillOutlineColor = MGLRuntimeStylingHelper.testColor;
+ layer.fillTranslate = MGLRuntimeStylingHelper.testOffset;
+ layer.fillTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLFillStyleLayerFillTranslateAnchorViewport type:@encode(MGLFillStyleLayerFillTranslateAnchor)];
+ layer.fillPattern = MGLRuntimeStylingHelper.testString;
+
+ MGLFillStyleLayer *gLayer = [self.mapView.style layerWithIdentifier:@"layerID"];
+ XCTAssertEqualObjects(gLayer.fillAntialias, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.fillOpacity, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.fillColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.fillOutlineColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.fillTranslate, MGLRuntimeStylingHelper.testOffset);
+ XCTAssert([(NSValue *)gLayer.fillTranslateAnchor objCType] == [[MGLRuntimeStylingHelper testEnum:MGLFillStyleLayerFillTranslateAnchorViewport type:@encode(MGLFillStyleLayerFillTranslateAnchor)] objCType]);
+ XCTAssertEqualObjects(gLayer.fillPattern, MGLRuntimeStylingHelper.testString);
+}
+
+@end
diff --git a/platform/darwin/test/MGLLineStyleLayerTests.m b/platform/darwin/test/MGLLineStyleLayerTests.m
new file mode 100644
index 0000000000..0864c68ccd
--- /dev/null
+++ b/platform/darwin/test/MGLLineStyleLayerTests.m
@@ -0,0 +1,51 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "MGLStyleLayerTests.h"
+
+@interface MGLLineLayerTests : MGLStyleLayerTests
+@end
+
+@implementation MGLLineLayerTests
+
+- (void)testLineLayer {
+ NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
+ NSURL *url = [NSURL fileURLWithPath:filePath];
+ MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"sourceID" URL:url];
+ MGLLineStyleLayer *layer = [[MGLLineStyleLayer alloc] initWithLayerIdentifier:@"layerID" sourceIdentifier:@"sourceID"];
+ [self.mapView.style addSource:source];
+ [self.mapView.style addLayer:layer];
+
+ layer.lineCap = [MGLRuntimeStylingHelper testEnum:MGLLineStyleLayerLineCapSquare type:@encode(MGLLineStyleLayerLineCap)];
+ layer.lineJoin = [MGLRuntimeStylingHelper testEnum:MGLLineStyleLayerLineJoinMiter type:@encode(MGLLineStyleLayerLineJoin)];
+ layer.lineMiterLimit = MGLRuntimeStylingHelper.testNumber;
+ layer.lineRoundLimit = MGLRuntimeStylingHelper.testNumber;
+ layer.lineOpacity = MGLRuntimeStylingHelper.testNumber;
+ layer.lineColor = MGLRuntimeStylingHelper.testColor;
+ layer.lineTranslate = MGLRuntimeStylingHelper.testOffset;
+ layer.lineTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLLineStyleLayerLineTranslateAnchorViewport type:@encode(MGLLineStyleLayerLineTranslateAnchor)];
+ layer.lineWidth = MGLRuntimeStylingHelper.testNumber;
+ layer.lineGapWidth = MGLRuntimeStylingHelper.testNumber;
+ layer.lineOffset = MGLRuntimeStylingHelper.testNumber;
+ layer.lineBlur = MGLRuntimeStylingHelper.testNumber;
+ layer.lineDasharray = MGLRuntimeStylingHelper.testDashArray;
+ layer.linePattern = MGLRuntimeStylingHelper.testString;
+
+ MGLLineStyleLayer *gLayer = [self.mapView.style layerWithIdentifier:@"layerID"];
+ XCTAssert([(NSValue *)gLayer.lineCap objCType] == [[MGLRuntimeStylingHelper testEnum:MGLLineStyleLayerLineCapSquare type:@encode(MGLLineStyleLayerLineCap)] objCType]);
+ XCTAssert([(NSValue *)gLayer.lineJoin objCType] == [[MGLRuntimeStylingHelper testEnum:MGLLineStyleLayerLineJoinMiter type:@encode(MGLLineStyleLayerLineJoin)] objCType]);
+ XCTAssertEqualObjects(gLayer.lineMiterLimit, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.lineRoundLimit, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.lineOpacity, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.lineColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.lineTranslate, MGLRuntimeStylingHelper.testOffset);
+ XCTAssert([(NSValue *)gLayer.lineTranslateAnchor objCType] == [[MGLRuntimeStylingHelper testEnum:MGLLineStyleLayerLineTranslateAnchorViewport type:@encode(MGLLineStyleLayerLineTranslateAnchor)] objCType]);
+ XCTAssertEqualObjects(gLayer.lineWidth, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.lineGapWidth, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.lineOffset, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.lineBlur, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.lineDasharray, MGLRuntimeStylingHelper.testDashArray);
+ XCTAssertEqualObjects(gLayer.linePattern, MGLRuntimeStylingHelper.testString);
+}
+
+@end
diff --git a/platform/darwin/test/MGLRasterStyleLayerTests.m b/platform/darwin/test/MGLRasterStyleLayerTests.m
new file mode 100644
index 0000000000..6d5cd6293b
--- /dev/null
+++ b/platform/darwin/test/MGLRasterStyleLayerTests.m
@@ -0,0 +1,37 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "MGLStyleLayerTests.h"
+
+@interface MGLRasterLayerTests : MGLStyleLayerTests
+@end
+
+@implementation MGLRasterLayerTests
+
+- (void)testRasterLayer {
+ NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
+ NSURL *url = [NSURL fileURLWithPath:filePath];
+ MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"sourceID" URL:url];
+ MGLRasterStyleLayer *layer = [[MGLRasterStyleLayer alloc] initWithLayerIdentifier:@"layerID" sourceIdentifier:@"sourceID"];
+ [self.mapView.style addSource:source];
+ [self.mapView.style addLayer:layer];
+
+ layer.rasterOpacity = MGLRuntimeStylingHelper.testNumber;
+ layer.rasterHueRotate = MGLRuntimeStylingHelper.testNumber;
+ layer.rasterBrightnessMin = MGLRuntimeStylingHelper.testNumber;
+ layer.rasterBrightnessMax = MGLRuntimeStylingHelper.testNumber;
+ layer.rasterSaturation = MGLRuntimeStylingHelper.testNumber;
+ layer.rasterContrast = MGLRuntimeStylingHelper.testNumber;
+ layer.rasterFadeDuration = MGLRuntimeStylingHelper.testNumber;
+
+ MGLRasterStyleLayer *gLayer = [self.mapView.style layerWithIdentifier:@"layerID"];
+ XCTAssertEqualObjects(gLayer.rasterOpacity, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.rasterHueRotate, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.rasterBrightnessMin, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.rasterBrightnessMax, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.rasterSaturation, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.rasterContrast, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.rasterFadeDuration, MGLRuntimeStylingHelper.testNumber);
+}
+
+@end
diff --git a/platform/darwin/test/MGLRuntimeStylingHelper.h b/platform/darwin/test/MGLRuntimeStylingHelper.h
new file mode 100644
index 0000000000..fa1543ec47
--- /dev/null
+++ b/platform/darwin/test/MGLRuntimeStylingHelper.h
@@ -0,0 +1,25 @@
+#import <Foundation/Foundation.h>
+
+#import "MGLTypes.h"
+
+@interface MGLRuntimeStylingHelper : NSObject
+
++ (NSArray *)testPadding;
+
++ (NSArray *)testOffset;
+
++ (NSArray *)testFont;
+
++ (NSArray *)testDashArray;
+
++ (NSNumber *)testNumber;
+
++ (NSNumber *)testBool;
+
++ (NSString *)testString;
+
++ (MGLColor *)testColor;
+
++ (NSValue *)testEnum:(NSUInteger)value type:(const char *)type;
+
+@end
diff --git a/platform/darwin/test/MGLRuntimeStylingHelper.m b/platform/darwin/test/MGLRuntimeStylingHelper.m
new file mode 100644
index 0000000000..fbdc8e5225
--- /dev/null
+++ b/platform/darwin/test/MGLRuntimeStylingHelper.m
@@ -0,0 +1,56 @@
+#import "MGLRuntimeStylingHelper.h"
+
+#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
+#import <UIKit/UIKit.h>
+#else
+#import <Cocoa/Cocoa.h>
+#endif
+
+@implementation MGLRuntimeStylingHelper
+
++ (NSArray *)testPadding
+{
+ return @[@1.0f, @1.0f, @1.0f, @1.0f];
+}
+
++ (NSArray *)testOffset
+{
+ return @[@1.0f, @1.0f];
+}
+
++ (NSArray *)testFont
+{
+ return @[@"Open Sans Regular", @"Arial Unicode MS Regular"];
+}
+
++ (NSArray *)testDashArray
+{
+ return @[@1, @2];
+}
+
++ (NSNumber *)testNumber
+{
+ return @1;
+}
+
++ (NSNumber *)testBool
+{
+ return @YES;
+}
+
++ (NSString *)testString
+{
+ return @"test";
+}
+
++ (MGLColor *)testColor
+{
+ return [MGLColor redColor];
+}
+
++ (NSValue *)testEnum:(NSUInteger)value type:(const char *)type
+{
+ return [NSValue value:&value withObjCType:type];
+}
+
+@end
diff --git a/platform/darwin/test/MGLStyleLayerTests.h b/platform/darwin/test/MGLStyleLayerTests.h
new file mode 100644
index 0000000000..f81e075e03
--- /dev/null
+++ b/platform/darwin/test/MGLStyleLayerTests.h
@@ -0,0 +1,10 @@
+#import <Mapbox/Mapbox.h>
+#import "MGLRuntimeStylingHelper.h"
+#import <XCTest/XCTest.h>
+
+@interface MGLStyleLayerTests : XCTestCase <MGLMapViewDelegate>
+
+@property (nonatomic) IBOutlet MGLMapView *mapView;
+@property (nonatomic) XCTestExpectation *expectation;
+
+@end
diff --git a/platform/darwin/test/MGLStyleLayerTests.m b/platform/darwin/test/MGLStyleLayerTests.m
new file mode 100644
index 0000000000..ae0a59edd3
--- /dev/null
+++ b/platform/darwin/test/MGLStyleLayerTests.m
@@ -0,0 +1,21 @@
+#import "MGLStyleLayerTests.h"
+
+@implementation MGLStyleLayerTests
+
+- (void)setUp {
+ [super setUp];
+#if TARGET_OS_IPHONE
+ UIApplication *app = [[UIApplication sharedApplication] delegate];
+ UIViewController *vc = [[UIViewController alloc] init];
+ app.keyWindow.rootViewController = vc;
+ [vc view]; // Force load xib
+ _mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 256, 256)];
+ [vc.view addSubview:_mapView];
+ _mapView.delegate = self;
+#else
+ NSWindowController *windowController = [[NSWindowController alloc] initWithWindowNibName:@"MGLStyleLayerTests" owner:self];
+ [windowController showWindow:nil];
+#endif
+}
+
+@end
diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.m b/platform/darwin/test/MGLSymbolStyleLayerTests.m
new file mode 100644
index 0000000000..b8c3cdd77b
--- /dev/null
+++ b/platform/darwin/test/MGLSymbolStyleLayerTests.m
@@ -0,0 +1,119 @@
+// This file is generated.
+// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`.
+
+#import "MGLStyleLayerTests.h"
+
+@interface MGLSymbolLayerTests : MGLStyleLayerTests
+@end
+
+@implementation MGLSymbolLayerTests
+
+- (void)testSymbolLayer {
+ NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"];
+ NSURL *url = [NSURL fileURLWithPath:filePath];
+ MGLGeoJSONSource *source = [[MGLGeoJSONSource alloc] initWithSourceIdentifier:@"sourceID" URL:url];
+ MGLSymbolStyleLayer *layer = [[MGLSymbolStyleLayer alloc] initWithLayerIdentifier:@"layerID" sourceIdentifier:@"sourceID"];
+ [self.mapView.style addSource:source];
+ [self.mapView.style addLayer:layer];
+
+ layer.symbolPlacement = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerSymbolPlacementLine type:@encode(MGLSymbolStyleLayerSymbolPlacement)];
+ layer.symbolSpacing = MGLRuntimeStylingHelper.testNumber;
+ layer.symbolAvoidEdges = MGLRuntimeStylingHelper.testBool;
+ layer.iconAllowOverlap = MGLRuntimeStylingHelper.testBool;
+ layer.iconIgnorePlacement = MGLRuntimeStylingHelper.testBool;
+ layer.iconOptional = MGLRuntimeStylingHelper.testBool;
+ layer.iconRotationAlignment = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconRotationAlignmentViewport type:@encode(MGLSymbolStyleLayerIconRotationAlignment)];
+ layer.iconSize = MGLRuntimeStylingHelper.testNumber;
+ layer.iconTextFit = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitHeight type:@encode(MGLSymbolStyleLayerIconTextFit)];
+ layer.iconTextFitPadding = MGLRuntimeStylingHelper.testPadding;
+ layer.iconImage = MGLRuntimeStylingHelper.testString;
+ layer.iconRotate = MGLRuntimeStylingHelper.testNumber;
+ layer.iconPadding = MGLRuntimeStylingHelper.testNumber;
+ layer.iconKeepUpright = MGLRuntimeStylingHelper.testBool;
+ layer.iconOffset = MGLRuntimeStylingHelper.testOffset;
+ layer.textPitchAlignment = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextPitchAlignmentViewport type:@encode(MGLSymbolStyleLayerTextPitchAlignment)];
+ layer.textRotationAlignment = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextRotationAlignmentViewport type:@encode(MGLSymbolStyleLayerTextRotationAlignment)];
+ layer.textField = MGLRuntimeStylingHelper.testString;
+ layer.textFont = MGLRuntimeStylingHelper.testFont;
+ layer.textSize = MGLRuntimeStylingHelper.testNumber;
+ layer.textMaxWidth = MGLRuntimeStylingHelper.testNumber;
+ layer.textLineHeight = MGLRuntimeStylingHelper.testNumber;
+ layer.textLetterSpacing = MGLRuntimeStylingHelper.testNumber;
+ layer.textJustify = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextJustifyRight type:@encode(MGLSymbolStyleLayerTextJustify)];
+ layer.textAnchor = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextAnchorBottomRight type:@encode(MGLSymbolStyleLayerTextAnchor)];
+ layer.textMaxAngle = MGLRuntimeStylingHelper.testNumber;
+ layer.textRotate = MGLRuntimeStylingHelper.testNumber;
+ layer.textPadding = MGLRuntimeStylingHelper.testNumber;
+ layer.textKeepUpright = MGLRuntimeStylingHelper.testBool;
+ layer.textTransform = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextTransformLowercase type:@encode(MGLSymbolStyleLayerTextTransform)];
+ layer.textOffset = MGLRuntimeStylingHelper.testOffset;
+ layer.textAllowOverlap = MGLRuntimeStylingHelper.testBool;
+ layer.textIgnorePlacement = MGLRuntimeStylingHelper.testBool;
+ layer.textOptional = MGLRuntimeStylingHelper.testBool;
+ layer.iconOpacity = MGLRuntimeStylingHelper.testNumber;
+ layer.iconColor = MGLRuntimeStylingHelper.testColor;
+ layer.iconHaloColor = MGLRuntimeStylingHelper.testColor;
+ layer.iconHaloWidth = MGLRuntimeStylingHelper.testNumber;
+ layer.iconHaloBlur = MGLRuntimeStylingHelper.testNumber;
+ layer.iconTranslate = MGLRuntimeStylingHelper.testOffset;
+ layer.iconTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTranslateAnchorViewport type:@encode(MGLSymbolStyleLayerIconTranslateAnchor)];
+ layer.textOpacity = MGLRuntimeStylingHelper.testNumber;
+ layer.textColor = MGLRuntimeStylingHelper.testColor;
+ layer.textHaloColor = MGLRuntimeStylingHelper.testColor;
+ layer.textHaloWidth = MGLRuntimeStylingHelper.testNumber;
+ layer.textHaloBlur = MGLRuntimeStylingHelper.testNumber;
+ layer.textTranslate = MGLRuntimeStylingHelper.testOffset;
+ layer.textTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextTranslateAnchorViewport type:@encode(MGLSymbolStyleLayerTextTranslateAnchor)];
+
+ MGLSymbolStyleLayer *gLayer = [self.mapView.style layerWithIdentifier:@"layerID"];
+ XCTAssert([(NSValue *)gLayer.symbolPlacement objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerSymbolPlacementLine type:@encode(MGLSymbolStyleLayerSymbolPlacement)] objCType]);
+ XCTAssertEqualObjects(gLayer.symbolSpacing, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.symbolAvoidEdges, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.iconAllowOverlap, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.iconIgnorePlacement, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.iconOptional, MGLRuntimeStylingHelper.testBool);
+ XCTAssert([(NSValue *)gLayer.iconRotationAlignment objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconRotationAlignmentViewport type:@encode(MGLSymbolStyleLayerIconRotationAlignment)] objCType]);
+ XCTAssertEqualObjects(gLayer.iconSize, MGLRuntimeStylingHelper.testNumber);
+ XCTAssert([(NSValue *)gLayer.iconTextFit objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTextFitHeight type:@encode(MGLSymbolStyleLayerIconTextFit)] objCType]);
+ XCTAssertEqualObjects(gLayer.iconTextFitPadding, MGLRuntimeStylingHelper.testPadding);
+ XCTAssertEqualObjects(gLayer.iconImage, MGLRuntimeStylingHelper.testString);
+ XCTAssertEqualObjects(gLayer.iconRotate, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.iconPadding, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.iconKeepUpright, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.iconOffset, MGLRuntimeStylingHelper.testOffset);
+ XCTAssert([(NSValue *)gLayer.textPitchAlignment objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextPitchAlignmentViewport type:@encode(MGLSymbolStyleLayerTextPitchAlignment)] objCType]);
+ XCTAssert([(NSValue *)gLayer.textRotationAlignment objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextRotationAlignmentViewport type:@encode(MGLSymbolStyleLayerTextRotationAlignment)] objCType]);
+ XCTAssertEqualObjects(gLayer.textField, MGLRuntimeStylingHelper.testString);
+ XCTAssertEqualObjects(gLayer.textFont, MGLRuntimeStylingHelper.testFont);
+ XCTAssertEqualObjects(gLayer.textSize, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textMaxWidth, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textLineHeight, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textLetterSpacing, MGLRuntimeStylingHelper.testNumber);
+ XCTAssert([(NSValue *)gLayer.textJustify objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextJustifyRight type:@encode(MGLSymbolStyleLayerTextJustify)] objCType]);
+ XCTAssert([(NSValue *)gLayer.textAnchor objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextAnchorBottomRight type:@encode(MGLSymbolStyleLayerTextAnchor)] objCType]);
+ XCTAssertEqualObjects(gLayer.textMaxAngle, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textRotate, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textPadding, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textKeepUpright, MGLRuntimeStylingHelper.testBool);
+ XCTAssert([(NSValue *)gLayer.textTransform objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextTransformLowercase type:@encode(MGLSymbolStyleLayerTextTransform)] objCType]);
+ XCTAssertEqualObjects(gLayer.textOffset, MGLRuntimeStylingHelper.testOffset);
+ XCTAssertEqualObjects(gLayer.textAllowOverlap, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.textIgnorePlacement, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.textOptional, MGLRuntimeStylingHelper.testBool);
+ XCTAssertEqualObjects(gLayer.iconOpacity, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.iconColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.iconHaloColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.iconHaloWidth, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.iconHaloBlur, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.iconTranslate, MGLRuntimeStylingHelper.testOffset);
+ XCTAssert([(NSValue *)gLayer.iconTranslateAnchor objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerIconTranslateAnchorViewport type:@encode(MGLSymbolStyleLayerIconTranslateAnchor)] objCType]);
+ XCTAssertEqualObjects(gLayer.textOpacity, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.textHaloColor, MGLRuntimeStylingHelper.testColor);
+ XCTAssertEqualObjects(gLayer.textHaloWidth, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textHaloBlur, MGLRuntimeStylingHelper.testNumber);
+ XCTAssertEqualObjects(gLayer.textTranslate, MGLRuntimeStylingHelper.testOffset);
+ XCTAssert([(NSValue *)gLayer.textTranslateAnchor objCType] == [[MGLRuntimeStylingHelper testEnum:MGLSymbolStyleLayerTextTranslateAnchorViewport type:@encode(MGLSymbolStyleLayerTextTranslateAnchor)] objCType]);
+}
+
+@end