#include // stupid hack to allow access to private/protected members under test #define private public #define protected public #include #include #include #include #include #include #include #include #include "ScriptTest.h" using namespace std; using namespace crepe; using namespace testing; class ScriptEventTest : public ScriptTest { public: EventManager & event_manager = mediator.event_manager; class MyEvent : public Event {}; }; TEST_F(ScriptEventTest, Default) { BehaviorScript & behaviorscript = this->behaviorscript; MyScript & script = this->script; EventManager & evmgr = this->event_manager; unsigned event_count = 0; script.subscribe([&](const MyEvent &) { event_count++; return true; }); system.update(); behaviorscript.active = false; EXPECT_EQ(0, event_count); evmgr.trigger_event(); EXPECT_EQ(0, event_count); behaviorscript.active = true; evmgr.trigger_event(); EXPECT_EQ(1, event_count); }