diff options
Diffstat (limited to 'platform/darwin/test/MGLStyleTests.mm')
-rw-r--r-- | platform/darwin/test/MGLStyleTests.mm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLStyleTests.mm b/platform/darwin/test/MGLStyleTests.mm index 4c0c163b38..8f0d2502fb 100644 --- a/platform/darwin/test/MGLStyleTests.mm +++ b/platform/darwin/test/MGLStyleTests.mm @@ -17,6 +17,11 @@ #import <mbgl/util/default_styles.hpp> #import <XCTest/XCTest.h> +#if TARGET_OS_IPHONE + #import <UIKit/UIKit.h> +#else + #import <Cocoa/Cocoa.h> +#endif #import <objc/runtime.h> @interface MGLStyleTests : XCTestCase @@ -175,4 +180,23 @@ return styleHeader; } +- (void)testImages { + NSString *imageName = @"TrackingLocationMask"; +#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); + + [self.mapView.style setImage:image forName:imageName]; + MGLImage *styleImage = [self.mapView.style imageForName:imageName]; + + XCTAssertNotNil(styleImage); + XCTAssertEqual(image.size.width, styleImage.size.width); + XCTAssertEqual(image.size.height, styleImage.size.height); +} + @end |