Merge pull request #2031 from dreampiggy/add_refresh_cache_test
Add a test for SDWebImageRefreshCached
This commit is contained in:
commit
266b9be6a7
|
@ -73,7 +73,7 @@ NSString *workingImageURL = @"http://s3.amazonaws.com/fast-image-cache/demo-imag
|
||||||
XCTFail(@"Image should be in cache");
|
XCTFail(@"Image should be in cache");
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
[self waitForExpectationsWithTimeout:kAsyncTestTimeout handler:nil];
|
[self waitForExpectationsWithCommonTimeout];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)test05DiskImageExistsForURL {
|
- (void)test05DiskImageExistsForURL {
|
||||||
|
@ -108,4 +108,23 @@ NSString *workingImageURL = @"http://s3.amazonaws.com/fast-image-cache/demo-imag
|
||||||
[self waitForExpectationsWithCommonTimeout];
|
[self waitForExpectationsWithCommonTimeout];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)test07ThatLoadImageWithSDWebImageRefreshCachedWorks {
|
||||||
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Image download twice with SDWebImageRefresh failed"];
|
||||||
|
NSURL *originalImageURL = [NSURL URLWithString:@"http://s3.amazonaws.com/fast-image-cache/demo-images/FICDDemoImage007.jpg"];
|
||||||
|
[[SDImageCache sharedImageCache] clearDiskOnCompletion:nil];
|
||||||
|
|
||||||
|
[[SDWebImageManager sharedManager] loadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
||||||
|
expect(image).toNot.beNil();
|
||||||
|
expect(error).to.beNil();
|
||||||
|
// #1993, load image with SDWebImageRefreshCached twice should not fail if the first time success.
|
||||||
|
|
||||||
|
[[SDWebImageManager sharedManager] loadImageWithURL:originalImageURL options:SDWebImageRefreshCached progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
|
||||||
|
expect(image).toNot.beNil();
|
||||||
|
expect(error).to.beNil();
|
||||||
|
[expectation fulfill];
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
[self waitForExpectationsWithCommonTimeout];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue