Added test case test22ThatThumbnailPreserveAspectRatio

This commit is contained in:
DreamPiggy 2022-06-12 16:44:21 +08:00
parent f90373ce14
commit 3b0b232616
1 changed files with 12 additions and 0 deletions

View File

@ -341,6 +341,18 @@
}
}
- (void)test22ThatThumbnailPreserveAspectRatio {
NSString *testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImageLarge" ofType:@"jpg"];
NSData *testImageData = [NSData dataWithContentsOfFile:testImagePath];
CGSize thumbnailSize = CGSizeMake(400, 300);
UIImage *image = [SDImageIOCoder.sharedCoder decodedImageWithData:testImageData options:@{
SDImageCoderDecodePreserveAspectRatio: @(YES),
SDImageCoderDecodeThumbnailPixelSize: @(thumbnailSize)}];
CGSize imageSize = image.size;
expect(imageSize.width).equal(400);
expect(imageSize.height).equal(263);
}
#pragma mark - Utils
- (void)verifyCoder:(id<SDImageCoder>)coder