Merge pull request #3684 from dreampiggy/test/fix
Fix the unit test `test31ThatMultipleRequestForSameURLFailedCallback`
This commit is contained in:
commit
74fa16f4d3
|
@ -541,6 +541,8 @@
|
|||
#if SD_UIKIT
|
||||
UIImageOrientation orientation = image.imageOrientation;
|
||||
expect(orientation).equal(UIImageOrientationUp);
|
||||
#else
|
||||
expect(image.sd_imageFormat).equal(SDImageFormatJPEG);
|
||||
#endif
|
||||
|
||||
// Manual test again for Apple's API
|
||||
|
|
|
@ -825,14 +825,17 @@
|
|||
[self waitForExpectations:expectations timeout:kAsyncTestTimeout * 2];
|
||||
}
|
||||
|
||||
|
||||
- (void)test31ThatMultipleRequestForSameURLFailedCallback {
|
||||
// See #3493, silly bug
|
||||
NSURL *url = [NSURL fileURLWithPath:@"/dev/null"]; // Always fail url
|
||||
NSMutableArray<XCTestExpectation *> *expectations = [NSMutableArray arrayWithCapacity:100];
|
||||
// Create tmp file with empty contents
|
||||
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);
|
||||
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];
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:desc];
|
||||
[expectations addObject:expectation];
|
||||
|
@ -853,7 +856,6 @@
|
|||
[self waitForExpectations:expectations timeout:kAsyncTestTimeout * 2];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - SDWebImageLoader
|
||||
- (void)testCustomImageLoaderWorks {
|
||||
XCTestExpectation *expectation = [self expectationWithDescription:@"Custom image not works"];
|
||||
|
|
Loading…
Reference in New Issue