Added the test case `testWebPDecodeDoesNotTriggerCACopyImage`
This commit is contained in:
parent
4b45cdde01
commit
8bae908c18
Binary file not shown.
After Width: | Height: | Size: 93 KiB |
|
@ -218,6 +218,18 @@ const int64_t kAsyncTestTimeout = 5;
|
|||
XCTAssertLessThanOrEqual(dataWithLimit.length, maxFileSize);
|
||||
}
|
||||
|
||||
- (void)testWebPDecodeDoesNotTriggerCACopyImage {
|
||||
NSURL *staticWebPURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestColorspaceStatic" withExtension:@"webp"];
|
||||
NSData *data = [NSData dataWithContentsOfURL:staticWebPURL];
|
||||
UIImage *image = [SDImageWebPCoder.sharedCoder decodedImageWithData:data options:@{SDImageCoderDecodeThumbnailPixelSize: @(CGSizeMake(1023, 680))}]; // 1023 * 4 need aligned to 4096
|
||||
CGImageRef cgImage = [image CGImage];
|
||||
size_t bytesPerRow = CGImageGetBytesPerRow(cgImage);
|
||||
XCTAssertEqual(bytesPerRow, 4096);
|
||||
CGColorSpaceRef colorspace = CGImageGetColorSpace(cgImage);
|
||||
NSString *colorspaceName = (__bridge_transfer NSString *)CGColorSpaceCopyName(colorspace);
|
||||
XCTAssertEqual(colorspaceName, (__bridge NSString *)kCGColorSpaceSRGB, @"Color space is not sRGB");
|
||||
}
|
||||
|
||||
- (void)testEncodingSettings {
|
||||
WebPConfig config;
|
||||
WebPConfigPreset(&config, WEBP_PRESET_DEFAULT, 0.2);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
0EF5B6264833B7BC20894578 /* Pods_SDWebImageWebPCoderTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 46F21AD7D1692EBAC4D0FF33 /* Pods_SDWebImageWebPCoderTests.framework */; };
|
||||
3219F3B2228B0453003822A6 /* TestImageBlendAnimated.webp in Resources */ = {isa = PBXBuildFile; fileRef = 3219F3B1228B0453003822A6 /* TestImageBlendAnimated.webp */; };
|
||||
325E268E25C82BE1000B807B /* TestImageGrayscale.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 325E268D25C82BE1000B807B /* TestImageGrayscale.jpg */; };
|
||||
326420312A5D53E300EE3E46 /* TestColorspaceStatic.webp in Resources */ = {isa = PBXBuildFile; fileRef = 326420302A5D53E300EE3E46 /* TestColorspaceStatic.webp */; };
|
||||
808C918E213FD131004B0F7C /* SDWebImageWebPCoderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 808C918D213FD131004B0F7C /* SDWebImageWebPCoderTests.m */; };
|
||||
808C919C213FD2B2004B0F7C /* TestImageStatic.webp in Resources */ = {isa = PBXBuildFile; fileRef = 808C919A213FD2B2004B0F7C /* TestImageStatic.webp */; };
|
||||
808C919D213FD2B2004B0F7C /* TestImageAnimated.webp in Resources */ = {isa = PBXBuildFile; fileRef = 808C919B213FD2B2004B0F7C /* TestImageAnimated.webp */; };
|
||||
|
@ -19,6 +20,7 @@
|
|||
28D8AA3D3015E075692FD3E3 /* Pods-SDWebImageWebPCoderTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageWebPCoderTests.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-SDWebImageWebPCoderTests/Pods-SDWebImageWebPCoderTests.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
3219F3B1228B0453003822A6 /* TestImageBlendAnimated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageBlendAnimated.webp; sourceTree = "<group>"; };
|
||||
325E268D25C82BE1000B807B /* TestImageGrayscale.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = TestImageGrayscale.jpg; sourceTree = "<group>"; };
|
||||
326420302A5D53E300EE3E46 /* TestColorspaceStatic.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestColorspaceStatic.webp; sourceTree = "<group>"; };
|
||||
46F21AD7D1692EBAC4D0FF33 /* Pods_SDWebImageWebPCoderTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SDWebImageWebPCoderTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
808C918B213FD130004B0F7C /* SDWebImageWebPCoderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SDWebImageWebPCoderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
808C918D213FD131004B0F7C /* SDWebImageWebPCoderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageWebPCoderTests.m; sourceTree = "<group>"; };
|
||||
|
@ -80,6 +82,7 @@
|
|||
808C9199213FD2B2004B0F7C /* Images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
326420302A5D53E300EE3E46 /* TestColorspaceStatic.webp */,
|
||||
325E268D25C82BE1000B807B /* TestImageGrayscale.jpg */,
|
||||
808C919A213FD2B2004B0F7C /* TestImageStatic.webp */,
|
||||
808C919B213FD2B2004B0F7C /* TestImageAnimated.webp */,
|
||||
|
@ -157,6 +160,7 @@
|
|||
3219F3B2228B0453003822A6 /* TestImageBlendAnimated.webp in Resources */,
|
||||
808C919D213FD2B2004B0F7C /* TestImageAnimated.webp in Resources */,
|
||||
808C919C213FD2B2004B0F7C /* TestImageStatic.webp in Resources */,
|
||||
326420312A5D53E300EE3E46 /* TestColorspaceStatic.webp in Resources */,
|
||||
325E268E25C82BE1000B807B /* TestImageGrayscale.jpg in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -377,6 +381,7 @@
|
|||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.SDWebImage.SDWebImageWebPCoderTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
|
@ -387,6 +392,7 @@
|
|||
baseConfigurationReference = D92E6791BF088D1A101E670E /* Pods-SDWebImageWebPCoderTests.release.xcconfig */;
|
||||
buildSettings = {
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.SDWebImage.SDWebImageWebPCoderTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue