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
|
#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
|