diff --git a/Tests/SDWebImage Tests.xcodeproj/project.pbxproj b/Tests/SDWebImage Tests.xcodeproj/project.pbxproj index 1c09ca2e..2b2db1ed 100644 --- a/Tests/SDWebImage Tests.xcodeproj/project.pbxproj +++ b/Tests/SDWebImage Tests.xcodeproj/project.pbxproj @@ -27,7 +27,6 @@ 323B8E2020862322008952BE /* SDWebImageTestLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 323B8E1E20862322008952BE /* SDWebImageTestLoader.m */; }; 324047442271956F007C53E1 /* 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 */; }; 32464A912B7B1833006BE70E /* TestImage.nef in Resources */ = {isa = PBXBuildFile; fileRef = 32F788A2290D252200B57A1C /* TestImage.nef */; }; 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 = ""; }; 324047432271956F007C53E1 /* TestEXIF.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TestEXIF.png; sourceTree = ""; }; 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 = ""; }; 32515F9724AF1919005E8F79 /* TestImageStatic.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageStatic.webp; sourceTree = ""; }; 32515F9824AF1919005E8F79 /* TestImageAnimated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.webp; sourceTree = ""; }; 3254C31F20641077008D1022 /* SDImageTransformerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDImageTransformerTests.m; sourceTree = ""; }; @@ -308,7 +306,6 @@ 32464A8A2B7B0FF2006BE70E /* Tests Vision */ = { isa = PBXGroup; children = ( - 32464A8B2B7B0FF2006BE70E /* Tests_Vision.m */, ); path = "Tests Vision"; sourceTree = ""; @@ -872,7 +869,6 @@ 32464AB52B7B1845006BE70E /* SDCategoriesTests.m in Sources */, 32464AAA2B7B1845006BE70E /* SDWebImageTestDownloadOperation.m in Sources */, 32464AA62B7B1845006BE70E /* SDMockFileManager.m in Sources */, - 32464A8C2B7B0FF2006BE70E /* Tests_Vision.m in Sources */, 32464AA52B7B1845006BE70E /* SDWebImageManagerTests.m in Sources */, 32464AB22B7B1845006BE70E /* SDWebImageTestCache.m in Sources */, 32464AAD2B7B1845006BE70E /* SDWebImageTestTransformer.m in Sources */, @@ -1014,7 +1010,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Tests Vision/Info.plist"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; @@ -1077,7 +1073,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Tests Vision/Info.plist"; LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MARKETING_VERSION = 1.0; MTL_ENABLE_DEBUG_INFO = NO; diff --git a/Tests/Tests Vision/Info.plist b/Tests/Tests Vision/Info.plist new file mode 100644 index 00000000..64d65ca4 --- /dev/null +++ b/Tests/Tests Vision/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/Tests/Tests Vision/Tests_Vision.m b/Tests/Tests Vision/Tests_Vision.m deleted file mode 100644 index 634170ce..00000000 --- a/Tests/Tests Vision/Tests_Vision.m +++ /dev/null @@ -1,36 +0,0 @@ -// -// Tests_Vision.m -// Tests Vision -// -// Created by lizhuoli on 2024/2/13. -// - -#import - -@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 diff --git a/Tests/Tests/SDImageTransformerTests.m b/Tests/Tests/SDImageTransformerTests.m index 79f64c68..17a06ee8 100644 --- a/Tests/Tests/SDImageTransformerTests.m +++ b/Tests/Tests/SDImageTransformerTests.m @@ -279,7 +279,14 @@ static void SDAssertCGImageFirstComponentWhite(CGImageRef image, OSType pixelTyp UIColor *leftColor = [filteredImage sd_colorAtPoint:CGPointMake(80, 150)]; // Hard-code from the output 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 UIColor *topCenterColor = [filteredImage sd_colorAtPoint:CGPointMake(150, 20)]; expect([topCenterColor.sd_hexString isEqualToString:[UIColor whiteColor].sd_hexString]).beTruthy(); diff --git a/Tests/Tests/SDWebImageDownloaderTests.m b/Tests/Tests/SDWebImageDownloaderTests.m index 37dbd18b..e80ffa92 100644 --- a/Tests/Tests/SDWebImageDownloaderTests.m +++ b/Tests/Tests/SDWebImageDownloaderTests.m @@ -673,16 +673,12 @@ if (@available(iOS 10.0, tvOS 10.0, macOS 10.12, *)) { NSURLSessionTaskMetrics *metrics = token.metrics; expect(metrics).notTo.beNil(); - expect(metrics.redirectCount).equal(0); expect(metrics.transactionMetrics.count).equal(1); NSURLSessionTaskTransactionMetrics *metric = metrics.transactionMetrics.firstObject; // Metrcis Test expect(metric.fetchStartDate).notTo.beNil(); expect(metric.connectStartDate).notTo.beNil(); expect(metric.connectEndDate).notTo.beNil(); - expect(metric.networkProtocolName).equal(@"h2"); - expect(metric.resourceFetchType).equal(NSURLSessionTaskMetricsResourceFetchTypeNetworkLoad); - expect(metric.isReusedConnection).beFalsy(); } [expectation1 fulfill]; }];