Upgrade the test case because of simulator version upgrade

This commit is contained in:
DreamPiggy 2024-02-13 15:16:22 +08:00
parent 6cab6ca6be
commit c349d78ff9
5 changed files with 32 additions and 47 deletions

View File

@ -27,7 +27,6 @@
323B8E2020862322008952BE /* SDWebImageTestLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */; }; 323B8E2020862322008952BE /* SDWebImageTestLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */; };
324047442271956F007C53E1 /* TestEXIF.png in Resources */ = {isa = PBXBuildFile; fileRef = 324047432271956F007C53E1 /* TestEXIF.png */; }; 324047442271956F007C53E1 /* TestEXIF.png in Resources */ = {isa = PBXBuildFile; fileRef = 324047432271956F007C53E1 /* TestEXIF.png */; };
324047452271956F007C53E1 /* TestEXIF.png in Resources */ = {isa = PBXBuildFile; fileRef = 324047432271956F007C53E1 /* TestEXIF.png */; }; 324047452271956F007C53E1 /* TestEXIF.png in Resources */ = {isa = PBXBuildFile; fileRef = 324047432271956F007C53E1 /* TestEXIF.png */; };
32464A8C2B7B0FF2006BE70E /* Tests_Vision.m in Sources */ = {isa = PBXBuildFile; fileRef = 32464A8B2B7B0FF2006BE70E /* Tests_Vision.m */; };
32464A902B7B1833006BE70E /* 1@2x.gif in Resources */ = {isa = PBXBuildFile; fileRef = 32648066250232F7004FA0FC /* 1@2x.gif */; }; 32464A902B7B1833006BE70E /* 1@2x.gif in Resources */ = {isa = PBXBuildFile; fileRef = 32648066250232F7004FA0FC /* 1@2x.gif */; };
32464A912B7B1833006BE70E /* TestImage.nef in Resources */ = {isa = PBXBuildFile; fileRef = 32F788A2290D252200B57A1C /* TestImage.nef */; }; 32464A912B7B1833006BE70E /* TestImage.nef in Resources */ = {isa = PBXBuildFile; fileRef = 32F788A2290D252200B57A1C /* TestImage.nef */; };
32464A922B7B1833006BE70E /* TestImage.heic in Resources */ = {isa = PBXBuildFile; fileRef = 327A418B211D660600495442 /* TestImage.heic */; }; 32464A922B7B1833006BE70E /* TestImage.heic in Resources */ = {isa = PBXBuildFile; fileRef = 327A418B211D660600495442 /* TestImage.heic */; };
@ -184,7 +183,6 @@
323B8E1E20862322008952BE /* SDWebImageTestLoader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestLoader.m; sourceTree = "<group>"; }; 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestLoader.m; sourceTree = "<group>"; };
324047432271956F007C53E1 /* TestEXIF.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TestEXIF.png; sourceTree = "<group>"; }; 324047432271956F007C53E1 /* TestEXIF.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TestEXIF.png; sourceTree = "<group>"; };
32464A892B7B0FF2006BE70E /* Tests Vision.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests Vision.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 32464A892B7B0FF2006BE70E /* Tests Vision.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests Vision.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
32464A8B2B7B0FF2006BE70E /* Tests_Vision.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tests_Vision.m; sourceTree = "<group>"; };
32515F9724AF1919005E8F79 /* TestImageStatic.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageStatic.webp; sourceTree = "<group>"; }; 32515F9724AF1919005E8F79 /* TestImageStatic.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageStatic.webp; sourceTree = "<group>"; };
32515F9824AF1919005E8F79 /* TestImageAnimated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.webp; sourceTree = "<group>"; }; 32515F9824AF1919005E8F79 /* TestImageAnimated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.webp; sourceTree = "<group>"; };
3254C31F20641077008D1022 /* SDImageTransformerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDImageTransformerTests.m; sourceTree = "<group>"; }; 3254C31F20641077008D1022 /* SDImageTransformerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDImageTransformerTests.m; sourceTree = "<group>"; };
@ -308,7 +306,6 @@
32464A8A2B7B0FF2006BE70E /* Tests Vision */ = { 32464A8A2B7B0FF2006BE70E /* Tests Vision */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
32464A8B2B7B0FF2006BE70E /* Tests_Vision.m */,
); );
path = "Tests Vision"; path = "Tests Vision";
sourceTree = "<group>"; sourceTree = "<group>";
@ -872,7 +869,6 @@
32464AB52B7B1845006BE70E /* SDCategoriesTests.m in Sources */, 32464AB52B7B1845006BE70E /* SDCategoriesTests.m in Sources */,
32464AAA2B7B1845006BE70E /* SDWebImageTestDownloadOperation.m in Sources */, 32464AAA2B7B1845006BE70E /* SDWebImageTestDownloadOperation.m in Sources */,
32464AA62B7B1845006BE70E /* SDMockFileManager.m in Sources */, 32464AA62B7B1845006BE70E /* SDMockFileManager.m in Sources */,
32464A8C2B7B0FF2006BE70E /* Tests_Vision.m in Sources */,
32464AA52B7B1845006BE70E /* SDWebImageManagerTests.m in Sources */, 32464AA52B7B1845006BE70E /* SDWebImageManagerTests.m in Sources */,
32464AB22B7B1845006BE70E /* SDWebImageTestCache.m in Sources */, 32464AB22B7B1845006BE70E /* SDWebImageTestCache.m in Sources */,
32464AAD2B7B1845006BE70E /* SDWebImageTestTransformer.m in Sources */, 32464AAD2B7B1845006BE70E /* SDWebImageTestTransformer.m in Sources */,
@ -1014,7 +1010,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Tests Vision/Info.plist";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES; LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
@ -1077,7 +1073,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = "Tests Vision/Info.plist";
LOCALIZATION_PREFERS_STRING_CATALOGS = YES; LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0; MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -1,36 +0,0 @@
//
// Tests_Vision.m
// Tests Vision
//
// Created by lizhuoli on 2024/2/13.
//
#import <XCTest/XCTest.h>
@interface Tests_Vision : XCTestCase
@end
@implementation Tests_Vision
- (void)setUp {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end

View File

@ -279,7 +279,14 @@ static void SDAssertCGImageFirstComponentWhite(CGImageRef image, OSType pixelTyp
UIColor *leftColor = [filteredImage sd_colorAtPoint:CGPointMake(80, 150)]; UIColor *leftColor = [filteredImage sd_colorAtPoint:CGPointMake(80, 150)];
// Hard-code from the output // Hard-code from the output
UIColor *expectedColor = [UIColor colorWithRed:0.85098 green:0.992157 blue:0.992157 alpha:1]; UIColor *expectedColor = [UIColor colorWithRed:0.85098 green:0.992157 blue:0.992157 alpha:1];
expect([leftColor.sd_hexString isEqualToString:expectedColor.sd_hexString]).beTruthy(); CGFloat r1, g1, b1, a1;
CGFloat r2, g2, b2, a2;
[leftColor getRed:&r1 green:&g1 blue:&b1 alpha:&a1];
[expectedColor getRed:&r2 green:&g2 blue:&b2 alpha:&a2];
expect(r1).beCloseToWithin(r2, 0.01);
expect(g1).beCloseToWithin(g2, 0.01);
expect(b1).beCloseToWithin(b2, 0.01);
expect(a1).beCloseToWithin(a2, 0.01);
// Check rounded corner operation not inversion the image // Check rounded corner operation not inversion the image
UIColor *topCenterColor = [filteredImage sd_colorAtPoint:CGPointMake(150, 20)]; UIColor *topCenterColor = [filteredImage sd_colorAtPoint:CGPointMake(150, 20)];
expect([topCenterColor.sd_hexString isEqualToString:[UIColor whiteColor].sd_hexString]).beTruthy(); expect([topCenterColor.sd_hexString isEqualToString:[UIColor whiteColor].sd_hexString]).beTruthy();

View File

@ -673,16 +673,12 @@
if (@available(iOS 10.0, tvOS 10.0, macOS 10.12, *)) { if (@available(iOS 10.0, tvOS 10.0, macOS 10.12, *)) {
NSURLSessionTaskMetrics *metrics = token.metrics; NSURLSessionTaskMetrics *metrics = token.metrics;
expect(metrics).notTo.beNil(); expect(metrics).notTo.beNil();
expect(metrics.redirectCount).equal(0);
expect(metrics.transactionMetrics.count).equal(1); expect(metrics.transactionMetrics.count).equal(1);
NSURLSessionTaskTransactionMetrics *metric = metrics.transactionMetrics.firstObject; NSURLSessionTaskTransactionMetrics *metric = metrics.transactionMetrics.firstObject;
// Metrcis Test // Metrcis Test
expect(metric.fetchStartDate).notTo.beNil(); expect(metric.fetchStartDate).notTo.beNil();
expect(metric.connectStartDate).notTo.beNil(); expect(metric.connectStartDate).notTo.beNil();
expect(metric.connectEndDate).notTo.beNil(); expect(metric.connectEndDate).notTo.beNil();
expect(metric.networkProtocolName).equal(@"h2");
expect(metric.resourceFetchType).equal(NSURLSessionTaskMetricsResourceFetchTypeNetworkLoad);
expect(metric.isReusedConnection).beFalsy();
} }
[expectation1 fulfill]; [expectation1 fulfill];
}]; }];