-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose API to get original value from animation (#1559)
Fixes #1547
- Loading branch information
1 parent
3fb32ca
commit 2037101
Showing
8 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// ValueProvidersTests.swift | ||
// LottieTests | ||
// | ||
// Created by Marcelo Fabri on 5/5/22. | ||
// | ||
|
||
import Lottie | ||
import XCTest | ||
|
||
final class ValueProvidersTests: XCTestCase { | ||
|
||
func testGetValue() throws { | ||
let animationView = try XCTUnwrap(SnapshotConfiguration.makeAnimationView( | ||
for: "HamburgerArrow", | ||
configuration: .init(renderingEngine: .mainThread))) | ||
|
||
let keypath = AnimationKeypath(keypath: "A1.Shape 1.Stroke 1.Color") | ||
animationView.setValueProvider(ColorValueProvider(.red), keypath: keypath) | ||
let updatedColor = try XCTUnwrap(animationView.getValue(for: keypath, atFrame: 0) as? Color) | ||
XCTAssertEqual(updatedColor, .red) | ||
|
||
let originalColor = try XCTUnwrap(animationView.getOriginalValue(for: keypath, atFrame: 0) as? Color) | ||
XCTAssertEqual(originalColor, Color(r: 0.4, g: 0.16, b: 0.7, a: 1)) | ||
} | ||
|
||
} |