@@ -39,24 +39,22 @@ class WebImageTests: XCTestCase {
3939
4040 func testWebImageWithAnimatedURL( ) throws {
4141 let expectation = self . expectation ( description: " WebImage animated url initializer " )
42- let imageUrl = URL ( string: " http ://apng.onevcat.com/assets/elephant.png" )
42+ let imageUrl = URL ( string: " https ://apng.onevcat.com/assets/elephant.png" )
4343 let binding = Binding < Bool > ( wrappedValue: true )
4444 let imageView = WebImage ( url: imageUrl, isAnimating: binding)
4545 let introspectView = imageView. onSuccess { image, cacheType in
4646 if let animatedImage = image as? SDAnimatedImage {
47- DispatchQueue . main. asyncAfter ( deadline: . now( ) + 1 ) {
48- XCTAssertTrue ( imageView. isAnimating)
49- #if os(iOS) || os(tvOS)
50- let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . uiImage ( )
51- #else
52- let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . nsImage ( )
53- #endif
54- XCTAssertNotNil ( displayImage)
55- // Check display image should match the animated poster frame
56- let posterImage = animatedImage. animatedImageFrame ( at: 0 )
57- XCTAssertEqual ( displayImage? . size, posterImage? . size)
58- expectation. fulfill ( )
59- }
47+ XCTAssertTrue ( imageView. isAnimating)
48+ #if os(iOS) || os(tvOS)
49+ let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . uiImage ( )
50+ #else
51+ let displayImage = try ? imageView. inspect ( ) . group ( ) . image ( 0 ) . nsImage ( )
52+ #endif
53+ XCTAssertNotNil ( displayImage)
54+ // Check display image should match the animated poster frame
55+ let posterImage = animatedImage. animatedImageFrame ( at: 0 )
56+ XCTAssertEqual ( displayImage? . size, posterImage? . size)
57+ expectation. fulfill ( )
6058 } else {
6159 XCTFail ( " WebImage animated image invalid " )
6260 }
0 commit comments