From 64d12968fdbe94d7932feb5b8bb0b2c216e8efff Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sat, 24 Feb 2024 12:43:48 +0800 Subject: [PATCH] Remove the SDWebImageWebPCoder to its own repo --- Tests/Tests/SDAnimatedImageTest.m | 2 ++ Tests/Tests/SDImageCoderTests.m | 21 ++++----------------- Tests/Tests/SDWebImageManagerTests.m | 24 ------------------------ 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/Tests/Tests/SDAnimatedImageTest.m b/Tests/Tests/SDAnimatedImageTest.m index 37c6c431..3917a0c6 100644 --- a/Tests/Tests/SDAnimatedImageTest.m +++ b/Tests/Tests/SDAnimatedImageTest.m @@ -764,6 +764,7 @@ static BOOL _isCalled; [self waitForExpectationsWithTimeout:15 handler:nil]; } +#if !SD_TV - (void)test36AnimatedImageMemoryCost { if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) { [[SDImageCodersManager sharedManager] addCoder:[SDImageAWebPCoder sharedCoder]]; @@ -783,6 +784,7 @@ static BOOL _isCalled; [[SDImageCodersManager sharedManager] removeCoder:[SDImageAWebPCoder sharedCoder]]; } } +#endif #pragma mark - Helper diff --git a/Tests/Tests/SDImageCoderTests.m b/Tests/Tests/SDImageCoderTests.m index cf749b3a..75b6a992 100644 --- a/Tests/Tests/SDImageCoderTests.m +++ b/Tests/Tests/SDImageCoderTests.m @@ -9,13 +9,6 @@ #import "SDTestCase.h" #import "UIColor+SDHexString.h" -#if !SD_VISION -#if __has_include() -#import -#else -@import SDWebImageWebPCoder; -#endif -#endif @interface SDWebImageDecoderTests : SDTestCase @@ -273,15 +266,11 @@ isVectorImage:YES]; } +#if !SD_TV - (void)test18ThatStaticWebPWorks { if (@available(iOS 14, tvOS 14, macOS 11, *)) { NSURL *staticWebPURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageStatic" withExtension:@"webp"]; -#if SD_TV - /// TV OS does not support ImageIO's webp. - [self verifyCoder:[SDImageWebPCoder sharedCoder] -#else [self verifyCoder:[SDImageAWebPCoder sharedCoder] -#endif withLocalImageURL:staticWebPURL supportsEncoding:NO // Currently (iOS 14.0) seems no encoding support encodingFormat:SDImageFormatWebP @@ -289,16 +278,13 @@ isVectorImage:NO]; } } +#endif +#if !SD_TV - (void)test19ThatAnimatedWebPWorks { if (@available(iOS 14, tvOS 14, macOS 11, *)) { NSURL *staticWebPURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageAnimated" withExtension:@"webp"]; -#if SD_TV - /// TV OS does not support ImageIO's webp. - [self verifyCoder:[SDImageWebPCoder sharedCoder] -#else [self verifyCoder:[SDImageAWebPCoder sharedCoder] -#endif withLocalImageURL:staticWebPURL supportsEncoding:NO // Currently (iOS 14.0) seems no encoding support encodingFormat:SDImageFormatWebP @@ -306,6 +292,7 @@ isVectorImage:NO]; } } +#endif - (void)test20ThatImageIOAnimatedCoderAbstractClass { SDImageIOAnimatedCoder *coder = [[SDImageIOAnimatedCoder alloc] init]; diff --git a/Tests/Tests/SDWebImageManagerTests.m b/Tests/Tests/SDWebImageManagerTests.m index 5dd48a2a..ab808626 100644 --- a/Tests/Tests/SDWebImageManagerTests.m +++ b/Tests/Tests/SDWebImageManagerTests.m @@ -10,13 +10,6 @@ #import "SDWebImageTestTransformer.h" #import "SDWebImageTestCache.h" #import "SDWebImageTestLoader.h" -#if !SD_VISION -#if __has_include() -#import -#else -@import SDWebImageWebPCoder; -#endif -#endif // Keep strong references for object @interface SDObjectContainer : NSObject @@ -650,23 +643,6 @@ [self waitForExpectationsWithCommonTimeout]; } -#if !SD_VISION -- (void)test22ThatForceDecodePolicyAlways { - XCTestExpectation *expectation = [self expectationWithDescription:@"Always policy with WebP image (libwebp) should force-decode"]; - NSURL *url = [NSURL URLWithString:@"https://www.gstatic.com/webp/gallery/4.webp"]; - [SDWebImageManager.sharedManager loadImageWithURL:url options:SDWebImageFromLoaderOnly context:@{SDWebImageContextImageCoder : SDImageWebPCoder.sharedCoder, SDWebImageContextImageForceDecodePolicy : @(SDImageForceDecodePolicyAlways)} progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { - expect(image).notTo.beNil(); - expect(image.sd_isDecoded).beTruthy(); - CGImageRef cgImage = image.CGImage; - CGColorSpaceRef colorspace = CGImageGetColorSpace(cgImage); - expect(colorspace).equal([SDImageCoderHelper colorSpaceGetDeviceRGB]); - - [expectation fulfill]; - }]; - [self waitForExpectationsWithCommonTimeout]; -} -#endif - - (NSString *)testJPEGPath { NSBundle *testBundle = [NSBundle bundleForClass:[self class]]; return [testBundle pathForResource:@"TestImage" ofType:@"jpg"];