From 61148c757a1f742ff09e40e5347e74e638c7371c Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sun, 22 Dec 2024 12:32:22 +0100 Subject: update clang-format options --- src/test/EventTest.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/test/EventTest.cpp') diff --git a/src/test/EventTest.cpp b/src/test/EventTest.cpp index f8be3fe..6105679 100644 --- a/src/test/EventTest.cpp +++ b/src/test/EventTest.cpp @@ -10,7 +10,7 @@ using namespace crepe; class EventManagerTest : public ::testing::Test { protected: Mediator mediator; - EventManager event_mgr{mediator}; + EventManager event_mgr {mediator}; void SetUp() override { // Clear any existing subscriptions or events before each test event_mgr.clear(); @@ -30,18 +30,20 @@ TEST_F(EventManagerTest, EventSubscription) { // Verify subscription (not directly verifiable; test by triggering event) event_mgr.trigger_event( - KeyPressEvent{ + KeyPressEvent { .repeat = true, .key = Keycode::A, }, - 1); + 1 + ); event_mgr.trigger_event( - KeyPressEvent{ + KeyPressEvent { .repeat = true, .key = Keycode::A, }, - EventManager::CHANNEL_ALL); + EventManager::CHANNEL_ALL + ); } TEST_F(EventManagerTest, EventManagerTest_trigger_all_channels) { bool triggered = false; @@ -55,7 +57,7 @@ TEST_F(EventManagerTest, EventManagerTest_trigger_all_channels) { }; event_mgr.subscribe(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}; event_mgr.trigger_event(click_event, EventManager::CHANNEL_ALL); EXPECT_TRUE(triggered); @@ -72,7 +74,7 @@ TEST_F(EventManagerTest, EventManagerTest_trigger_one_channel) { }; event_mgr.subscribe(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}; event_mgr.trigger_event(click_event, EventManager::CHANNEL_ALL); EXPECT_FALSE(triggered); @@ -103,7 +105,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_mgr.subscribe(mouse_handler_true, EventManager::CHANNEL_ALL); event_mgr.subscribe(mouse_handler_false, EventManager::CHANNEL_ALL); @@ -151,10 +153,12 @@ TEST_F(EventManagerTest, EventManagerTest_queue_dispatch) { event_mgr.subscribe(mouse_handler2, test_channel); event_mgr.queue_event( - MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}); + MouseClickEvent {.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE} + ); event_mgr.queue_event( - MouseClickEvent{.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}, - test_channel); + MouseClickEvent {.mouse_pos = {100, 200}, .button = MouseButton::LEFT_MOUSE}, + test_channel + ); event_mgr.dispatch_events(); EXPECT_TRUE(triggered1); EXPECT_TRUE(triggered2); @@ -188,7 +192,8 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) { // Queue events event_mgr.queue_event( - 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_mgr.dispatch_events(); @@ -204,7 +209,8 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) { // Queue the same event again event_mgr.queue_event( - 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_mgr.dispatch_events(); @@ -219,7 +225,8 @@ TEST_F(EventManagerTest, EventManagerTest_unsubscribe) { // Queue the event again event_mgr.queue_event( - 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_mgr.dispatch_events(); -- cgit v1.2.3