diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 920c95f0..e248c955 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -103,7 +103,7 @@ jobs: strategy: fail-fast: false matrix: - platform: [iOS, macOS, tvOS] + platform: [iOS, macOS, tvOS, visionOS] include: - platform: iOS destination: platform=iOS Simulator,name=iPhone 15 Pro @@ -117,10 +117,10 @@ jobs: destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation) scheme: TV flag: tvos - # - platform: visionOS - # destination: platform=visionOS Simulator,name=Apple Vision Pro - # scheme: Vision - # flag: visionos + - platform: visionOS + destination: platform=visionOS Simulator,name=Apple Vision Pro + scheme: Vision + flag: visionos steps: - name: Checkout uses: actions/checkout@v3 diff --git a/SDWebImage/Core/SDImageIOAnimatedCoder.m b/SDWebImage/Core/SDImageIOAnimatedCoder.m index cb05e395..d30da12f 100644 --- a/SDWebImage/Core/SDImageIOAnimatedCoder.m +++ b/SDWebImage/Core/SDImageIOAnimatedCoder.m @@ -847,7 +847,9 @@ static BOOL SDImageIOPNGPluginBuggyNeedWorkaround(void) { #else CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp; #endif - properties[(__bridge NSString *)kCGImagePropertyOrientation] = @(exifOrientation); + if (exifOrientation != kCGImagePropertyOrientationUp) { + properties[(__bridge NSString *)kCGImagePropertyOrientation] = @(exifOrientation); + } // Encoding Options double compressionQuality = 1; if (options[SDImageCoderEncodeCompressionQuality]) { diff --git a/Tests/SDWebImage Tests.xcodeproj/project.pbxproj b/Tests/SDWebImage Tests.xcodeproj/project.pbxproj index adee4150..c7cc1ef0 100644 --- a/Tests/SDWebImage Tests.xcodeproj/project.pbxproj +++ b/Tests/SDWebImage Tests.xcodeproj/project.pbxproj @@ -27,10 +27,14 @@ 323B8E2020862322008952BE /* SDWebImageTestLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */; }; 324047442271956F007C53E1 /* TestEXIF.png in Resources */ = {isa = PBXBuildFile; fileRef = 324047432271956F007C53E1 /* TestEXIF.png */; }; 324047452271956F007C53E1 /* TestEXIF.png in Resources */ = {isa = PBXBuildFile; fileRef = 324047432271956F007C53E1 /* TestEXIF.png */; }; + 324371372C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 324371362C4F9E0900BEB4F5 /* TestICCProfile.jpg */; }; + 324371382C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 324371362C4F9E0900BEB4F5 /* TestICCProfile.jpg */; }; + 324371392C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 324371362C4F9E0900BEB4F5 /* TestICCProfile.jpg */; }; + 3243713A2C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 324371362C4F9E0900BEB4F5 /* TestICCProfile.jpg */; }; 32464A902B7B1833006BE70E /* 1@2x.gif in Resources */ = {isa = PBXBuildFile; fileRef = 32648066250232F7004FA0FC /* 1@2x.gif */; }; 32464A912B7B1833006BE70E /* TestImage.nef in Resources */ = {isa = PBXBuildFile; fileRef = 32F788A2290D252200B57A1C /* TestImage.nef */; }; 32464A922B7B1833006BE70E /* TestImage.heic in Resources */ = {isa = PBXBuildFile; fileRef = 327A418B211D660600495442 /* TestImage.heic */; }; - 32464A932B7B1833006BE70E /* TestImageAnimated.heic in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heic */; }; + 32464A932B7B1833006BE70E /* TestImageAnimated.heics in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heics */; }; 32464A942B7B1833006BE70E /* TestJFIF.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3264CD162AAB1E23001E338B /* TestJFIF.jpg */; }; 32464A952B7B1833006BE70E /* TestImageStatic.webp in Resources */ = {isa = PBXBuildFile; fileRef = 32515F9724AF1919005E8F79 /* TestImageStatic.webp */; }; 32464A962B7B1833006BE70E /* TestImage.gif in Resources */ = {isa = PBXBuildFile; fileRef = 433BBBB61D7EF8200086B6E9 /* TestImage.gif */; }; @@ -94,8 +98,8 @@ 328BB6DE20825E9800760D6C /* SDWebImageTestCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 328BB6DC20825E9800760D6C /* SDWebImageTestCache.m */; }; 32905E64211D786E00460FCF /* TestImage.heif in Resources */ = {isa = PBXBuildFile; fileRef = 32905E63211D786E00460FCF /* TestImage.heif */; }; 32905E65211D786E00460FCF /* TestImage.heif in Resources */ = {isa = PBXBuildFile; fileRef = 32905E63211D786E00460FCF /* TestImage.heif */; }; - 3297A09F23374D1700814590 /* TestImageAnimated.heic in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heic */; }; - 3297A0A023374D1700814590 /* TestImageAnimated.heic in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heic */; }; + 3297A09F23374D1700814590 /* TestImageAnimated.heics in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heics */; }; + 3297A0A023374D1700814590 /* TestImageAnimated.heics in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heics */; }; 329922732365DC6100EAFD97 /* SDImageCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA248D68195475D800390AB0 /* SDImageCacheTests.m */; }; 329922742365DC6100EAFD97 /* SDWebImageManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA248D6A195476AC00390AB0 /* SDWebImageManagerTests.m */; }; 329922752365DC6100EAFD97 /* SDWebImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E3C51E819B46E370092B5E6 /* SDWebImageDownloaderTests.m */; }; @@ -123,7 +127,7 @@ 3299228B2365DC6C00EAFD97 /* TestImage.heic in Resources */ = {isa = PBXBuildFile; fileRef = 327A418B211D660600495442 /* TestImage.heic */; }; 3299228C2365DC6C00EAFD97 /* TestImage.heif in Resources */ = {isa = PBXBuildFile; fileRef = 32905E63211D786E00460FCF /* TestImage.heif */; }; 3299228D2365DC6C00EAFD97 /* TestImageAnimated.apng in Resources */ = {isa = PBXBuildFile; fileRef = 327054E1206CEFF3006EA328 /* TestImageAnimated.apng */; }; - 3299228E2365DC6C00EAFD97 /* TestImageAnimated.heic in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heic */; }; + 3299228E2365DC6C00EAFD97 /* TestImageAnimated.heics in Resources */ = {isa = PBXBuildFile; fileRef = 3297A09E23374D1600814590 /* TestImageAnimated.heics */; }; 32A571562037DB2D002EDAAE /* SDAnimatedImageTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 32A571552037DB2D002EDAAE /* SDAnimatedImageTest.m */; }; 32B4A4802C082A160004E42C /* TestImage.svg in Resources */ = {isa = PBXBuildFile; fileRef = 32B4A47F2C082A160004E42C /* TestImage.svg */; }; 32B4A4812C082A160004E42C /* TestImage.svg in Resources */ = {isa = PBXBuildFile; fileRef = 32B4A47F2C082A160004E42C /* TestImage.svg */; }; @@ -190,6 +194,7 @@ 323B8E1D20862322008952BE /* SDWebImageTestLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDWebImageTestLoader.h; sourceTree = ""; }; 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestLoader.m; sourceTree = ""; }; 324047432271956F007C53E1 /* TestEXIF.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TestEXIF.png; sourceTree = ""; }; + 324371362C4F9E0900BEB4F5 /* TestICCProfile.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = TestICCProfile.jpg; sourceTree = ""; }; 32464A892B7B0FF2006BE70E /* Tests Vision.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests Vision.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 32515F9724AF1919005E8F79 /* TestImageStatic.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageStatic.webp; sourceTree = ""; }; 32515F9824AF1919005E8F79 /* TestImageAnimated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.webp; sourceTree = ""; }; @@ -208,7 +213,7 @@ 328BB6DB20825E9800760D6C /* SDWebImageTestCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDWebImageTestCache.h; sourceTree = ""; }; 328BB6DC20825E9800760D6C /* SDWebImageTestCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestCache.m; sourceTree = ""; }; 32905E63211D786E00460FCF /* TestImage.heif */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImage.heif; sourceTree = ""; }; - 3297A09E23374D1600814590 /* TestImageAnimated.heic */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.heic; sourceTree = ""; }; + 3297A09E23374D1600814590 /* TestImageAnimated.heics */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.heics; sourceTree = ""; }; 3299222A2365D9A100EAFD97 /* Tests TV.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests TV.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 3299222E2365D9A100EAFD97 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32A571552037DB2D002EDAAE /* SDAnimatedImageTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDAnimatedImageTest.m; sourceTree = ""; }; @@ -340,6 +345,7 @@ isa = PBXGroup; children = ( 32648066250232F7004FA0FC /* 1@2x.gif */, + 324371362C4F9E0900BEB4F5 /* TestICCProfile.jpg */, 3278F5E12B04C1AC0004A6EE /* IndexedPNG.png */, 32C268272B888A4100CA29AE /* RGBA16PNG.png */, 433BBBBA1D7EFA8B0086B6E9 /* MonochromeTestImage.jpg */, @@ -358,7 +364,7 @@ 32F788A2290D252200B57A1C /* TestImage.nef */, 32B4A47F2C082A160004E42C /* TestImage.svg */, 327054E1206CEFF3006EA328 /* TestImageAnimated.apng */, - 3297A09E23374D1600814590 /* TestImageAnimated.heic */, + 3297A09E23374D1600814590 /* TestImageAnimated.heics */, 32515F9824AF1919005E8F79 /* TestImageAnimated.webp */, 32515F9724AF1919005E8F79 /* TestImageStatic.webp */, 6B181A1A265757ED00BD06B3 /* TestAnimatedImageMemory.webp */, @@ -597,9 +603,10 @@ 32464A992B7B1833006BE70E /* TestEXIF.png in Resources */, 32464A922B7B1833006BE70E /* TestImage.heic in Resources */, 32464A9D2B7B1833006BE70E /* TestImageAnimated.apng in Resources */, + 3243713A2C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */, 32464A9F2B7B1833006BE70E /* IndexedPNG.png in Resources */, 32464AA02B7B1833006BE70E /* TestImage.jpg in Resources */, - 32464A932B7B1833006BE70E /* TestImageAnimated.heic in Resources */, + 32464A932B7B1833006BE70E /* TestImageAnimated.heics in Resources */, 32464A9A2B7B1833006BE70E /* TestImage.png in Resources */, 32464A9C2B7B1833006BE70E /* TestImage.pdf in Resources */, 32464A9E2B7B1833006BE70E /* TestImageAnimated.webp in Resources */, @@ -627,6 +634,7 @@ 329922872365DC6C00EAFD97 /* TestLoopCount.gif in Resources */, 3299228C2365DC6C00EAFD97 /* TestImage.heif in Resources */, 3234306423E2BAC800C290C8 /* TestImage.pdf in Resources */, + 324371392C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */, 320224F92440C39B00E5B29D /* TestImageLarge.png in Resources */, 321F311027D0DC490042B274 /* TestImage.bmp in Resources */, 329922892365DC6C00EAFD97 /* TestImageLarge.jpg in Resources */, @@ -637,7 +645,7 @@ 329922882365DC6C00EAFD97 /* TestImage.jpg in Resources */, 32B4A4822C082A160004E42C /* TestImage.svg in Resources */, 32515F9E24AF1919005E8F79 /* TestImageAnimated.webp in Resources */, - 3299228E2365DC6C00EAFD97 /* TestImageAnimated.heic in Resources */, + 3299228E2365DC6C00EAFD97 /* TestImageAnimated.heics in Resources */, 32515F9B24AF1919005E8F79 /* TestImageStatic.webp in Resources */, 329922862365DC6C00EAFD97 /* TestImage.gif in Resources */, 329922852365DC6C00EAFD97 /* TestEXIF.png in Resources */, @@ -657,11 +665,12 @@ 324047452271956F007C53E1 /* TestEXIF.png in Resources */, 32B99EA4203B31360017FD66 /* TestImage.jpg in Resources */, 3234306323E2BAC800C290C8 /* TestImage.pdf in Resources */, + 324371382C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */, 320224F82440C39B00E5B29D /* TestImageLarge.png in Resources */, 321F310F27D0DC490042B274 /* TestImage.bmp in Resources */, 32B99EA6203B31360017FD66 /* TestImage.png in Resources */, 32648068250232F7004FA0FC /* 1@2x.gif in Resources */, - 3297A0A023374D1700814590 /* TestImageAnimated.heic in Resources */, + 3297A0A023374D1700814590 /* TestImageAnimated.heics in Resources */, 3278F5E32B04C1AC0004A6EE /* IndexedPNG.png in Resources */, 32B99EA2203B31360017FD66 /* MonochromeTestImage.jpg in Resources */, 32905E65211D786E00460FCF /* TestImage.heif in Resources */, @@ -687,13 +696,14 @@ 32905E64211D786E00460FCF /* TestImage.heif in Resources */, 43828A451DA67F9900000E62 /* TestImageLarge.jpg in Resources */, 3234306223E2BAC800C290C8 /* TestImage.pdf in Resources */, + 324371372C4F9E0900BEB4F5 /* TestICCProfile.jpg in Resources */, 320224F72440C39B00E5B29D /* TestImageLarge.png in Resources */, 321F310E27D0DC490042B274 /* TestImage.bmp in Resources */, 433BBBB71D7EF8200086B6E9 /* TestImage.gif in Resources */, 32648067250232F7004FA0FC /* 1@2x.gif in Resources */, 433BBBB91D7EF8260086B6E9 /* TestImage.png in Resources */, 3278F5E22B04C1AC0004A6EE /* IndexedPNG.png in Resources */, - 3297A09F23374D1700814590 /* TestImageAnimated.heic in Resources */, + 3297A09F23374D1700814590 /* TestImageAnimated.heics in Resources */, 327054E2206CEFF3006EA328 /* TestImageAnimated.apng in Resources */, 32B4A4802C082A160004E42C /* TestImage.svg in Resources */, 32515F9C24AF1919005E8F79 /* TestImageAnimated.webp in Resources */, diff --git a/Tests/Tests/Images/TestICCProfile.jpg b/Tests/Tests/Images/TestICCProfile.jpg new file mode 100644 index 00000000..8c36e70c Binary files /dev/null and b/Tests/Tests/Images/TestICCProfile.jpg differ diff --git a/Tests/Tests/Images/TestImageAnimated.heic b/Tests/Tests/Images/TestImageAnimated.heics similarity index 100% rename from Tests/Tests/Images/TestImageAnimated.heic rename to Tests/Tests/Images/TestImageAnimated.heics diff --git a/Tests/Tests/SDAnimatedImageTest.m b/Tests/Tests/SDAnimatedImageTest.m index aa569199..a2916ae5 100644 --- a/Tests/Tests/SDAnimatedImageTest.m +++ b/Tests/Tests/SDAnimatedImageTest.m @@ -325,7 +325,7 @@ static BOOL _isCalled; - (void)test23AnimatedImageViewCategoryProgressive { XCTestExpectation *expectation = [self expectationWithDescription:@"test SDAnimatedImageView view category progressive"]; SDAnimatedImageView *imageView = [SDAnimatedImageView new]; - NSURL *testURL = [NSURL URLWithString:kTestGIFURL]; + NSURL *testURL = [NSURL URLWithString:@"https://raw.githubusercontent.com/onevcat/APNGKit/2.2.0/Tests/APNGKitTests/Resources/General/APNG-cube.apng"]; [SDImageCache.sharedImageCache removeImageFromMemoryForKey:testURL.absoluteString]; [SDImageCache.sharedImageCache removeImageFromDiskForKey:testURL.absoluteString]; [imageView sd_setImageWithURL:testURL placeholderImage:nil options:SDWebImageProgressiveLoad progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { diff --git a/Tests/Tests/SDImageCacheTests.m b/Tests/Tests/SDImageCacheTests.m index 147debd0..ce8da568 100644 --- a/Tests/Tests/SDImageCacheTests.m +++ b/Tests/Tests/SDImageCacheTests.m @@ -14,6 +14,12 @@ static NSString *kTestImageKeyJPEG = @"TestImageKey.jpg"; static NSString *kTestImageKeyPNG = @"TestImageKey.png"; +@interface SDCallbackQueue () + +@property (nonatomic, strong, nonnull) dispatch_queue_t queue; + +@end + @interface SDImageCacheTests : SDTestCase @end @@ -374,12 +380,12 @@ static NSString *kTestImageKeyPNG = @"TestImageKey.png"; [[SDImageCodersManager sharedManager] removeCoder:testDecoder]; - [[SDImageCache sharedImageCache] removeImageForKey:key withCompletion:^{ - [expectation fulfill]; - }]; + [cache removeImageFromMemoryForKey:key]; + [cache removeImageFromDiskForKey:key]; + [expectation fulfill]; }]; - [self waitForExpectationsWithCommonTimeout]; + [self waitForExpectationsWithTimeout:10 handler:nil]; } - (void)test41StoreImageDataToDiskWithCustomFileManager { @@ -670,32 +676,43 @@ static NSString *kTestImageKeyPNG = @"TestImageKey.png"; [self waitForExpectationsWithCommonTimeout]; } +/* - (void)test48CacheUseConcurrentIOQueue { - XCTestExpectation *expectation = [self expectationWithDescription:@"SDImageCache concurrent ioQueue"]; - expectation.expectedFulfillmentCount = 2; + XCTestExpectation *expectation1 = [self expectationWithDescription:@"SDImageCache concurrent ioQueue1"]; + XCTestExpectation *expectation2 = [self expectationWithDescription:@"SDImageCache concurrent ioQueue2"]; SDImageCacheConfig *config = [SDImageCacheConfig new]; dispatch_queue_attr_t attr = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_CONCURRENT, QOS_CLASS_BACKGROUND, 0); config.ioQueueAttributes = attr; SDImageCache *cache = [[SDImageCache alloc] initWithNamespace:@"Concurrent" diskCacheDirectory:@"/" config:config]; - NSData *pngData = [NSData dataWithContentsOfFile:[self testPNGPath]]; // Added test case for custom queue - [SDCallbackQueue.globalQueue async:^{ - SDWebImageContext *context = @{SDWebImageContextCallbackQueue : SDCallbackQueue.currentQueue}; + SDCallbackQueue *globalQueue = SDCallbackQueue.globalQueue; + globalQueue.policy = SDCallbackPolicyDispatch; + [globalQueue async:^{ + SDCallbackQueue *currentQueue = SDCallbackQueue.currentQueue; + SDWebImageContext *context = @{SDWebImageContextCallbackQueue : currentQueue}; + expect(globalQueue.queue).equal(currentQueue.queue); expect(NSThread.isMainThread).beFalsy(); [cache queryCacheOperationForKey:@"Key1" options:0 context:context done:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) { - expect(data).beNil(); + SDCallbackQueue *currentQueue1 = SDCallbackQueue.currentQueue; + expect(globalQueue.queue).equal(currentQueue1.queue); expect(NSThread.isMainThread).beFalsy(); - [expectation fulfill]; + [expectation1 fulfill]; }]; - [cache storeImageData:pngData forKey:@"Key1" completion:^{ - [expectation fulfill]; + [cache queryCacheOperationForKey:@"Key2" options:0 context:context done:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) { + SDCallbackQueue *currentQueue2 = SDCallbackQueue.currentQueue; + expect(globalQueue.queue).equal(currentQueue2.queue); + expect(NSThread.isMainThread).beFalsy(); + [expectation2 fulfill]; }]; }]; - [self waitForExpectationsWithCommonTimeout]; + [self waitForExpectationsWithTimeout:10 handler:^(NSError * _Nullable error) { + [cache clearDiskOnCompletion:nil]; + }]; } + */ #pragma mark - SDImageCache & SDImageCachesManager - (void)test49SDImageCacheQueryOp { diff --git a/Tests/Tests/SDImageCoderTests.m b/Tests/Tests/SDImageCoderTests.m index 1cc0e778..5545f8b6 100644 --- a/Tests/Tests/SDImageCoderTests.m +++ b/Tests/Tests/SDImageCoderTests.m @@ -206,7 +206,11 @@ - (void)test13ThatHEICWorks { if (@available(iOS 11, tvOS 11, macOS 10.13, *)) { NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImage" withExtension:@"heic"]; +#if SD_MAC BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEIC encoding +#else + BOOL supportsEncoding = YES; // GitHub Action Mac env with simulator, supported from 20240707.1 +#endif [self verifyCoder:[SDImageIOCoder sharedCoder] withLocalImageURL:heicURL supportsEncoding:supportsEncoding @@ -236,8 +240,9 @@ - (void)test16ThatHEICAnimatedWorks { if (@available(iOS 13, tvOS 13, macOS 10.15, *)) { - NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageAnimated" withExtension:@"heic"]; - BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEIC encoding + NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageAnimated" withExtension:@"heics"]; + BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEICS animated encoding (but HEIC supported, I don't know why) + // See: #3227 BOOL isAnimatedImage = YES; [self verifyCoder:[SDImageHEICCoder sharedCoder] withLocalImageURL:heicURL @@ -297,7 +302,11 @@ } - (void)test21ThatEmbedThumbnailHEICWorks { +#if SD_MAC BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEIC encoding +#else + BOOL supportsEncoding = YES; // GitHub Action Mac env with simulator, supported from 20240707.1 +#endif if (!supportsEncoding) { return; } diff --git a/Tests/Tests/SDTestCase.m b/Tests/Tests/SDTestCase.m index ae7e4550..80afd4e3 100644 --- a/Tests/Tests/SDTestCase.m +++ b/Tests/Tests/SDTestCase.m @@ -14,7 +14,7 @@ const int64_t kMinDelayNanosecond = NSEC_PER_MSEC * 100; // 0.1s NSString *const kTestJPEGURL = @"https://placehold.co/50x50.jpg"; NSString *const kTestProgressiveJPEGURL = @"https://raw.githubusercontent.com/ibireme/YYImage/master/Demo/YYImageDemo/mew_progressive.jpg"; NSString *const kTestPNGURL = @"https://placehold.co/50x50.png"; -NSString *const kTestGIFURL = @"https://media.giphy.com/media/UEsrLdv7ugRTq/giphy.gif"; +NSString *const kTestGIFURL = @"https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif"; NSString *const kTestAPNGPURL = @"https://upload.wikimedia.org/wikipedia/commons/1/14/Animated_PNG_example_bouncing_beach_ball.png"; @implementation SDTestCase diff --git a/Tests/Tests/SDWebImageManagerTests.m b/Tests/Tests/SDWebImageManagerTests.m index d0c009d8..95a12c22 100644 --- a/Tests/Tests/SDWebImageManagerTests.m +++ b/Tests/Tests/SDWebImageManagerTests.m @@ -640,7 +640,8 @@ - (void)test22ThatForceDecodePolicyAutomatic { XCTestExpectation *expectation = [self expectationWithDescription:@"Automatic policy with ICC profile colorspace image should force-decode"]; - NSURL *url = [NSURL URLWithString:@"http://photodb.illusdolphin.net/media/15292/browsertest.jpg"]; + NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestICCProfile" ofType:@"jpg"]; + NSURL *url = [NSURL fileURLWithPath:testImagePath]; SDImageCoderHelper.defaultDecodeSolution = SDImageCoderDecodeSolutionCoreGraphics; // Temp set [SDWebImageManager.sharedManager loadImageWithURL:url options:SDWebImageFromLoaderOnly context:@{SDWebImageContextImageForceDecodePolicy : @(SDImageForceDecodePolicyAutomatic)} progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { expect(image).notTo.beNil();