Add tests scheme for macOS. Because we now support cross-platform, some implementation is different from UIKit & AppKit. So we also need test

This commit is contained in:
DreamPiggy 2018-02-20 00:36:52 +08:00
parent da807416b0
commit 9d78dccac7
18 changed files with 436 additions and 27 deletions

View File

@ -47,6 +47,9 @@ script:
- xcodebuild clean -workspace SDWebImage.xcworkspace -scheme 'SDWebImage iOS' -sdk iphonesimulator PLATFORM_NAME=iphonesimulator -configuration Debug | xcpretty -c
- xcodebuild clean -workspace SDWebImage.xcworkspace -scheme 'SDWebImage iOS Demo' -configuration Debug -destination 'name=iPhone 6s' | xcpretty -c
- xcodebuild test -workspace SDWebImage.xcworkspace -scheme 'Tests' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -configuration Debug | xcpretty -c
- xcodebuild clean -workspace SDWebImage.xcworkspace -scheme 'SDWebImage OSX' -sdk macosx -configuration Debug | xcpretty -c
- xcodebuild clean -workspace SDWebImage.xcworkspace -scheme 'SDWebImage OSX Demo' -sdk macosx -configuration Debug | xcpretty -c
- xcodebuild test -workspace SDWebImage.xcworkspace -scheme 'Tests Mac' -sdk macosx -destination 'platform=OS X,arch=x86_64' -configuration Debug | xcpretty -c
after_success:
- bash <(curl -s https://codecov.io/bash)

View File

@ -14,3 +14,12 @@ target 'Tests' do
pod 'SDWebImage/GIF', :path => '../'
end
target 'Tests Mac' do
platform :osx, '10.10'
pod 'Expecta'
pod 'KVOController'
pod 'SDWebImage/WebP', :path => '../'
pod 'SDWebImage/MapKit', :path => '../'
end

View File

@ -7,11 +7,29 @@
objects = {
/* Begin PBXBuildFile section */
0314594336AFF15E5BB7F0E6 /* Pods_Tests_Mac.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C140E5ED8501C2ABBFD97A24 /* Pods_Tests_Mac.framework */; };
1E3C51E919B46E370092B5E6 /* SDWebImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E3C51E819B46E370092B5E6 /* SDWebImageDownloaderTests.m */; };
2D7AF0601F329763000083C2 /* SDTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D7AF05F1F329763000083C2 /* SDTestCase.m */; };
321259EC1F39E3240096FE0E /* TestImageStatic.webp in Resources */ = {isa = PBXBuildFile; fileRef = 321259EB1F39E3240096FE0E /* TestImageStatic.webp */; };
321259EE1F39E4110096FE0E /* TestImageAnimated.webp in Resources */ = {isa = PBXBuildFile; fileRef = 321259ED1F39E4110096FE0E /* TestImageAnimated.webp */; };
32B99E8B203AF8690017FD66 /* SDCategoriesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B99E8A203AF8690017FD66 /* SDCategoriesTests.m */; };
32B99E9B203B2EDD0017FD66 /* SDTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D7AF05F1F329763000083C2 /* SDTestCase.m */; };
32B99E9C203B2EE40017FD66 /* SDCategoriesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 32B99E8A203AF8690017FD66 /* SDCategoriesTests.m */; };
32B99E9D203B2F7D0017FD66 /* SDWebImageTestDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E6F0311F3A1B4700A945E6 /* SDWebImageTestDecoder.m */; };
32B99E9E203B2F810017FD66 /* SDMockFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 37D122871EC48B5E00D98CEB /* SDMockFileManager.m */; };
32B99EA2203B31360017FD66 /* MonochromeTestImage.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 433BBBBA1D7EFA8B0086B6E9 /* MonochromeTestImage.jpg */; };
32B99EA3203B31360017FD66 /* TestImage.gif in Resources */ = {isa = PBXBuildFile; fileRef = 433BBBB61D7EF8200086B6E9 /* TestImage.gif */; };
32B99EA4203B31360017FD66 /* TestImage.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 5F7F38AC1AE2A77A00B0E330 /* TestImage.jpg */; };
32B99EA5203B31360017FD66 /* TestImageLarge.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 43828A441DA67F9900000E62 /* TestImageLarge.jpg */; };
32B99EA6203B31360017FD66 /* TestImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 433BBBB81D7EF8260086B6E9 /* TestImage.png */; };
32B99EA7203B31360017FD66 /* TestImageAnimated.webp in Resources */ = {isa = PBXBuildFile; fileRef = 321259ED1F39E4110096FE0E /* TestImageAnimated.webp */; };
32B99EA8203B31360017FD66 /* TestImageStatic.webp in Resources */ = {isa = PBXBuildFile; fileRef = 321259EB1F39E3240096FE0E /* TestImageStatic.webp */; };
32B99EA9203B34B60017FD66 /* SDWebImageDecoderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 433BBBB41D7EF5C00086B6E9 /* SDWebImageDecoderTests.m */; };
32B99EAA203B365F0017FD66 /* SDImageCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA248D68195475D800390AB0 /* SDImageCacheTests.m */; };
32B99EAB203B36620017FD66 /* SDWebImageManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA248D6A195476AC00390AB0 /* SDWebImageManagerTests.m */; };
32B99EAC203B36650017FD66 /* SDWebImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 1E3C51E819B46E370092B5E6 /* SDWebImageDownloaderTests.m */; };
32B99EAD203B36690017FD66 /* SDWebImagePrefetcherTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4369C1D01D97F80F007E863A /* SDWebImagePrefetcherTests.m */; };
32B99EAE203B366C0017FD66 /* SDWebCacheCategoriesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4369C2731D9804B1007E863A /* SDWebCacheCategoriesTests.m */; };
32E6F0321F3A1B4700A945E6 /* SDWebImageTestDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 32E6F0311F3A1B4700A945E6 /* SDWebImageTestDecoder.m */; };
37D122881EC48B5E00D98CEB /* SDMockFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 37D122871EC48B5E00D98CEB /* SDMockFileManager.m */; };
433BBBB51D7EF5C00086B6E9 /* SDWebImageDecoderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 433BBBB41D7EF5C00086B6E9 /* SDWebImageDecoderTests.m */; };
@ -39,10 +57,13 @@
321259EB1F39E3240096FE0E /* TestImageStatic.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageStatic.webp; sourceTree = "<group>"; };
321259ED1F39E4110096FE0E /* TestImageAnimated.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = TestImageAnimated.webp; sourceTree = "<group>"; };
32B99E8A203AF8690017FD66 /* SDCategoriesTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDCategoriesTests.m; sourceTree = "<group>"; };
32B99E92203B2DF90017FD66 /* Tests Mac.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests Mac.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
32B99E96203B2DF90017FD66 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
32E6F0301F3A1B4700A945E6 /* SDWebImageTestDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDWebImageTestDecoder.h; sourceTree = "<group>"; };
32E6F0311F3A1B4700A945E6 /* SDWebImageTestDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebImageTestDecoder.m; sourceTree = "<group>"; };
37D122861EC48B5E00D98CEB /* SDMockFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDMockFileManager.h; sourceTree = "<group>"; };
37D122871EC48B5E00D98CEB /* SDMockFileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDMockFileManager.m; sourceTree = "<group>"; };
3B82F4E5C79656CB9C5667F6 /* Pods-Tests Mac.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests Mac.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests Mac/Pods-Tests Mac.debug.xcconfig"; sourceTree = "<group>"; };
433BBBB41D7EF5C00086B6E9 /* SDWebImageDecoderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebImageDecoderTests.m; sourceTree = "<group>"; };
433BBBB61D7EF8200086B6E9 /* TestImage.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = TestImage.gif; sourceTree = "<group>"; };
433BBBB81D7EF8260086B6E9 /* TestImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = TestImage.png; sourceTree = "<group>"; };
@ -50,9 +71,11 @@
4369C1D01D97F80F007E863A /* SDWebImagePrefetcherTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebImagePrefetcherTests.m; sourceTree = "<group>"; };
4369C2731D9804B1007E863A /* SDWebCacheCategoriesTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDWebCacheCategoriesTests.m; sourceTree = "<group>"; };
43828A441DA67F9900000E62 /* TestImageLarge.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = TestImageLarge.jpg; sourceTree = "<group>"; };
5420AE085F25F0E156B00284 /* Pods-Tests Mac.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests Mac.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests Mac/Pods-Tests Mac.release.xcconfig"; sourceTree = "<group>"; };
5F7F38AC1AE2A77A00B0E330 /* TestImage.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = TestImage.jpg; sourceTree = "<group>"; };
700B00151041D7EE118B1ABD /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig"; sourceTree = "<group>"; };
A0085854E7D88C98F2F6C9FC /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig"; sourceTree = "<group>"; };
C140E5ED8501C2ABBFD97A24 /* Pods_Tests_Mac.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests_Mac.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA248D53195472AA00390AB0 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
DA248D56195472AA00390AB0 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
DA248D58195472AA00390AB0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
@ -65,6 +88,14 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
32B99E8F203B2DF90017FD66 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0314594336AFF15E5BB7F0E6 /* Pods_Tests_Mac.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
DA248D50195472AA00390AB0 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@ -79,11 +110,35 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
32B99E93203B2DF90017FD66 /* Tests Mac */ = {
isa = PBXGroup;
children = (
32B99E96203B2DF90017FD66 /* Info.plist */,
);
path = "Tests Mac";
sourceTree = "<group>";
};
32B99EA1203B30DF0017FD66 /* Images */ = {
isa = PBXGroup;
children = (
433BBBBA1D7EFA8B0086B6E9 /* MonochromeTestImage.jpg */,
433BBBB61D7EF8200086B6E9 /* TestImage.gif */,
5F7F38AC1AE2A77A00B0E330 /* TestImage.jpg */,
43828A441DA67F9900000E62 /* TestImageLarge.jpg */,
433BBBB81D7EF8260086B6E9 /* TestImage.png */,
321259ED1F39E4110096FE0E /* TestImageAnimated.webp */,
321259EB1F39E3240096FE0E /* TestImageStatic.webp */,
);
path = Images;
sourceTree = "<group>";
};
3E8D7663CD326C6F44B23889 /* Pods */ = {
isa = PBXGroup;
children = (
700B00151041D7EE118B1ABD /* Pods-Tests.debug.xcconfig */,
A0085854E7D88C98F2F6C9FC /* Pods-Tests.release.xcconfig */,
3B82F4E5C79656CB9C5667F6 /* Pods-Tests Mac.debug.xcconfig */,
5420AE085F25F0E156B00284 /* Pods-Tests Mac.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
@ -92,6 +147,7 @@
isa = PBXGroup;
children = (
DA248D5C195472AA00390AB0 /* Tests */,
32B99E93203B2DF90017FD66 /* Tests Mac */,
DA248D55195472AA00390AB0 /* Frameworks */,
DA248D54195472AA00390AB0 /* Products */,
3E8D7663CD326C6F44B23889 /* Pods */,
@ -102,6 +158,7 @@
isa = PBXGroup;
children = (
DA248D53195472AA00390AB0 /* Tests.xctest */,
32B99E92203B2DF90017FD66 /* Tests Mac.xctest */,
);
name = Products;
sourceTree = "<group>";
@ -113,6 +170,7 @@
DA248D58195472AA00390AB0 /* Foundation.framework */,
DA248D5A195472AA00390AB0 /* UIKit.framework */,
1DAAA77E3CA7387F702040D9 /* Pods_Tests.framework */,
C140E5ED8501C2ABBFD97A24 /* Pods_Tests_Mac.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@ -120,13 +178,7 @@
DA248D5C195472AA00390AB0 /* Tests */ = {
isa = PBXGroup;
children = (
433BBBBA1D7EFA8B0086B6E9 /* MonochromeTestImage.jpg */,
433BBBB61D7EF8200086B6E9 /* TestImage.gif */,
5F7F38AC1AE2A77A00B0E330 /* TestImage.jpg */,
43828A441DA67F9900000E62 /* TestImageLarge.jpg */,
433BBBB81D7EF8260086B6E9 /* TestImage.png */,
321259ED1F39E4110096FE0E /* TestImageAnimated.webp */,
321259EB1F39E3240096FE0E /* TestImageStatic.webp */,
32B99EA1203B30DF0017FD66 /* Images */,
DA248D5D195472AA00390AB0 /* Supporting Files */,
DA248D68195475D800390AB0 /* SDImageCacheTests.m */,
DA248D6A195476AC00390AB0 /* SDWebImageManagerTests.m */,
@ -158,6 +210,26 @@
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
32B99E91203B2DF90017FD66 /* Tests Mac */ = {
isa = PBXNativeTarget;
buildConfigurationList = 32B99E99203B2DF90017FD66 /* Build configuration list for PBXNativeTarget "Tests Mac" */;
buildPhases = (
C584EBF185E2BBD234CD3350 /* [CP] Check Pods Manifest.lock */,
32B99E8E203B2DF90017FD66 /* Sources */,
32B99E8F203B2DF90017FD66 /* Frameworks */,
32B99E90203B2DF90017FD66 /* Resources */,
051A05AAEF597E2716FD5814 /* [CP] Embed Pods Frameworks */,
E24640E4B238C940135CC3B6 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Tests Mac";
productName = "Tests Mac";
productReference = 32B99E92203B2DF90017FD66 /* Tests Mac.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
DA248D52195472AA00390AB0 /* Tests */ = {
isa = PBXNativeTarget;
buildConfigurationList = DA248D67195472AA00390AB0 /* Build configuration list for PBXNativeTarget "Tests" */;
@ -185,6 +257,12 @@
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0900;
TargetAttributes = {
32B99E91203B2DF90017FD66 = {
CreatedOnToolsVersion = 9.2;
ProvisioningStyle = Manual;
};
};
};
buildConfigurationList = DA248D491954721A00390AB0 /* Build configuration list for PBXProject "SDWebImage Tests" */;
compatibilityVersion = "Xcode 3.2";
@ -199,11 +277,26 @@
projectRoot = "";
targets = (
DA248D52195472AA00390AB0 /* Tests */,
32B99E91203B2DF90017FD66 /* Tests Mac */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
32B99E90203B2DF90017FD66 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32B99EA3203B31360017FD66 /* TestImage.gif in Resources */,
32B99EA4203B31360017FD66 /* TestImage.jpg in Resources */,
32B99EA6203B31360017FD66 /* TestImage.png in Resources */,
32B99EA2203B31360017FD66 /* MonochromeTestImage.jpg in Resources */,
32B99EA8203B31360017FD66 /* TestImageStatic.webp in Resources */,
32B99EA7203B31360017FD66 /* TestImageAnimated.webp in Resources */,
32B99EA5203B31360017FD66 /* TestImageLarge.jpg in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
DA248D51195472AA00390AB0 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@ -222,6 +315,30 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
051A05AAEF597E2716FD5814 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Tests Mac/Pods-Tests Mac-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Expecta-macOS/Expecta.framework",
"${BUILT_PRODUCTS_DIR}/KVOController-macOS/KVOController.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage-Core-MapKit-WebP/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/libwebp-macOS/libwebp.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Expecta.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KVOController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libwebp.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests Mac/Pods-Tests Mac-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
09522B7196293172D6408744 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -255,6 +372,24 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
C584EBF185E2BBD234CD3350 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Tests Mac-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
C86216497B5A0BA9501E2C07 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
@ -262,11 +397,11 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Expecta/Expecta.framework",
"${BUILT_PRODUCTS_DIR}/Expecta-iOS/Expecta.framework",
"${BUILT_PRODUCTS_DIR}/FLAnimatedImage/FLAnimatedImage.framework",
"${BUILT_PRODUCTS_DIR}/KVOController/KVOController.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/libwebp/libwebp.framework",
"${BUILT_PRODUCTS_DIR}/KVOController-iOS/KVOController.framework",
"${BUILT_PRODUCTS_DIR}/SDWebImage-Core-GIF-MapKit-WebP/SDWebImage.framework",
"${BUILT_PRODUCTS_DIR}/libwebp-iOS/libwebp.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@ -281,9 +416,41 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E24640E4B238C940135CC3B6 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests Mac/Pods-Tests Mac-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
32B99E8E203B2DF90017FD66 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32B99EAC203B36650017FD66 /* SDWebImageDownloaderTests.m in Sources */,
32B99E9C203B2EE40017FD66 /* SDCategoriesTests.m in Sources */,
32B99EAA203B365F0017FD66 /* SDImageCacheTests.m in Sources */,
32B99EAD203B36690017FD66 /* SDWebImagePrefetcherTests.m in Sources */,
32B99EAE203B366C0017FD66 /* SDWebCacheCategoriesTests.m in Sources */,
32B99E9D203B2F7D0017FD66 /* SDWebImageTestDecoder.m in Sources */,
32B99E9E203B2F810017FD66 /* SDMockFileManager.m in Sources */,
32B99EAB203B36620017FD66 /* SDWebImageManagerTests.m in Sources */,
32B99EA9203B34B60017FD66 /* SDWebImageDecoderTests.m in Sources */,
32B99E9B203B2EDD0017FD66 /* SDTestCase.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
DA248D4F195472AA00390AB0 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@ -315,6 +482,83 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
32B99E97203B2DF90017FD66 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B82F4E5C79656CB9C5667F6 /* Pods-Tests Mac.debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = "Tests Mac/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.Tests-Mac";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
};
name = Debug;
};
32B99E98203B2DF90017FD66 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5420AE085F25F0E156B00284 /* Pods-Tests Mac.release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
ENABLE_NS_ASSERTIONS = NO;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
INFOPLIST_FILE = "Tests Mac/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.dailymotion.Tests-Mac";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
};
name = Release;
};
DA248D4A1954721A00390AB0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -343,6 +587,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = YES;
};
name = Debug;
@ -374,6 +619,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10;
};
name = Release;
};
@ -460,6 +706,15 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
32B99E99203B2DF90017FD66 /* Build configuration list for PBXNativeTarget "Tests Mac" */ = {
isa = XCConfigurationList;
buildConfigurations = (
32B99E97203B2DF90017FD66 /* Debug */,
32B99E98203B2DF90017FD66 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
DA248D491954721A00390AB0 /* Build configuration list for PBXProject "SDWebImage Tests" */ = {
isa = XCConfigurationList;
buildConfigurations = (

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32B99E91203B2DF90017FD66"
BuildableName = "Tests Mac.xctest"
BlueprintName = "Tests Mac"
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32B99E91203B2DF90017FD66"
BuildableName = "Tests Mac.xctest"
BlueprintName = "Tests Mac"
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32B99E91203B2DF90017FD66"
BuildableName = "Tests Mac.xctest"
BlueprintName = "Tests Mac"
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32B99E91203B2DF90017FD66"
BuildableName = "Tests Mac.xctest"
BlueprintName = "Tests Mac"
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "32B99E91203B2DF90017FD66"
BuildableName = "Tests Mac.xctest"
BlueprintName = "Tests Mac"
ReferencedContainer = "container:SDWebImage Tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

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>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 437 KiB

After

Width:  |  Height:  |  Size: 437 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -9,7 +9,9 @@
#import "SDTestCase.h"
#import <SDWebImage/NSData+ImageContentType.h>
#if SD_UIKIT
#import <MobileCoreServices/MobileCoreServices.h>
#endif
#import <SDWebImage/UIImage+MultiFormat.h>
#import <SDWebImage/UIImage+GIF.h>
#import <SDWebImage/UIImage+WebP.h>
@ -36,7 +38,7 @@
UIImage *image = [UIImage sd_imageWithData:nil];
expect(image).to.beNil();
// Test image encode
image = [UIImage imageWithContentsOfFile:[self testJPEGPath]];
image = [[UIImage alloc] initWithContentsOfFile:[self testJPEGPath]];
NSData *data = [image sd_imageData];
expect(data).notTo.beNil();
// Test image encode PNG

View File

@ -231,10 +231,11 @@ NSString *kImageTestKey = @"TestImageKey.jpg";
expect([cachePath pathExtension]).to.equal(@"");
}
#if SD_UIKIT
- (void)test40InsertionOfImageData {
XCTestExpectation *expectation = [self expectationWithDescription:@"Insertion of image data works"];
UIImage *image = [UIImage imageWithContentsOfFile:[self testImagePath]];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:[self testImagePath]];
NSData *imageData = UIImageJPEGRepresentation(image, 1.0);
[[SDImageCache sharedImageCache] storeImageDataToDisk:imageData forKey:kImageTestKey error:nil];
@ -242,7 +243,7 @@ NSString *kImageTestKey = @"TestImageKey.jpg";
expect(storedImageFromMemory).to.equal(nil);
NSString *cachePath = [[SDImageCache sharedImageCache] defaultCachePathForKey:kImageTestKey];
UIImage *cachedImage = [UIImage imageWithContentsOfFile:cachePath];
UIImage *cachedImage = [[UIImage alloc] initWithContentsOfFile:cachePath];
NSData *storedImageData = UIImageJPEGRepresentation(cachedImage, 1.0);
expect(storedImageData.length).to.beGreaterThan(0);
expect(cachedImage.size).to.equal(image.size);
@ -265,7 +266,7 @@ NSString *kImageTestKey = @"TestImageKey.jpg";
SDWebImageTestDecoder *testDecoder = [[SDWebImageTestDecoder alloc] init];
[[SDWebImageCodersManager sharedInstance] addCoder:testDecoder];
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
NSString *key = @"TestPNGImageEncodedToDataAndRetrieveToJPEG";
[cache storeImage:image imageData:nil forKey:key toDisk:YES completion:^(NSError * _Nullable error) {
@ -288,7 +289,7 @@ NSString *kImageTestKey = @"TestImageKey.jpg";
// Decoded result is JPEG
NSString * decodedImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
UIImage *testJPEGImage = [UIImage imageWithContentsOfFile:decodedImagePath];
UIImage *testJPEGImage = [[UIImage alloc] initWithContentsOfFile:decodedImagePath];
NSData *data1 = UIImagePNGRepresentation(testJPEGImage);
NSData *data2 = UIImagePNGRepresentation(diskCacheImage);
@ -306,6 +307,7 @@ NSString *kImageTestKey = @"TestImageKey.jpg";
[self waitForExpectationsWithCommonTimeout];
}
#endif
- (void)test41StoreImageDataToDiskWithError {
NSData *imageData = [NSData dataWithContentsOfFile:[self testImagePath]];
@ -343,7 +345,7 @@ NSString *kImageTestKey = @"TestImageKey.jpg";
- (UIImage *)imageForTesting{
static UIImage *reusableImage = nil;
if (!reusableImage) {
reusableImage = [UIImage imageWithContentsOfFile:[self testImagePath]];
reusableImage = [[UIImage alloc] initWithContentsOfFile:[self testImagePath]];
}
return reusableImage;
}

View File

@ -12,7 +12,9 @@
#import <SDWebImage/UIImageView+HighlightedWebCache.h>
#import <SDWebImage/MKAnnotationView+WebCache.h>
#import <SDWebImage/UIButton+WebCache.h>
#if SD_UIKIT
#import <SDWebImage/FLAnimatedImageView+WebCache.h>
#endif
#import <SDWebImage/UIView+WebCache.h>
#import <KVOController/KVOController.h>
@ -38,6 +40,7 @@
[self waitForExpectationsWithCommonTimeout];
}
#if SD_UIKIT
- (void)testUIImageViewSetHighlightedImageWithURL {
XCTestExpectation *expectation = [self expectationWithDescription:@"UIImageView setHighlightedImageWithURL"];
@ -53,6 +56,7 @@
}];
[self waitForExpectationsWithCommonTimeout];
}
#endif
- (void)testMKAnnotationViewSetImageWithURL {
XCTestExpectation *expectation = [self expectationWithDescription:@"MKAnnotationView setImageWithURL"];
@ -70,6 +74,7 @@
[self waitForExpectationsWithCommonTimeout];
}
#if SD_UIKIT
- (void)testUIButtonSetImageWithURLNormalState {
XCTestExpectation *expectation = [self expectationWithDescription:@"UIButton setImageWithURL normalState"];
@ -138,6 +143,7 @@
}];
[self waitForExpectationsWithCommonTimeout];
}
#endif
- (void)testUIViewImageProgressKVOWork {
XCTestExpectation *expectation = [self expectationWithDescription:@"UIView imageProgressKVO failed"];

View File

@ -13,6 +13,8 @@
#import <SDWebImage/UIImage+ForceDecode.h>
#import <SDWebImage/SDWebImageGIFCoder.h>
#import <SDWebImage/NSData+ImageContentType.h>
#import <SDWebImage/NSImage+Additions.h>
#import <SDWebImage/UIImage+WebCache.h>
@interface SDWebImageDecoderTests : SDTestCase
@ -24,9 +26,10 @@
expect([UIImage sd_decodedImageWithImage:nil]).to.beNil();
}
#if SD_UIKIT
- (void)test02ThatDecodedImageWithImageWorksWithARegularJPGImage {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
@ -36,7 +39,7 @@
- (void)test03ThatDecodedImageWithImageDoesNotDecodeAnimatedImages {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"gif"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
UIImage *animatedImage = [UIImage animatedImageWithImages:@[image] duration:0];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:animatedImage];
expect(decodedImage).toNot.beNil();
@ -45,7 +48,7 @@
- (void)test04ThatDecodedImageWithImageDoesNotDecodeImagesWithAlpha {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).to.equal(image);
@ -53,7 +56,7 @@
- (void)test05ThatDecodedImageWithImageWorksEvenWithMonochromeImage {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"MonochromeTestImage" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage sd_decodedImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
@ -63,7 +66,7 @@
- (void)test06ThatDecodeAndScaleDownImageWorks {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImageLarge" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage sd_decodedAndScaledDownImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
@ -74,7 +77,7 @@
- (void)test07ThatDecodeAndScaleDownImageDoesNotScaleSmallerImage {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
UIImage *decodedImage = [UIImage sd_decodedAndScaledDownImageWithImage:image];
expect(decodedImage).toNot.beNil();
expect(decodedImage).toNot.equal(image);
@ -95,6 +98,7 @@
#pragma clang diagnostic pop
expect(orientation).to.equal(UIImageOrientationUp);
}
#endif
- (void)test09ThatStaticWebPCoderWorks {
NSURL *staticWebPURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"TestImageStatic" withExtension:@"webp"];
@ -134,15 +138,17 @@
if (isAnimated) {
// 2a - check images count > 0 (only for animated images)
expect(inputImage.images.count).to.beGreaterThan(0);
expect(inputImage.sd_isAnimated).to.beTruthy();
// 2b - check image size and scale for each frameImage (only for animated images)
#if SD_UIKIT
CGSize imageSize = inputImage.size;
CGFloat imageScale = inputImage.scale;
[inputImage.images enumerateObjectsUsingBlock:^(UIImage * frameImage, NSUInteger idx, BOOL * stop) {
expect(imageSize).to.equal(frameImage.size);
expect(imageScale).to.equal(frameImage.scale);
}];
#endif
}
// 3 - check if we can encode to the original format

View File

@ -362,6 +362,7 @@
[self waitForExpectationsWithCommonTimeout];
}
#if SD_UIKIT
- (void)test22ThatCustomDecoderWorksForImageDownload {
XCTestExpectation *expectation = [self expectationWithDescription:@"Custom decoder for SDWebImageDownloader not works"];
SDWebImageDownloader *downloader = [[SDWebImageDownloader alloc] init];
@ -371,7 +372,7 @@
// Decoded result is JPEG
NSString *testJPEGImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
UIImage *testJPEGImage = [UIImage imageWithContentsOfFile:testJPEGImagePath];
UIImage *testJPEGImage = [[UIImage alloc] initWithContentsOfFile:testJPEGImagePath];
[downloader downloadImageWithURL:testImageURL options:0 progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
NSData *data1 = UIImagePNGRepresentation(testJPEGImage);
@ -391,5 +392,6 @@
[self waitForExpectationsWithCommonTimeout];
[downloader invalidateSessionAndCancel:YES];
}
#endif
@end

View File

@ -21,13 +21,13 @@
- (UIImage *)decodedImageWithData:(NSData *)data {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
return image;
}
- (UIImage *)incrementallyDecodedImageWithData:(NSData *)data finished:(BOOL)finished {
NSString * testImagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"TestImage" ofType:@"gif"];
UIImage *image = [UIImage imageWithContentsOfFile:testImagePath];
UIImage *image = [[UIImage alloc] initWithContentsOfFile:testImagePath];
return image;
}