From 482cd8ae7ecf56fbb2e8a9738a16f389624fd588 Mon Sep 17 00:00:00 2001 From: Matthias <56599453+12rcu@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:14:51 +0200 Subject: [PATCH] added anim controller test --- .../lop/devtools/monstera/addon/TestAddon.kt | 8 +++++ .../addon/entitiy/AnimControllerTest.kt | 33 +++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/lop/devtools/monstera/addon/TestAddon.kt b/src/main/kotlin/com/lop/devtools/monstera/addon/TestAddon.kt index b98c8c1..7387464 100644 --- a/src/main/kotlin/com/lop/devtools/monstera/addon/TestAddon.kt +++ b/src/main/kotlin/com/lop/devtools/monstera/addon/TestAddon.kt @@ -21,6 +21,14 @@ class TestAddon(config: Config, args: Array) : 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) { diff --git a/src/test/kotlin/com/lop/devtools/monstera/addon/entitiy/AnimControllerTest.kt b/src/test/kotlin/com/lop/devtools/monstera/addon/entitiy/AnimControllerTest.kt index 5186c9c..72e7a8a 100644 --- a/src/test/kotlin/com/lop/devtools/monstera/addon/entitiy/AnimControllerTest.kt +++ b/src/test/kotlin/com/lop/devtools/monstera/addon/entitiy/AnimControllerTest.kt @@ -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 { } @@ -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" + ) + ) + } } } \ No newline at end of file