diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-24 22:08:49 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-11-24 22:08:49 +0100 |
commit | 6287d4e9068d8bd27a9e62643f54adb69e84befd (patch) | |
tree | 2e94d4cda12cd6b0b3b9c33312156000120eb633 /src/test/inputTest.cpp | |
parent | 6c2fc3716c9c6c68e982b243af5f7ed04fb35e86 (diff) |
input facade
Diffstat (limited to 'src/test/inputTest.cpp')
-rw-r--r-- | src/test/inputTest.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/test/inputTest.cpp b/src/test/inputTest.cpp new file mode 100644 index 0000000..0f02410 --- /dev/null +++ b/src/test/inputTest.cpp @@ -0,0 +1,53 @@ +#include <SDL2/SDL.h> +#include <SDL2/SDL_keycode.h> +#include "system/InputSystem.h" +#include "api/EventManager.h" +#include "api/KeyCodes.h" +#include <gmock/gmock.h> +#include <gtest/gtest.h> + +using namespace std; +using namespace std::chrono_literals; +using namespace crepe; + +class InputTest : public ::testing::Test { +public: +InputSystem input_system; +EventManager& event_manager = EventManager::get_instance(); +protected: + void SetUp() override { + } + + void TearDown() override { + + } +void simulate_mouse_click(int mouse_x, int mouse_y, Uint8 mouse_button) { + SDL_Event event; + + // Simulate Mouse Button Down event + SDL_zero(event); + event.type = SDL_MOUSEBUTTONDOWN; + event.button.x = mouse_x; + event.button.y = mouse_y; + event.button.button = mouse_button; + SDL_PushEvent(&event); + SDL_zero(event); + event.type = SDL_MOUSEBUTTONUP; + event.button.x = mouse_x; + event.button.y = mouse_y; + event.button.button = mouse_button; + SDL_PushEvent(&event); +} + +}; + +TEST_F(InputTest, KeyDown) { + + SDL_Event event; + SDL_zero(event); + event.type = SDL_MOUSEBUTTONDOWN; + event.button.x = 10; + event.button.y = 10; + event.button.button = mouse_bu; + SDL_PushEvent(&event); // Push event into the SDL event queue +} |