Fix the unit test `test31ThatMultipleRequestForSameURLFailedCallback`
This commit is contained in:
parent
3565eb1018
commit
f761fc7e7b
|
@ -541,6 +541,8 @@
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
UIImageOrientation orientation = image.imageOrientation;
|
UIImageOrientation orientation = image.imageOrientation;
|
||||||
expect(orientation).equal(UIImageOrientationUp);
|
expect(orientation).equal(UIImageOrientationUp);
|
||||||
|
#else
|
||||||
|
expect(image.sd_imageFormat).equal(SDImageFormatJPEG);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Manual test again for Apple's API
|
// Manual test again for Apple's API
|
||||||
|
|
|
@ -825,14 +825,17 @@
|
||||||
[self waitForExpectations:expectations timeout:kAsyncTestTimeout * 2];
|
[self waitForExpectations:expectations timeout:kAsyncTestTimeout * 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)test31ThatMultipleRequestForSameURLFailedCallback {
|
- (void)test31ThatMultipleRequestForSameURLFailedCallback {
|
||||||
// See #3493, silly bug
|
// See #3493, silly bug
|
||||||
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"]; // Always fail url
|
// Create tmp file with empty contents
|
||||||
NSMutableArray<XCTestExpectation *> *expectations = [NSMutableArray arrayWithCapacity:100];
|
NSURL *dir = [[NSURL fileURLWithPath:NSTemporaryDirectory()] URLByAppendingPathComponent:NSStringFromSelector(_cmd) isDirectory: true];
|
||||||
|
[NSFileManager.defaultManager createDirectoryAtURL:dir withIntermediateDirectories:YES attributes:nil error:nil];
|
||||||
|
NSURL *url = [dir URLByAppendingPathComponent:@"file" isDirectory:NO];
|
||||||
|
[[NSData data] writeToURL:url atomically:YES]; // Always fail url (but valid)
|
||||||
|
NSMutableArray<XCTestExpectation *> *expectations = [NSMutableArray arrayWithCapacity:10];
|
||||||
__block void (^recursiveBlock)(int);
|
__block void (^recursiveBlock)(int);
|
||||||
void (^mainBlock)(int) = ^(int i) {
|
void (^mainBlock)(int) = ^(int i) {
|
||||||
if (i > 200) return;
|
if (i > 10) return;
|
||||||
NSString *desc = [NSString stringWithFormat:@"Failed url with index %d should callback error", i];
|
NSString *desc = [NSString stringWithFormat:@"Failed url with index %d should callback error", i];
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:desc];
|
XCTestExpectation *expectation = [self expectationWithDescription:desc];
|
||||||
[expectations addObject:expectation];
|
[expectations addObject:expectation];
|
||||||
|
@ -853,7 +856,6 @@
|
||||||
[self waitForExpectations:expectations timeout:kAsyncTestTimeout * 2];
|
[self waitForExpectations:expectations timeout:kAsyncTestTimeout * 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - SDWebImageLoader
|
#pragma mark - SDWebImageLoader
|
||||||
- (void)testCustomImageLoaderWorks {
|
- (void)testCustomImageLoaderWorks {
|
||||||
XCTestExpectation *expectation = [self expectationWithDescription:@"Custom image not works"];
|
XCTestExpectation *expectation = [self expectationWithDescription:@"Custom image not works"];
|
||||||
|
|
Loading…
Reference in New Issue