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/ScriptSceneTest.cpp | |
parent | 42d4cdbd12fbe8ddc77e4c6600fe8aae4e9298ad (diff) |
add test for Script::set_next_scene
Diffstat (limited to 'src/test/ScriptSceneTest.cpp')
-rw-r--r-- | src/test/ScriptSceneTest.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ScriptSceneTest.cpp b/src/test/ScriptSceneTest.cpp new file mode 100644 index 0000000..f96ae8b --- /dev/null +++ b/src/test/ScriptSceneTest.cpp @@ -0,0 +1,31 @@ +#include <gtest/gtest.h> + +// stupid hack to allow access to private/protected members under test +#define private public +#define protected public + +#include <crepe/manager/SceneManager.h> +#include "ScriptTest.h" + +using namespace std; +using namespace crepe; +using namespace testing; + +class ScriptSceneTest : public ScriptTest { +public: + SceneManager scene_manager{mediator}; + + class MyScene : public Scene {}; +}; + +TEST_F(ScriptSceneTest, Inactive) { + BehaviorScript & behaviorscript = this->behaviorscript; + MyScript & script = this->script; + + const char * non_default_value = "foo"; + ASSERT_NE(non_default_value, scene_manager.next_scene); + + script.set_next_scene(non_default_value); + EXPECT_EQ(non_default_value, scene_manager.next_scene); +} + |