From 48015cd425b26eb68eb07f4e4b1adf71e81e11b1 Mon Sep 17 00:00:00 2001 From: WBoerenkamps Date: Mon, 25 Nov 2024 11:48:39 +0100 Subject: make format --- src/test/EventTest.cpp | 74 +++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'src/test/EventTest.cpp') diff --git a/src/test/EventTest.cpp b/src/test/EventTest.cpp index 4af0830..c75bcc1 100644 --- a/src/test/EventTest.cpp +++ b/src/test/EventTest.cpp @@ -154,44 +154,44 @@ TEST_F(EventManagerTest, EventManagerTest_callback_propagation) { } TEST_F(EventManagerTest, EventManagerTest_queue_dispatch) { - EventManager & event_manager = EventManager::get_instance(); - bool triggered1 = false; - bool triggered2 = false; - int test_channel = 1; - - // Adjusted to use KeyPressEvent with repeat as the first variable - EventHandler key_handler1 = [&](const KeyPressEvent & e) { - triggered1 = true; - EXPECT_EQ(e.repeat, false); // Expecting repeat to be false - EXPECT_EQ(e.key, Keycode::A); // Adjust expected key code - return false; // Allows propagation - }; - - EventHandler key_handler2 = [&](const KeyPressEvent & e) { - triggered2 = true; - EXPECT_EQ(e.repeat, false); // Expecting repeat to be false - EXPECT_EQ(e.key, Keycode::A); // Adjust expected key code - return false; // Allows propagation - }; - - // Subscribe handlers to KeyPressEvent - event_manager.subscribe(key_handler1); - event_manager.subscribe(key_handler2, test_channel); - - // Queue a KeyPressEvent instead of KeyDownEvent - event_manager.queue_event( - KeyPressEvent{.repeat = false, .key = Keycode::A}); // Adjust event with repeat flag first - - event_manager.queue_event( - KeyPressEvent{.repeat = false, .key = Keycode::A}, // Adjust event for second subscription - test_channel); - - event_manager.dispatch_events(); - - EXPECT_TRUE(triggered1); - EXPECT_TRUE(triggered2); -} + EventManager & event_manager = EventManager::get_instance(); + bool triggered1 = false; + bool triggered2 = false; + int test_channel = 1; + // Adjusted to use KeyPressEvent with repeat as the first variable + EventHandler key_handler1 = [&](const KeyPressEvent & e) { + triggered1 = true; + EXPECT_EQ(e.repeat, false); // Expecting repeat to be false + EXPECT_EQ(e.key, Keycode::A); // Adjust expected key code + return false; // Allows propagation + }; + + EventHandler key_handler2 = [&](const KeyPressEvent & e) { + triggered2 = true; + EXPECT_EQ(e.repeat, false); // Expecting repeat to be false + EXPECT_EQ(e.key, Keycode::A); // Adjust expected key code + return false; // Allows propagation + }; + + // Subscribe handlers to KeyPressEvent + event_manager.subscribe(key_handler1); + event_manager.subscribe(key_handler2, test_channel); + + // Queue a KeyPressEvent instead of KeyDownEvent + event_manager.queue_event(KeyPressEvent{ + .repeat = false, .key = Keycode::A}); // Adjust event with repeat flag first + + event_manager.queue_event( + KeyPressEvent{.repeat = false, + .key = Keycode::A}, // Adjust event for second subscription + test_channel); + + event_manager.dispatch_events(); + + EXPECT_TRUE(triggered1); + EXPECT_TRUE(triggered2); +} TEST_F(EventManagerTest, EventManagerTest_unsubscribe) { EventManager & event_manager = EventManager::get_instance(); -- cgit v1.2.3