Fix the test

This commit is contained in:
DreamPiggy 2018-05-17 14:16:15 +08:00
parent 4eb13bf2a1
commit 1343a65321
3 changed files with 5 additions and 5 deletions

View File

@ -433,7 +433,7 @@
- (void)test31ThatLoadersManagerWorks {
XCTestExpectation *expectation = [self expectationWithDescription:@"Loaders manager not works"];
NSURL *imageURL = [NSURL URLWithString:kTestJpegURL];
[[SDWebImageLoadersManager sharedManager] loadImageWithURL:imageURL options:0 context:nil progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
[[SDImageLoadersManager sharedManager] loadImageWithURL:imageURL options:0 context:nil progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {
expect(targetURL).notTo.beNil();
} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
expect(error).to.beNil();

View File

@ -8,9 +8,9 @@
*/
#import <Foundation/Foundation.h>
#import <SDWebImage/SDWebImageLoader.h>
#import <SDWebImage/SDImageLoader.h>
// A really naive implementation of custom image loader using `NSURLSession`
@interface SDWebImageTestLoader : NSObject <SDWebImageLoader>
@interface SDWebImageTestLoader : NSObject <SDImageLoader>
@end

View File

@ -20,13 +20,13 @@
return YES;
}
- (id<SDWebImageOperation>)loadImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDWebImageLoaderProgressBlock)progressBlock completed:(SDWebImageLoaderCompletedBlock)completedBlock {
- (id<SDWebImageOperation>)loadImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock {
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if (data) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
UIImage *image = SDWebImageLoaderDecodeImageData(data, url, options, context);
UIImage *image = SDImageLoaderDecodeImageData(data, url, options, context);
if (completedBlock) {
completedBlock(image, data, nil, YES);
}