Ignore the HEIC encoding unit test on GitHub CI environment
Seems they use VM solution and breaks Apple's ImageIO HEIC encoding
This commit is contained in:
parent
8fec5b7003
commit
11dcb29b4f
|
@ -69,6 +69,13 @@
|
||||||
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "CI"
|
||||||
|
value = "${CI}"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
</EnvironmentVariables>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|
|
@ -28,6 +28,15 @@
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
codeCoverageEnabled = "YES">
|
codeCoverageEnabled = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "329922292365D9A100EAFD97"
|
||||||
|
BuildableName = "Tests TV.xctest"
|
||||||
|
BlueprintName = "Tests TV"
|
||||||
|
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
|
@ -51,6 +60,22 @@
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "329922292365D9A100EAFD97"
|
||||||
|
BuildableName = "Tests TV.xctest"
|
||||||
|
BlueprintName = "Tests TV"
|
||||||
|
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "CI"
|
||||||
|
value = "${CI}"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
</EnvironmentVariables>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|
|
@ -47,6 +47,22 @@
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "32464A882B7B0FF2006BE70E"
|
||||||
|
BuildableName = "Tests Vision.xctest"
|
||||||
|
BlueprintName = "Tests Vision"
|
||||||
|
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "CI"
|
||||||
|
value = "${CI}"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
</EnvironmentVariables>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|
|
@ -28,6 +28,15 @@
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
codeCoverageEnabled = "YES">
|
codeCoverageEnabled = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "DA248D52195472AA00390AB0"
|
||||||
|
BuildableName = "Tests iOS.xctest"
|
||||||
|
BlueprintName = "Tests iOS"
|
||||||
|
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
|
@ -60,6 +69,13 @@
|
||||||
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
|
<EnvironmentVariables>
|
||||||
|
<EnvironmentVariable
|
||||||
|
key = "CI"
|
||||||
|
value = "${CI}"
|
||||||
|
isEnabled = "YES">
|
||||||
|
</EnvironmentVariable>
|
||||||
|
</EnvironmentVariables>
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|
|
@ -206,11 +206,7 @@
|
||||||
- (void)test13ThatHEICWorks {
|
- (void)test13ThatHEICWorks {
|
||||||
if (@available(iOS 11, tvOS 11, macOS 10.13, *)) {
|
if (@available(iOS 11, tvOS 11, macOS 10.13, *)) {
|
||||||
NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImage" withExtension:@"heic"];
|
NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImage" withExtension:@"heic"];
|
||||||
#if SD_UIKIT
|
BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEIC encoding
|
||||||
BOOL supportsEncoding = YES; // iPhone Simulator after Xcode 9.3 support HEIC encoding
|
|
||||||
#else
|
|
||||||
BOOL supportsEncoding = NO; // Travis-CI Mac env currently does not support HEIC encoding
|
|
||||||
#endif
|
|
||||||
[self verifyCoder:[SDImageIOCoder sharedCoder]
|
[self verifyCoder:[SDImageIOCoder sharedCoder]
|
||||||
withLocalImageURL:heicURL
|
withLocalImageURL:heicURL
|
||||||
supportsEncoding:supportsEncoding
|
supportsEncoding:supportsEncoding
|
||||||
|
@ -221,9 +217,10 @@
|
||||||
- (void)test14ThatHEIFWorks {
|
- (void)test14ThatHEIFWorks {
|
||||||
if (@available(iOS 11, tvOS 11, macOS 10.13, *)) {
|
if (@available(iOS 11, tvOS 11, macOS 10.13, *)) {
|
||||||
NSURL *heifURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImage" withExtension:@"heif"];
|
NSURL *heifURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImage" withExtension:@"heif"];
|
||||||
|
BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEIC encoding
|
||||||
[self verifyCoder:[SDImageIOCoder sharedCoder]
|
[self verifyCoder:[SDImageIOCoder sharedCoder]
|
||||||
withLocalImageURL:heifURL
|
withLocalImageURL:heifURL
|
||||||
supportsEncoding:NO
|
supportsEncoding:supportsEncoding
|
||||||
isAnimatedImage:NO];
|
isAnimatedImage:NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,13 +237,8 @@
|
||||||
- (void)test16ThatHEICAnimatedWorks {
|
- (void)test16ThatHEICAnimatedWorks {
|
||||||
if (@available(iOS 13, tvOS 13, macOS 10.15, *)) {
|
if (@available(iOS 13, tvOS 13, macOS 10.15, *)) {
|
||||||
NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageAnimated" withExtension:@"heic"];
|
NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageAnimated" withExtension:@"heic"];
|
||||||
#if SD_UIKIT
|
BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEIC encoding
|
||||||
BOOL isAnimatedImage = YES;
|
BOOL isAnimatedImage = YES;
|
||||||
BOOL supportsEncoding = YES; // iPhone Simulator after Xcode 9.3 support HEIC encoding
|
|
||||||
#else
|
|
||||||
BOOL isAnimatedImage = NO; // Travis-CI Mac env does not upgrade to macOS 10.15
|
|
||||||
BOOL supportsEncoding = NO; // Travis-CI Mac env currently does not support HEIC encoding
|
|
||||||
#endif
|
|
||||||
[self verifyCoder:[SDImageHEICCoder sharedCoder]
|
[self verifyCoder:[SDImageHEICCoder sharedCoder]
|
||||||
withLocalImageURL:heicURL
|
withLocalImageURL:heicURL
|
||||||
supportsEncoding:supportsEncoding
|
supportsEncoding:supportsEncoding
|
||||||
|
@ -305,6 +297,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)test21ThatEmbedThumbnailHEICWorks {
|
- (void)test21ThatEmbedThumbnailHEICWorks {
|
||||||
|
BOOL supportsEncoding = !SDTestCase.isCI; // GitHub Action Mac env currently does not support HEIC encoding
|
||||||
|
if (!supportsEncoding) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (@available(iOS 11, tvOS 11, macOS 10.13, *)) {
|
if (@available(iOS 11, tvOS 11, macOS 10.13, *)) {
|
||||||
// The input HEIC does not contains any embed thumbnail
|
// The input HEIC does not contains any embed thumbnail
|
||||||
NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImage" withExtension:@"heic"];
|
NSURL *heicURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImage" withExtension:@"heic"];
|
||||||
|
|
|
@ -30,6 +30,7 @@ FOUNDATION_EXPORT NSString * _Nonnull const kTestAPNGPURL;
|
||||||
@interface SDTestCase : XCTestCase
|
@interface SDTestCase : XCTestCase
|
||||||
|
|
||||||
@property (nonatomic, strong, null_resettable) UIWindow *window;
|
@property (nonatomic, strong, null_resettable) UIWindow *window;
|
||||||
|
@property (nonatomic, readonly, class, getter=isCI) BOOL CI; // Check if GitHub CI
|
||||||
|
|
||||||
- (void)waitForExpectationsWithCommonTimeout;
|
- (void)waitForExpectationsWithCommonTimeout;
|
||||||
- (void)waitForExpectationsWithCommonTimeoutUsingHandler:(nullable XCWaitCompletionHandler)handler;
|
- (void)waitForExpectationsWithCommonTimeoutUsingHandler:(nullable XCWaitCompletionHandler)handler;
|
||||||
|
|
|
@ -27,6 +27,19 @@ NSString *const kTestAPNGPURL = @"https://upload.wikimedia.org/wikipedia/commons
|
||||||
[self waitForExpectationsWithTimeout:kAsyncTestTimeout handler:handler];
|
[self waitForExpectationsWithTimeout:kAsyncTestTimeout handler:handler];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (BOOL)isCI {
|
||||||
|
// https://docs.github.com/en/actions/learn-github-actions/variables
|
||||||
|
NSDictionary *env = NSProcessInfo.processInfo.environment;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
NSLog(@"printenv: %@", env.description);
|
||||||
|
});
|
||||||
|
if ([[env valueForKey:@"CI"] isEqualToString:@"true"]) {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Helper
|
#pragma mark - Helper
|
||||||
- (UIWindow *)window {
|
- (UIWindow *)window {
|
||||||
if (!_window) {
|
if (!_window) {
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format];
|
SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format];
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
// GitHub action's Mac does not connect to a display, so the ImageRenderer color space is wrong :(
|
// GitHub action's Mac does not connect to a display, so the ImageRenderer color space is wrong :(
|
||||||
if (NSProcessInfo.processInfo.environment[@"GITHUB_ACTIONS"]) {
|
if (SDTestCase.isCI) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue