@@ -127,6 +127,10 @@ class AnimatedImageTests: XCTestCase {
127127 func testAnimatedImageModifier( ) throws {
128128 let expectation = self . expectation ( description: " WebImage modifier " )
129129 let imageUrl = URL ( string: " https://assets.sbnation.com/assets/2512203/dogflops.gif " )
130+ AnimatedImage . onViewDestroy { view, coordinator in
131+ XCTAssert ( view. isKind ( of: SDAnimatedImageView . self) )
132+ XCTAssertEqual ( coordinator. userInfo ? [ " foo " ] as? String , " bar " )
133+ }
130134 let imageView = AnimatedImage ( url: imageUrl, options: [ . progressiveLoad] , context: [ . imageScaleFactor: 1 ] )
131135 let introspectView = imageView
132136 . onSuccess { _, _ in
@@ -137,6 +141,14 @@ class AnimatedImageTests: XCTestCase {
137141 }
138142 . onProgress { _, _ in
139143
144+ }
145+ . onViewCreate { view, context in
146+ XCTAssert ( view. isKind ( of: SDAnimatedImageView . self) )
147+ context. coordinator. userInfo = [ " foo " : " bar " ]
148+ }
149+ . onViewUpdate { view, context in
150+ XCTAssert ( view. isKind ( of: SDAnimatedImageView . self) )
151+ XCTAssertEqual ( context. coordinator. userInfo ? [ " foo " ] as? String , " bar " )
140152 }
141153 . placeholder ( WebImage . emptyImage)
142154 . indicator ( SDWebImageActivityIndicator . medium)
@@ -157,6 +169,7 @@ class AnimatedImageTests: XCTestCase {
157169 _ = try introspectView. inspect ( AnimatedImage . self)
158170 ViewHosting . host ( view: introspectView)
159171 self . waitForExpectations ( timeout: 5 , handler: nil )
172+ AnimatedImage . onViewDestroy ( )
160173 }
161174
162175 // MARK: Helper
0 commit comments