summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLStyleTests.mm
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-26 18:52:44 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-01-27 11:44:16 +0100
commit62ea1f21858c69f6921c775ba7a3de201f0514d8 (patch)
tree7a4da88706e8a5513e1e13e993b2acc212cae3b1 /platform/darwin/test/MGLStyleTests.mm
parenta662508ddde4043ece36d8ea9b424368891d892c (diff)
downloadqtlocation-mapboxgl-62ea1f21858c69f6921c775ba7a3de201f0514d8.tar.gz
[core] remove trailing whitespace, add trailing newlines, add space after //
Diffstat (limited to 'platform/darwin/test/MGLStyleTests.mm')
-rw-r--r--platform/darwin/test/MGLStyleTests.mm42
1 files changed, 21 insertions, 21 deletions
diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm
index 176217619d..ed86a252fa 100644
--- a/platform/darwin/test/MGLStyleTests.mm
+++ b/platform/darwin/test/MGLStyleTests.mm
@@ -25,7 +25,7 @@
- (void)setUp {
[super setUp];
-
+
[MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"];
NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"];
self.mapView = [[MGLMapView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) styleURL:styleURL];
@@ -39,14 +39,14 @@
- (void)mapView:(MGLMapView *)mapView didFinishLoadingStyle:(MGLStyle *)style {
XCTAssertNotNil(mapView.style);
XCTAssertEqual(mapView.style, style);
-
+
[_styleLoadingExpectation fulfill];
}
- (void)tearDown {
_styleLoadingExpectation = nil;
self.mapView = nil;
-
+
[super tearDown];
}
@@ -81,7 +81,7 @@
XCTAssertEqualObjects([MGLStyle satelliteStyleURLWithVersion:99].absoluteString, @"mapbox://styles/mapbox/satellite-v99");
XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:MGLStyleDefaultVersion].absoluteString, @(mbgl::util::default_styles::satelliteStreets.url));
XCTAssertEqualObjects([MGLStyle satelliteStreetsStyleURLWithVersion:99].absoluteString, @"mapbox://styles/mapbox/satellite-streets-v99");
-
+
static_assert(6 == mbgl::util::default_styles::numOrderedStyles,
"MGLStyleTests isn’t testing all the styles in mbgl::util::default_styles.");
}
@@ -109,17 +109,17 @@
XCTAssertEqual(mbgl::util::default_styles::numOrderedStyles, numVersionedMethods,
@"There are %lu default styles but MGLStyleTests only provides versioned style URL methods for %u of them.",
mbgl::util::default_styles::numOrderedStyles, numVersionedMethods);
-
+
// Test that all the versioned style methods are in the public header.
NSString *styleHeader = self.stringWithContentsOfStyleHeader;
-
+
NSError *versionedMethodError;
NSString *versionedMethodExpressionString = @(R"RE(^\+\s*\(NSURL\s*\*\s*\)\s*\w+StyleURLWithVersion\s*:\s*\(\s*NSInteger\s*\)\s*version\s*;)RE");
NSRegularExpression *versionedMethodExpression = [NSRegularExpression regularExpressionWithPattern:versionedMethodExpressionString options:NSRegularExpressionAnchorsMatchLines error:&versionedMethodError];
XCTAssertNil(versionedMethodError, @"Error compiling regular expression to search for versioned methods.");
NSUInteger numVersionedMethodDeclarations = [versionedMethodExpression numberOfMatchesInString:styleHeader options:0 range:NSMakeRange(0, styleHeader.length)];
XCTAssertEqual(numVersionedMethodDeclarations, numVersionedMethods);
-
+
// Test that “current version is” statements are present and current for all versioned style methods.
NSError *versionError;
NSString *versionExpressionString = @(R"RE(current version is `(\d+)`)RE");
@@ -219,15 +219,15 @@
}
- (void)testAddingLayersWithDuplicateIdentifiers {
- //Just some source
+ // Just some source
MGLVectorSource *source = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" configurationURL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]];
[self.style addSource: source];
-
- //Add initial layer
+
+ // Add initial layer
MGLFillStyleLayer *initial = [[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source];
[self.style addLayer:initial];
-
- //Try to add the duplicate
+
+ // Try to add the duplicate
XCTAssertThrowsSpecificNamed([self.style addLayer:[[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source]], NSException, @"MGLRedundantLayerIdentifierException");
XCTAssertThrowsSpecificNamed([self.style insertLayer:[[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source] belowLayer:initial],NSException, @"MGLRedundantLayerIdentifierException");
XCTAssertThrowsSpecificNamed([self.style insertLayer:[[MGLFillStyleLayer alloc] initWithIdentifier:@"my-layer" source:source] aboveLayer:initial], NSException, @"MGLRedundantLayerIdentifierException");
@@ -259,10 +259,10 @@
MGLImage *image = [[NSBundle bundleForClass:[self class]] imageForResource:imageName];
#endif
XCTAssertNotNil(image);
-
+
[self.style setImage:image forName:imageName];
MGLImage *styleImage = [self.style imageForName:imageName];
-
+
XCTAssertNotNil(styleImage);
XCTAssertEqual(image.size.width, styleImage.size.width);
XCTAssertEqual(image.size.height, styleImage.size.height);
@@ -273,28 +273,28 @@
NSURL *url = [NSURL fileURLWithPath:filePath];
MGLShapeSource *source = [[MGLShapeSource alloc] initWithIdentifier:@"sourceID" URL:url options:nil];
[self.style addSource:source];
-
+
MGLCircleStyleLayer *layer1 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer1" source:source];
[self.style addLayer:layer1];
-
+
MGLCircleStyleLayer *layer3 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer3" source:source];
[self.style addLayer:layer3];
-
+
MGLCircleStyleLayer *layer2 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer2" source:source];
[self.style insertLayer:layer2 aboveLayer:layer1];
-
+
MGLCircleStyleLayer *layer4 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer4" source:source];
[self.style insertLayer:layer4 aboveLayer:layer3];
-
+
MGLCircleStyleLayer *layer0 = [[MGLCircleStyleLayer alloc] initWithIdentifier:@"layer0" source:source];
[self.style insertLayer:layer0 belowLayer:layer1];
-
+
NSArray<MGLStyleLayer *> *layers = [self.style layers];
NSUInteger startIndex = 0;
if ([layers.firstObject.identifier isEqualToString:@"com.mapbox.annotations.points"]) {
startIndex++;
}
-
+
XCTAssertEqualObjects(layers[startIndex++].identifier, layer0.identifier);
XCTAssertEqualObjects(layers[startIndex++].identifier, layer1.identifier);
XCTAssertEqualObjects(layers[startIndex++].identifier, layer2.identifier);