diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-28 11:19:33 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-28 11:19:33 +0100 |
commit | 2a2a3391ff0b449602825c3182af33c2ff52abc0 (patch) | |
tree | 50a308447aa7049e8c3739129adb360b75a05079 /src/test/ScriptEventTest.cpp | |
parent | 42d4cdbd12fbe8ddc77e4c6600fe8aae4e9298ad (diff) |
add test for Script::set_next_scene
Diffstat (limited to 'src/test/ScriptEventTest.cpp')
-rw-r--r-- | src/test/ScriptEventTest.cpp | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/test/ScriptEventTest.cpp b/src/test/ScriptEventTest.cpp index ab7dd35..7a9abbb 100644 --- a/src/test/ScriptEventTest.cpp +++ b/src/test/ScriptEventTest.cpp @@ -13,37 +13,17 @@ #include <crepe/api/Vector2.h> #include <crepe/system/ScriptSystem.h> +#include "ScriptTest.h" + using namespace std; using namespace crepe; using namespace testing; -class ScriptEventTest : public Test { - Mediator m; +class ScriptEventTest : public ScriptTest { public: - ComponentManager component_manager{m}; - ScriptSystem system{m}; - EventManager & event_manager = m.event_manager; + EventManager & event_manager = mediator.event_manager; class MyEvent : public Event {}; - class MyScript : public Script {}; - - OptionalRef<BehaviorScript> behaviorscript; - OptionalRef<MyScript> script; - - void SetUp() override { - auto & mgr = this->component_manager; - GameObject entity = mgr.new_object("name"); - BehaviorScript & component = entity.add_component<BehaviorScript>(); - - this->behaviorscript = component; - ASSERT_TRUE(this->behaviorscript); - EXPECT_EQ(component.script.get(), nullptr); - component.set_script<MyScript>(); - ASSERT_NE(component.script.get(), nullptr); - - this->script = *(MyScript *) component.script.get(); - ASSERT_TRUE(this->script); - } }; TEST_F(ScriptEventTest, Inactive) { |