Makes setURL method on MLNImageSource public (#2197)

Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
This commit is contained in:
Manuel Roth
2024-03-15 00:37:01 +01:00
committed by GitHub
parent 3a9bc9078a
commit 4bf99d8239
2 changed files with 22 additions and 0 deletions

View File

@@ -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.

View File

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