mirror of
https://github.com/rive-app/rive-ios.git
synced 2026-01-18 17:11:28 +01:00
Added a test for state machines being assigned when at least one exists but is not specified and a default one is not provided
This commit is contained in:
committed by
Zachary Duncan
parent
db4d7e1c9d
commit
2819f1fd84
@@ -22,4 +22,24 @@ class RiveStateMachineTest: XCTestCase {
|
||||
XCTAssertEqual(model.animation, nil)
|
||||
XCTAssertEqual(model.stateMachine!.name(), "DefaultSM")
|
||||
}
|
||||
|
||||
// Checks that in the absence of both a default and specified StateMachine
|
||||
func testFallbackDefaultStateMachine() throws {
|
||||
let file = try RiveFile(testfileName: "multiple_state_machines")
|
||||
let model = RiveModel(riveFile: file)
|
||||
|
||||
// The RiveViewModel is responsible for configuring the model properly
|
||||
_ = RiveViewModel(model)
|
||||
|
||||
XCTAssertEqual(model.artboard.stateMachineCount(), 4)
|
||||
XCTAssertEqual(model.artboard.animationCount(), 1)
|
||||
|
||||
// There is an Animation in the file but the RiveViewModel
|
||||
// prioritizes StateMachines
|
||||
XCTAssertEqual(model.animation, nil)
|
||||
|
||||
// Some StateMachine was assigned. If there's at least one in
|
||||
// the file it will be chosen by index 0
|
||||
XCTAssertNotEqual(model.stateMachine, nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user