diff options
Diffstat (limited to 'platform/darwin/test/MGLImageSourceTests.m')
-rw-r--r-- | platform/darwin/test/MGLImageSourceTests.m | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLImageSourceTests.m b/platform/darwin/test/MGLImageSourceTests.m new file mode 100644 index 0000000000..38fcd38709 --- /dev/null +++ b/platform/darwin/test/MGLImageSourceTests.m @@ -0,0 +1,42 @@ +#import <XCTest/XCTest.h> + +#import <Mapbox/Mapbox.h> + +@interface MGLImageSourceTests : XCTestCase + +@end + +@implementation MGLImageSourceTests + + +- (void)testMGLImageSourceWithImageURL { + + MGLCoordinateQuad quad = { { 80, 37}, { 81, 37}, { 81, 39}, { 80, 39}}; + MGLImageSource *source = [[MGLImageSource alloc] initWithIdentifier:@"source-id" coordinateQuad:quad URL:[NSURL URLWithString:@"http://host/image.png"]]; + + XCTAssertNotNil(source.URL); + XCTAssertEqualObjects(source.URL.absoluteString, @"http://host/image.png"); + XCTAssertNil(source.image); +} + +- (void)testMGLImageSourceWithImage { + + NSString *imageName = @"RadarImage"; +#if TARGET_OS_IPHONE + MGLImage *image = [MGLImage imageNamed:imageName + inBundle:[NSBundle bundleForClass:[self class]] + compatibleWithTraitCollection:nil]; +#else + MGLImage *image = [[NSBundle bundleForClass:[self class]] imageForResource:imageName]; +#endif + XCTAssertNotNil(image); + + MGLCoordinateQuad quad = { { 80, 37}, { 81, 37}, { 81, 39}, { 80, 39}}; + MGLImageSource *source = [[MGLImageSource alloc] initWithIdentifier:@"source-id" coordinateQuad:quad image:image]; + + XCTAssertNotNil(source.image); + XCTAssertEqualObjects(source.image, image); + XCTAssertNil(source.URL); +} + +@end |