Fix the unit test on macOS
This commit is contained in:
parent
78fe2284e0
commit
b2d6372254
|
@ -290,22 +290,23 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (CGColorSpaceRef)colorSpaceGetDeviceRGB {
|
+ (CGColorSpaceRef)colorSpaceGetDeviceRGB {
|
||||||
|
#if SD_MAC
|
||||||
|
NSScreen *mainScreen = nil;
|
||||||
|
if (@available(macOS 10.12, *)) {
|
||||||
|
mainScreen = [NSScreen mainScreen];
|
||||||
|
} else {
|
||||||
|
mainScreen = [NSScreen screens].firstObject;
|
||||||
|
}
|
||||||
|
CGColorSpaceRef colorSpace = mainScreen.colorSpace.CGColorSpace;
|
||||||
|
return colorSpace;
|
||||||
|
#else
|
||||||
static CGColorSpaceRef colorSpace;
|
static CGColorSpaceRef colorSpace;
|
||||||
static dispatch_once_t onceToken;
|
static dispatch_once_t onceToken;
|
||||||
dispatch_once(&onceToken, ^{
|
dispatch_once(&onceToken, ^{
|
||||||
#if SD_MAC
|
|
||||||
NSScreen *mainScreen = nil;
|
|
||||||
if (@available(macOS 10.12, *)) {
|
|
||||||
mainScreen = [NSScreen mainScreen];
|
|
||||||
} else {
|
|
||||||
mainScreen = [NSScreen screens].firstObject;
|
|
||||||
}
|
|
||||||
colorSpace = mainScreen.colorSpace.CGColorSpace;
|
|
||||||
#else
|
|
||||||
colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
return colorSpace;
|
return colorSpace;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (SDImagePixelFormat)preferredPixelFormat:(BOOL)containsAlpha {
|
+ (SDImagePixelFormat)preferredPixelFormat:(BOOL)containsAlpha {
|
||||||
|
|
|
@ -217,7 +217,7 @@
|
||||||
- (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
|
BOOL supportsEncoding = NO; // public.heif UTI alwsays return false, use public.heic
|
||||||
[self verifyCoder:[SDImageIOCoder sharedCoder]
|
[self verifyCoder:[SDImageIOCoder sharedCoder]
|
||||||
withLocalImageURL:heifURL
|
withLocalImageURL:heifURL
|
||||||
supportsEncoding:supportsEncoding
|
supportsEncoding:supportsEncoding
|
||||||
|
|
Loading…
Reference in New Issue