From 2a2a3391ff0b449602825c3182af33c2ff52abc0 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 28 Nov 2024 11:19:33 +0100 Subject: add test for Script::set_next_scene --- src/test/ScriptEventTest.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) (limited to 'src/test/ScriptEventTest.cpp') 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 #include +#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; - OptionalRef script; - - void SetUp() override { - auto & mgr = this->component_manager; - GameObject entity = mgr.new_object("name"); - BehaviorScript & component = entity.add_component(); - - this->behaviorscript = component; - ASSERT_TRUE(this->behaviorscript); - EXPECT_EQ(component.script.get(), nullptr); - component.set_script(); - ASSERT_NE(component.script.get(), nullptr); - - this->script = *(MyScript *) component.script.get(); - ASSERT_TRUE(this->script); - } }; TEST_F(ScriptEventTest, Inactive) { -- cgit v1.2.3