@@ -22,10 +22,10 @@ class WebImageTests: XCTestCase {
2222 let imageUrl = URL ( string: " https://nr-platform.s3.amazonaws.com/uploads/platform/published_extension/branding_icon/275/AmazonS3.png " )
2323 let imageView = WebImage ( url: imageUrl)
2424 let introspectView = imageView. onSuccess { image, data, cacheType in
25- #if os(iOS) || os(tvOS)
26- let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . uiImage ( )
27- #else
25+ #if os(macOS)
2826 let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . nsImage ( )
27+ #else
28+ let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . cgImage ( )
2929 #endif
3030 XCTAssertNotNil ( displayImage)
3131 expectation. fulfill ( )
@@ -46,15 +46,17 @@ class WebImageTests: XCTestCase {
4646 let introspectView = imageView. onSuccess { image, data, cacheType in
4747 if let animatedImage = image as? SDAnimatedImage {
4848 XCTAssertTrue ( imageView. isAnimating)
49- #if os(iOS) || os(tvOS)
50- let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . uiImage ( )
51- #else
49+ #if os(macOS)
5250 let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . nsImage ( )
51+ let size = displayImage? . size
52+ #else
53+ let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . cgImage ( )
54+ let size = CGSize ( width: displayImage? . width ?? 0 , height: displayImage? . height ?? 0 )
5355 #endif
5456 XCTAssertNotNil ( displayImage)
5557 // Check display image should match the animated poster frame
5658 let posterImage = animatedImage. animatedImageFrame ( at: 0 )
57- XCTAssertEqual ( displayImage ? . size, posterImage? . size)
59+ XCTAssertEqual ( size, posterImage? . size)
5860 expectation. fulfill ( )
5961 } else {
6062 XCTFail ( " WebImage animated image invalid " )
@@ -162,15 +164,10 @@ class WebImageTests: XCTestCase {
162164 let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . nsImage ( )
163165 XCTAssertNotNil ( displayImage)
164166 #else
165- if #available( iOS 14 . 0 , watchOS 7 . 0 , tvOS 14 . 0 , * ) {
166- let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . uiImage ( )
167- XCTAssertEqual ( displayImage, image)
168- } else {
169- let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . cgImage ( )
170- let orientation = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . orientation ( )
171- XCTAssertNotNil ( displayImage)
172- XCTAssertEqual ( orientation, . leftMirrored)
173- }
167+ let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . cgImage ( )
168+ let orientation = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . orientation ( )
169+ XCTAssertNotNil ( displayImage)
170+ XCTAssertEqual ( orientation, . leftMirrored)
174171 #endif
175172 expectation. fulfill ( )
176173 } . onFailure { error in
0 commit comments