Remove the SDWebImageWebPCoder to its own repo

This commit is contained in:
DreamPiggy 2024-02-24 12:43:48 +08:00
parent c99b60eed0
commit 64d12968fd
3 changed files with 6 additions and 41 deletions

View File

@ -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

View File

@ -9,13 +9,6 @@
#import "SDTestCase.h"
#import "UIColor+SDHexString.h"
#if !SD_VISION
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>)
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
#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];

View File

@ -10,13 +10,6 @@
#import "SDWebImageTestTransformer.h"
#import "SDWebImageTestCache.h"
#import "SDWebImageTestLoader.h"
#if !SD_VISION
#if __has_include(<SDWebImageWebPCoder/SDWebImageWebPCoder.h>)
#import <SDWebImageWebPCoder/SDWebImageWebPCoder.h>
#else
@import SDWebImageWebPCoder;
#endif
#endif
// Keep strong references for object
@interface SDObjectContainer<ObjectType> : 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"];