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

View File

@ -259,7 +259,7 @@ static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to over
CGContextRef context = NULL; CGContextRef context = NULL;
if (@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)) { 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 // 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); bitmapInfo = CGImageGetBitmapInfo(cgImage);
context = CGBitmapContextCreate(NULL, newWidth, newHeight, 8, 0, [self colorSpaceGetDeviceRGB], bitmapInfo); 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. // to create bitmap graphics contexts without alpha info.
CGBitmapInfo bitmapInfo; CGBitmapInfo bitmapInfo;
if (@available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)) { 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 // Update for iOS 15: CoreGraphics's draw image will fail to transcode 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(sourceImageRef); bitmapInfo = CGImageGetBitmapInfo(sourceImageRef);
destContext = CGBitmapContextCreate(NULL, destContext = CGBitmapContextCreate(NULL,
destResolution.width, destResolution.width,

View File

@ -406,6 +406,16 @@
CGImageRelease(leftCGImage); 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 #pragma mark - Helper
- (UIImage *)testImageCG { - (UIImage *)testImageCG {