Update the test case

This commit is contained in:
DreamPiggy 2024-08-07 14:32:50 +08:00
parent ecedea2e06
commit 0df663ca95
2 changed files with 8 additions and 6 deletions

View File

@ -352,13 +352,19 @@ static BOOL _isCalled;
- (void)test24AnimatedImageViewCategoryDiskCache {
XCTestExpectation *expectation = [self expectationWithDescription:@"test SDAnimatedImageView view category disk cache"];
SDAnimatedImageView *imageView = [SDAnimatedImageView new];
NSURL *testURL = [NSURL URLWithString:kTestGIFURL];
[SDImageCache.sharedImageCache removeImageFromMemoryForKey:testURL.absoluteString];
NSURL *testURL = [NSURL URLWithString:@"https://foobar.non-exists.org/bizbuz.gif"];
NSString *testKey = testURL.absoluteString;
[SDImageCache.sharedImageCache removeImageFromMemoryForKey:testKey];
[SDImageCache.sharedImageCache removeImageFromDiskForKey:testKey];
NSData *imageData = [self testGIFData];
[SDImageCache.sharedImageCache storeImageDataToDisk:imageData forKey:testKey];
[imageView sd_setImageWithURL:testURL placeholderImage:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
expect(error).to.beNil();
expect(image).notTo.beNil();
expect(cacheType).equal(SDImageCacheTypeDisk);
expect([image isKindOfClass:[SDAnimatedImage class]]).beTruthy();
[SDImageCache.sharedImageCache removeImageFromMemoryForKey:testKey];
[SDImageCache.sharedImageCache removeImageFromDiskForKey:testKey];
[expectation fulfill];
}];
[self waitForExpectationsWithCommonTimeout];

View File

@ -123,11 +123,7 @@
#endif
expect(format.scale).equal(screenScale);
expect(format.opaque).beFalsy();
#if SD_UIKIT
expect(format.preferredRange).equal(SDGraphicsImageRendererFormatRangeAutomatic);
#elif SD_MAC
expect(format.preferredRange).equal(SDGraphicsImageRendererFormatRangeStandard);
#endif
CGSize size = CGSizeMake(100, 100);
SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format];
#if SD_MAC