aboutsummaryrefslogtreecommitdiff
path: root/src/test/inputTest.cpp
blob: 0f02410c4b7afa73faf58e64397daf494812a226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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
}