diff options
Diffstat (limited to 'platform/darwin/test/MGLStyleLayerTests.m.ejs')
-rw-r--r-- | platform/darwin/test/MGLStyleLayerTests.m.ejs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLStyleLayerTests.m.ejs b/platform/darwin/test/MGLStyleLayerTests.m.ejs new file mode 100644 index 0000000000..6b7bfe2f1c --- /dev/null +++ b/platform/darwin/test/MGLStyleLayerTests.m.ejs @@ -0,0 +1,72 @@ +<% + const type = locals.type; + const layoutProperties = locals.layoutProperties; + const paintProperties = locals.paintProperties; +-%> +// This file is generated. +// Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. + +#import "MGLStyleLayerTests.h" + +@interface MGL<%- camelize(type) %>LayerTests : MGLStyleLayerTests +@end + +@implementation MGL<%- camelize(type) %>LayerTests + ++ (NSString *)layerType { + return @"<%- type %>"; +} + +- (void)test<%- camelize(type) %>Layer { +<% if (type === 'background') { -%> + MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID"]; +<% } else { -%> + NSString *filePath = [[NSBundle bundleForClass:self.class] pathForResource:@"amsterdam" ofType:@"geojson"]; + NSURL *url = [NSURL fileURLWithPath:filePath]; + MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" URL:url options:nil]; + [self.mapView.style addSource:source]; + MGL<%- camelize(type) %>StyleLayer *layer = [[MGL<%- camelize(type) %>StyleLayer alloc] initWithIdentifier:@"layerID" source:source]; +<% } -%> + [self.mapView.style addLayer:layer]; + +<% for (const property of layoutProperties) { -%> + <%- testImplementation(property, type) %> +<% } -%> +<% for (const property of paintProperties) { -%> + <%- testImplementation(property, type) %> +<% } -%> + + MGL<%- camelize(type) %>StyleLayer *gLayer = (MGL<%- camelize(type) %>StyleLayer *)[self.mapView.style layerWithIdentifier:@"layerID"]; + XCTAssertTrue([gLayer isKindOfClass:[MGL<%- camelize(type) %>StyleLayer class]]); +<% for (const property of layoutProperties) { -%> + <%- testGetterImplementation(property, type) %> +<% } -%> +<% for (const property of paintProperties) { -%> + <%- testGetterImplementation(property, type) %> +<% } -%> + +<% for (const property of layoutProperties) { -%> + <%- testImplementation(property, type, true) %> +<% } -%> +<% for (const property of paintProperties) { -%> + <%- testImplementation(property, type, true) %> +<% } -%> + +<% for (const property of layoutProperties) { -%> + <%- testGetterImplementation(property, type, true) %> +<% } -%> +<% for (const property of paintProperties) { -%> + <%- testGetterImplementation(property, type, true) %> +<% } -%> +} + +- (void)testPropertyNames { +<% for (const property of layoutProperties) { -%> + [self testPropertyName:@"<%- property.getter || property.name %>" isBoolean:<%- property.type === 'boolean' ? 'YES' : 'NO' %>]; +<% } -%> +<% for (const property of paintProperties) { -%> + [self testPropertyName:@"<%- property.getter || property.name %>" isBoolean:<%- property.type === 'boolean' ? 'YES' : 'NO' %>]; +<% } -%> +} + +@end |