Update the test case and use Xcode 13.2.1 with iOS 15.3+ simulator

This commit is contained in:
lizhuoli 2022-03-03 22:06:04 +08:00
parent 64902962e3
commit 6dcbec2b87
3 changed files with 17 additions and 7 deletions

View File

@ -13,7 +13,7 @@ jobs:
name: Cocoapods Lint
runs-on: macos-11
env:
DEVELOPER_DIR: /Applications/Xcode_13.0.app
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
steps:
- name: Checkout
uses: actions/checkout@v2
@ -39,7 +39,7 @@ jobs:
name: Run Demo
runs-on: macos-11
env:
DEVELOPER_DIR: /Applications/Xcode_13.0.app
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
WORKSPACE_NAME: SDWebImage.xcworkspace
OSXSCHEME: SDWebImage OSX Demo
iOSSCHEME: SDWebImage iOS Demo
@ -92,7 +92,7 @@ jobs:
name: Unit Test
runs-on: macos-11
env:
DEVELOPER_DIR: /Applications/Xcode_13.0.app
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
WORKSPACE_NAME: SDWebImage.xcworkspace
strategy:
matrix:
@ -151,7 +151,7 @@ jobs:
name: Build Library
runs-on: macos-11
env:
DEVELOPER_DIR: /Applications/Xcode_13.0.app
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
PROJECT_NAME: SDWebImage.xcodeproj
SCHEME_NAME: SDWebImage
steps:

View File

@ -259,7 +259,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
CGContextRef context = NULL;
if (@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)) {
// Update for iOS 15: CoreGraphics's draw image will fail to transcode and draw some special CGImage on BGRX8888
// We prefer to use the input CGImaage's bitmap firstly, then fallback to BGRA. See #3330
// We prefer to use the input CGImage's bitmap firstly, then fallback to BGRAX8888. See #3330
bitmapInfo = CGImageGetBitmapInfo(cgImage);
context = CGBitmapContextCreate(NULL, newWidth, newHeight, 8, 0, [self colorSpaceGetDeviceRGB], bitmapInfo);
}
@ -396,8 +396,8 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
// to create bitmap graphics contexts without alpha info.
CGBitmapInfo bitmapInfo;
if (@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)) {
// Update for iOS 15: CoreGraphics's draw image will fail to transcode and draw some special CGImage on BGRX8888
// We prefer to use the input CGImaage's bitmap firstly, then fallback to BGRA. See #3330
// Update for iOS 15: CoreGraphics's draw image will fail to transcode some special CGImage on BGRX8888
// We prefer to use the input CGImage's bitmap firstly, then fallback to BGRAX8888. See #3330
bitmapInfo = CGImageGetBitmapInfo(sourceImageRef);
destContext = CGBitmapContextCreate(NULL,
destResolution.width,

View File

@ -406,6 +406,16 @@
CGImageRelease(leftCGImage);
}
- (void)test21BMPImageCreateDecodedShouldNotBlank {
UIImage *testImage = [[UIImage alloc] initWithContentsOfFile:[self testBMPPathForName:@"TestImage"]];
CGImageRef cgImage = testImage.CGImage;
expect(cgImage).notTo.beNil();
UIImage *decodedImage = [SDImageCoderHelper decodedImageWithImage:testImage];
expect(decodedImage).notTo.beNil();
UIColor *testColor = [decodedImage sd_colorAtPoint:CGPointMake(100, 100)];
expect([[testColor sd_hexString] isEqualToString:@"#ff0a64bf"]).beTruthy();
}
#pragma mark - Helper
- (UIImage *)testImageCG {