|
|
@@ -660,35 +660,26 @@ class ImageViewExtensionTests: XCTestCase {
|
|
|
|
|
|
let options: KingfisherOptionsInfo = [.cacheMemoryOnly, .memoryCacheExpiration(.seconds(0.15))]
|
|
|
|
|
|
- let group = DispatchGroup()
|
|
|
-
|
|
|
- group.enter()
|
|
|
imageView.kf.setImage(with: url, options: options) { result in
|
|
|
XCTAssertNotNil(result.value?.image)
|
|
|
XCTAssertTrue(result.value!.cacheType == .none)
|
|
|
- group.leave()
|
|
|
}
|
|
|
|
|
|
- group.enter()
|
|
|
delay(0.1) {
|
|
|
self.imageView.kf.setImage(with: url, options: options) { result in
|
|
|
XCTAssertNotNil(result.value?.image)
|
|
|
XCTAssertTrue(result.value!.cacheType == .memory)
|
|
|
- group.leave()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- group.enter()
|
|
|
delay(0.2) {
|
|
|
self.imageView.kf.setImage(with: url, options: options) { result in
|
|
|
XCTAssertNotNil(result.value?.image)
|
|
|
XCTAssertTrue(result.value!.cacheType == .memory)
|
|
|
- group.leave()
|
|
|
+ exp.fulfill()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- group.notify(queue: .main, execute: exp.fulfill)
|
|
|
-
|
|
|
waitForExpectations(timeout: 3, handler: nil)
|
|
|
}
|
|
|
|
|
|
@@ -699,35 +690,26 @@ class ImageViewExtensionTests: XCTestCase {
|
|
|
|
|
|
let options: KingfisherOptionsInfo = [.cacheMemoryOnly, .memoryCacheExpirationNotExtendable, .memoryCacheExpiration(.seconds(0.15))]
|
|
|
|
|
|
- let group = DispatchGroup()
|
|
|
-
|
|
|
- group.enter()
|
|
|
imageView.kf.setImage(with: url, options: options) { result in
|
|
|
XCTAssertNotNil(result.value?.image)
|
|
|
XCTAssertTrue(result.value!.cacheType == .none)
|
|
|
- group.leave()
|
|
|
}
|
|
|
|
|
|
- group.enter()
|
|
|
delay(0.1) {
|
|
|
self.imageView.kf.setImage(with: url, options: options) { result in
|
|
|
XCTAssertNotNil(result.value?.image)
|
|
|
XCTAssertTrue(result.value!.cacheType == .memory)
|
|
|
- group.leave()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- group.enter()
|
|
|
delay(0.2) {
|
|
|
self.imageView.kf.setImage(with: url, options: options) { result in
|
|
|
XCTAssertNotNil(result.value?.image)
|
|
|
XCTAssertTrue(result.value!.cacheType == .none)
|
|
|
- group.leave()
|
|
|
+ exp.fulfill()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- group.notify(queue: .main, execute: exp.fulfill)
|
|
|
-
|
|
|
waitForExpectations(timeout: 3, handler: nil)
|
|
|
}
|
|
|
}
|