Skip to content

Commit 826dca3

Browse files
committed
Added the test case and code coverage report
1 parent 5dd79c2 commit 826dca3

File tree

6 files changed

+204
-21
lines changed

6 files changed

+204
-21
lines changed

Example/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ target 'SDWebImageLottiePlugin_Example' do
66

77
target 'SDWebImageLottiePlugin_Tests' do
88
inherit! :search_paths
9-
9+
pod 'SDWebImageLottiePlugin', :path => '../'
1010

1111
end
1212
end

Example/SDWebImageLottiePlugin.xcodeproj/project.pbxproj

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
607FACE11AFB9204008FA782 /* Sources */,
250250
607FACE21AFB9204008FA782 /* Frameworks */,
251251
607FACE31AFB9204008FA782 /* Resources */,
252+
3E8B84B725A842F07BDFF00A /* [CP] Embed Pods Frameworks */,
252253
);
253254
buildRules = (
254255
);
@@ -358,6 +359,28 @@
358359
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";
359360
showEnvVarsInLog = 0;
360361
};
362+
3E8B84B725A842F07BDFF00A /* [CP] Embed Pods Frameworks */ = {
363+
isa = PBXShellScriptBuildPhase;
364+
buildActionMask = 2147483647;
365+
files = (
366+
);
367+
inputPaths = (
368+
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageLottiePlugin_Tests/Pods-SDWebImageLottiePlugin_Tests-frameworks.sh",
369+
"${BUILT_PRODUCTS_DIR}/SDWebImage-iOS/SDWebImage.framework",
370+
"${BUILT_PRODUCTS_DIR}/SDWebImageLottiePlugin-iOS/SDWebImageLottiePlugin.framework",
371+
"${BUILT_PRODUCTS_DIR}/lottie-ios-iOS/Lottie.framework",
372+
);
373+
name = "[CP] Embed Pods Frameworks";
374+
outputPaths = (
375+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
376+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageLottiePlugin.framework",
377+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Lottie.framework",
378+
);
379+
runOnlyForDeploymentPostprocessing = 0;
380+
shellPath = /bin/sh;
381+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SDWebImageLottiePlugin_Tests/Pods-SDWebImageLottiePlugin_Tests-frameworks.sh\"\n";
382+
showEnvVarsInLog = 0;
383+
};
361384
6762E0028EC1CDDDA4D810EE /* [CP] Check Pods Manifest.lock */ = {
362385
isa = PBXShellScriptBuildPhase;
363386
buildActionMask = 2147483647;

Example/SDWebImageLottiePlugin.xcodeproj/xcshareddata/xcschemes/SDWebImageLottiePlugin-Example.xcscheme

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,16 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43-
language = ""
4443
shouldUseLaunchSchemeArgsEnv = "YES">
44+
<MacroExpansion>
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
48+
BuildableName = "SDWebImageLottiePlugin_Example.app"
49+
BlueprintName = "SDWebImageLottiePlugin_Example"
50+
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
51+
</BuildableReference>
52+
</MacroExpansion>
4553
<Testables>
4654
<TestableReference
4755
skipped = "NO">
@@ -54,23 +62,11 @@
5462
</BuildableReference>
5563
</TestableReference>
5664
</Testables>
57-
<MacroExpansion>
58-
<BuildableReference
59-
BuildableIdentifier = "primary"
60-
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
61-
BuildableName = "SDWebImageLottiePlugin_Example.app"
62-
BlueprintName = "SDWebImageLottiePlugin_Example"
63-
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
64-
</BuildableReference>
65-
</MacroExpansion>
66-
<AdditionalOptions>
67-
</AdditionalOptions>
6865
</TestAction>
6966
<LaunchAction
7067
buildConfiguration = "Debug"
7168
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7269
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
73-
language = ""
7470
launchStyle = "0"
7571
useCustomWorkingDirectory = "NO"
7672
ignoresPersistentStateOnLaunch = "NO"
@@ -87,8 +83,6 @@
8783
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
8884
</BuildableReference>
8985
</BuildableProductRunnable>
90-
<AdditionalOptions>
91-
</AdditionalOptions>
9286
</LaunchAction>
9387
<ProfileAction
9488
buildConfiguration = "Release"
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1130"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "3249A53E240A5ECB00AB1888"
18+
BuildableName = "SDWebImageLottiePlugin_Example macOS.app"
19+
BlueprintName = "SDWebImageLottiePlugin_Example macOS"
20+
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "3249A53E240A5ECB00AB1888"
48+
BuildableName = "SDWebImageLottiePlugin_Example macOS.app"
49+
BlueprintName = "SDWebImageLottiePlugin_Example macOS"
50+
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "3249A53E240A5ECB00AB1888"
65+
BuildableName = "SDWebImageLottiePlugin_Example macOS.app"
66+
BlueprintName = "SDWebImageLottiePlugin_Example macOS"
67+
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1130"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "607FACE41AFB9204008FA782"
18+
BuildableName = "SDWebImageLottiePlugin_Tests.xctest"
19+
BlueprintName = "SDWebImageLottiePlugin_Tests"
20+
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
31+
<Testables>
32+
<TestableReference
33+
skipped = "NO">
34+
<BuildableReference
35+
BuildableIdentifier = "primary"
36+
BlueprintIdentifier = "607FACE41AFB9204008FA782"
37+
BuildableName = "SDWebImageLottiePlugin_Tests.xctest"
38+
BlueprintName = "SDWebImageLottiePlugin_Tests"
39+
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
40+
</BuildableReference>
41+
</TestableReference>
42+
</Testables>
43+
</TestAction>
44+
<LaunchAction
45+
buildConfiguration = "Debug"
46+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
47+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
48+
launchStyle = "0"
49+
useCustomWorkingDirectory = "NO"
50+
ignoresPersistentStateOnLaunch = "NO"
51+
debugDocumentVersioning = "YES"
52+
debugServiceExtension = "internal"
53+
allowLocationSimulation = "YES">
54+
</LaunchAction>
55+
<ProfileAction
56+
buildConfiguration = "Release"
57+
shouldUseLaunchSchemeArgsEnv = "YES"
58+
savedToolIdentifier = ""
59+
useCustomWorkingDirectory = "NO"
60+
debugDocumentVersioning = "YES">
61+
<MacroExpansion>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "607FACE41AFB9204008FA782"
65+
BuildableName = "SDWebImageLottiePlugin_Tests.xctest"
66+
BlueprintName = "SDWebImageLottiePlugin_Tests"
67+
ReferencedContainer = "container:SDWebImageLottiePlugin.xcodeproj">
68+
</BuildableReference>
69+
</MacroExpansion>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

Example/Tests/Tests.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import XCTest
2-
import SDWebImageLottiePlugin
2+
import Lottie
3+
import SDWebImage
4+
@testable import SDWebImageLottiePlugin
35

46
class Tests: XCTestCase {
57

@@ -18,11 +20,19 @@ class Tests: XCTestCase {
1820
XCTAssert(true, "Pass")
1921
}
2022

21-
func testPerformanceExample() {
22-
// This is an example of a performance test case.
23-
self.measure() {
24-
// Put the code you want to measure the time of here.
23+
func testAnimatedImageViewLoad() {
24+
let exception = self.expectation(description: "AnimationView load lottie URL")
25+
let animationView = AnimationView()
26+
let lottieURL = URL(string: "https://raw.githubusercontent.com/airbnb/lottie-web/master/demo/happy2016/data.json")
27+
animationView.sd_setImage(with: lottieURL) { (image, error, cacheType, url) in
28+
XCTAssertNil(error)
29+
let lottieImage = try! XCTUnwrap(image)
30+
XCTAssertTrue(lottieImage.isKind(of: LottieImage.self))
31+
let animation = try! XCTUnwrap((lottieImage as! LottieImage).animation)
32+
XCTAssertEqual(animation.size, CGSize(width: 1920, height: 1080))
33+
exception.fulfill()
2534
}
35+
self.waitForExpectations(timeout: 5, handler: nil)
2636
}
2737

2838
}

0 commit comments

Comments
 (0)