Skip to content

Commit

Permalink
added anim controller test
Browse files Browse the repository at this point in the history
  • Loading branch information
12rcu committed Jul 18, 2024
1 parent 1ebfbe5 commit 482cd8a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/main/kotlin/com/lop/devtools/monstera/addon/TestAddon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ class TestAddon(config: Config, args: Array<String>) : Addon(config, args) {

/**
* implement checks for a json file
*
* ```
* containsKey()
* containsKeyValue()
* containsKeyChain()
* containsKeyChainValue()
* ```
*
* @param checks these checks are executed after the addon was built
*/
fun withJsonFile(filePath: Path, checks: TestFileContent.() -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class AnimControllerTest {
fun buildTask() {
buildTestAddon()
}

@OptIn(MonsteraExperimental::class)
@Test
fun basicAnimControllerTest() = testAddon {
buildToMcFolder = true
entity("my_anim_test", "Anim Test") {
behaviour {
components {
physics { }
physics { }
}
//animation("test") {
// timeline { }
Expand All @@ -50,5 +50,34 @@ class AnimControllerTest {
}
}
}
withJsonFile(config.paths.behAnimController.resolve("my_anim_test.json")) {
assert(
containsKeyChain(
"animation_controllers",
"controller.animation.my_anim_test.my_anim_controller",
"initial_state"
)
)
assert(
containsKeyChainValue(
value = "(variable.my_var == 0)",
"animation_controllers",
"controller.animation.my_anim_test.my_anim_controller",
"states",
"default",
"transitions",
"success"
)
)
assert(
containsKeyChain(
"animation_controllers",
"controller.animation.my_anim_test.my_anim_controller",
"states",
"success",
"on_entry"
)
)
}
}
}

0 comments on commit 482cd8a

Please sign in to comment.