diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-09 14:20:39 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-09 14:20:39 +0100 |
commit | 2ff3369a7aaf98936bf93f1c7c0dbfcaa38c31d7 (patch) | |
tree | b8b3fae16111f4d5df73077c5e0e28a1639c9f3f /src/test | |
parent | b6167713c11e26f513f0c5b82701e6cee88de8cb (diff) |
make format
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/EventTest.cpp | 12 | ||||
-rw-r--r-- | src/test/InputTest.cpp | 28 |
2 files changed, 19 insertions, 21 deletions
diff --git a/src/test/EventTest.cpp b/src/test/EventTest.cpp index 53c2469..ef7fc10 100644 --- a/src/test/EventTest.cpp +++ b/src/test/EventTest.cpp @@ -71,7 +71,7 @@ TEST_F(EventManagerTest, EventManagerTest_trigger_all_channels) { EventManager::get_instance().subscribe<MouseClickEvent>(mouse_handler, EventManager::CHANNEL_ALL); - MouseClickEvent click_event{.mouse_pos = {100,200}, .button = MouseButton::LEFT_MOUSE}; + MouseClickEvent click_event{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}; EventManager::get_instance().trigger_event<MouseClickEvent>(click_event, EventManager::CHANNEL_ALL); @@ -89,7 +89,7 @@ TEST_F(EventManagerTest, EventManagerTest_trigger_one_channel) { }; EventManager::get_instance().subscribe<MouseClickEvent>(mouse_handler, test_channel); - MouseClickEvent click_event{.mouse_pos = {100,200}, .button = MouseButton::LEFT_MOUSE}; + MouseClickEvent click_event{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}; EventManager::get_instance().trigger_event<MouseClickEvent>(click_event, EventManager::CHANNEL_ALL); @@ -122,7 +122,7 @@ TEST_F(EventManagerTest, EventManagerTest_callback_propagation) { }; // Test event - MouseClickEvent click_event{.mouse_pos = {100,200}, .button = MouseButton::LEFT_MOUSE}; + MouseClickEvent click_event{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}; event_manager.subscribe<MouseClickEvent>(mouse_handler_true, EventManager::CHANNEL_ALL); event_manager.subscribe<MouseClickEvent>(mouse_handler_false, EventManager::CHANNEL_ALL); @@ -217,7 +217,7 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) { // Queue events event_manager.queue_event<MouseClickEvent>( - MouseClickEvent{.mouse_pos = {100,200}, .button = MouseButton::LEFT_MOUSE}); + MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}); // Dispatch events - both handlers should be triggered event_manager.dispatch_events(); @@ -233,7 +233,7 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) { // Queue the same event again event_manager.queue_event<MouseClickEvent>( - MouseClickEvent{.mouse_pos = {100,200}, .button = MouseButton::LEFT_MOUSE}); + MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}); // Dispatch events - only handler 2 should be triggered, handler 1 should NOT event_manager.dispatch_events(); @@ -248,7 +248,7 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) { // Queue the event again event_manager.queue_event<MouseClickEvent>( - MouseClickEvent{.mouse_pos = {100,200}, .button = MouseButton::LEFT_MOUSE}); + MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}); // Dispatch events - no handler should be triggered event_manager.dispatch_events(); diff --git a/src/test/InputTest.cpp b/src/test/InputTest.cpp index cde774f..94549a0 100644 --- a/src/test/InputTest.cpp +++ b/src/test/InputTest.cpp @@ -31,9 +31,7 @@ public: //GameObject camera; protected: - void SetUp() override { - event_manager.clear(); - } + void SetUp() override { event_manager.clear(); } void simulate_mouse_click(int mouse_x, int mouse_y, Uint8 mouse_button) { SDL_Event event; @@ -299,12 +297,12 @@ TEST_F(InputTest, WindowResizeTest) { }; event_manager.subscribe<WindowResizeEvent>(on_window_resize); SDL_Event resize_event; - SDL_zero(resize_event); - resize_event.type = SDL_WINDOWEVENT; - resize_event.window.event = SDL_WINDOWEVENT_RESIZED; - resize_event.window.data1 = 800; // new width - resize_event.window.data2 = 600; // new height - SDL_PushEvent(&resize_event); + SDL_zero(resize_event); + resize_event.type = SDL_WINDOWEVENT; + resize_event.window.event = SDL_WINDOWEVENT_RESIZED; + resize_event.window.data1 = 800; // new width + resize_event.window.data2 = 600; // new height + SDL_PushEvent(&resize_event); input_system.update(); event_manager.dispatch_events(); EXPECT_TRUE(callback_triggered); @@ -323,12 +321,12 @@ TEST_F(InputTest, WindowMoveTest) { }; event_manager.subscribe<WindowMoveEvent>(on_window_move); SDL_Event resize_event; - SDL_zero(resize_event); - resize_event.type = SDL_WINDOWEVENT; - resize_event.window.event = SDL_WINDOWEVENT_MOVED; - resize_event.window.data1 = 800; // new width - resize_event.window.data2 = 600; // new height - SDL_PushEvent(&resize_event); + SDL_zero(resize_event); + resize_event.type = SDL_WINDOWEVENT; + resize_event.window.event = SDL_WINDOWEVENT_MOVED; + resize_event.window.data1 = 800; // new width + resize_event.window.data2 = 600; // new height + SDL_PushEvent(&resize_event); input_system.update(); event_manager.dispatch_events(); EXPECT_TRUE(callback_triggered); |