Update the test case for cancel behavior

This commit is contained in:
DreamPiggy 2019-08-01 20:12:07 +08:00
parent 5b1a833732
commit 6f0f735d4f
1 changed files with 3 additions and 2 deletions

View File

@ -62,13 +62,14 @@
}
- (void)test06CancellAll {
XCTestExpectation *expectation = [self expectationWithDescription:@"Cancel"];
XCTestExpectation *expectation = [self expectationWithDescription:@"Cancel should callback with error"];
// need a bigger image here, that is why we don't use kTestJPEGURL
// if the image is too small, it will get downloaded before we can cancel :)
NSURL *url = [NSURL URLWithString:@"https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"];
[[SDWebImageManager sharedManager] loadImageWithURL:url options:0 progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) {
XCTFail(@"Should not get here");
expect(error).notTo.beNil();
expect(error.code).equal(SDWebImageErrorCancelled);
}];
[[SDWebImageManager sharedManager] cancelAll];