diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2016-11-28 18:15:50 +0200 |
---|---|---|
committer | Jesse Bounds <jesse@rebounds.net> | 2016-12-02 11:39:16 -0800 |
commit | 37026a14ff12fcf2fbad02b95fc7847908ce31d5 (patch) | |
tree | c85fd5a2a8db5b39ddd6e3a4bd12144aa7f07022 /platform/ios/test | |
parent | d44d1c8401f38982905bce3166eaad8431661263 (diff) | |
download | qtlocation-mapboxgl-37026a14ff12fcf2fbad02b95fc7847908ce31d5.tar.gz |
[ios, macos] handle duplicate source error
Diffstat (limited to 'platform/ios/test')
-rw-r--r-- | platform/ios/test/MGLSourceTests.m | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/platform/ios/test/MGLSourceTests.m b/platform/ios/test/MGLSourceTests.m new file mode 100644 index 0000000000..90ec4e3a0b --- /dev/null +++ b/platform/ios/test/MGLSourceTests.m @@ -0,0 +1,24 @@ +#import "MGLMapViewTests.h" + +@interface MGLSourceTests : MGLMapViewTests + +@end + +@implementation MGLSourceTests + +- (void)testDuplicateSources { + MGLVectorSource *source1 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" URL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; + MGLVectorSource *source2 = [[MGLVectorSource alloc] initWithIdentifier:@"my-source" URL:[NSURL URLWithString:@"mapbox://mapbox.mapbox-terrain-v2"]]; + + [self.mapView.style addSource: source1]; + + @try { + [self.mapView.style addSource: source2]; + XCTFail(@"Should not have reached this point"); + } + @catch (NSException *e) { + XCTAssertNotNil(e, @"Should have thrown an exception"); + } +} + +@end |