@@ -22,10 +22,10 @@ class WebImageTests: XCTestCase {
22
22
let imageUrl = URL ( string: " https://nr-platform.s3.amazonaws.com/uploads/platform/published_extension/branding_icon/275/AmazonS3.png " )
23
23
let imageView = WebImage ( url: imageUrl)
24
24
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)
28
26
let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . nsImage ( )
27
+ #else
28
+ let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . cgImage ( )
29
29
#endif
30
30
XCTAssertNotNil ( displayImage)
31
31
expectation. fulfill ( )
@@ -46,15 +46,17 @@ class WebImageTests: XCTestCase {
46
46
let introspectView = imageView. onSuccess { image, data, cacheType in
47
47
if let animatedImage = image as? SDAnimatedImage {
48
48
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)
52
50
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 )
53
55
#endif
54
56
XCTAssertNotNil ( displayImage)
55
57
// Check display image should match the animated poster frame
56
58
let posterImage = animatedImage. animatedImageFrame ( at: 0 )
57
- XCTAssertEqual ( displayImage ? . size, posterImage? . size)
59
+ XCTAssertEqual ( size, posterImage? . size)
58
60
expectation. fulfill ( )
59
61
} else {
60
62
XCTFail ( " WebImage animated image invalid " )
@@ -162,15 +164,10 @@ class WebImageTests: XCTestCase {
162
164
let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . nsImage ( )
163
165
XCTAssertNotNil ( displayImage)
164
166
#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)
174
171
#endif
175
172
expectation. fulfill ( )
176
173
} . onFailure { error in
0 commit comments