1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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
|