Makes setURL method on MLNImageSource public (#2197)
Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
This commit is contained in:
@@ -81,6 +81,13 @@ MLN_EXPORT
|
||||
*/
|
||||
@property (nonatomic, copy, nullable)NSURL *URL;
|
||||
|
||||
/**
|
||||
Sets the URL for the image source, performing necessary validations.
|
||||
|
||||
@param url The URL to set for the image source.
|
||||
*/
|
||||
- (void)setURL:(NSURL *)url;
|
||||
|
||||
/**
|
||||
The source image.
|
||||
|
||||
|
||||
@@ -39,4 +39,19 @@
|
||||
XCTAssertNil(source.URL);
|
||||
}
|
||||
|
||||
- (void)testMLNImageSourceSetURL {
|
||||
// Create a test instance of MLNImageSource
|
||||
MLNCoordinateQuad quad = { { 80, 37}, { 81, 37}, { 81, 39}, { 80, 39}};
|
||||
MLNImageSource *source = [[MLNImageSource alloc] initWithIdentifier:@"source-id" coordinateQuad:quad URL:[NSURL URLWithString:@"http://host/image.png"]];
|
||||
|
||||
// Set the URL using setURL
|
||||
NSURL *testURL = [NSURL URLWithString:@"http://host/image1.png"];
|
||||
[source setURL:testURL];
|
||||
|
||||
// Assert that the URL is set correctly
|
||||
XCTAssertNotNil(source.URL);
|
||||
XCTAssertEqualObjects(source.URL.absoluteString, @"http://host/image1.png");
|
||||
XCTAssertNil(source.image);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user