aboutsummaryrefslogtreecommitdiff
path: root/src/test/EventTest.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-25 11:48:39 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-25 11:48:39 +0100
commit48015cd425b26eb68eb07f4e4b1adf71e81e11b1 (patch)
tree95725bd476cf92c5749e27c44c5134902dedfc66 /src/test/EventTest.cpp
parentea7d7ec301968f3a542de93f487f9501b70c0cd4 (diff)
make format
Diffstat (limited to 'src/test/EventTest.cpp')
-rw-r--r--src/test/EventTest.cpp74
1 files changed, 37 insertions, 37 deletions
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<KeyPressEvent> 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<KeyPressEvent> 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<KeyPressEvent>(key_handler1);
- event_manager.subscribe<KeyPressEvent>(key_handler2, test_channel);
-
- // Queue a KeyPressEvent instead of KeyDownEvent
- event_manager.queue_event<KeyPressEvent>(
- KeyPressEvent{.repeat = false, .key = Keycode::A}); // Adjust event with repeat flag first
-
- event_manager.queue_event<KeyPressEvent>(
- 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<KeyPressEvent> 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<KeyPressEvent> 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<KeyPressEvent>(key_handler1);
+ event_manager.subscribe<KeyPressEvent>(key_handler2, test_channel);
+
+ // Queue a KeyPressEvent instead of KeyDownEvent
+ event_manager.queue_event<KeyPressEvent>(KeyPressEvent{
+ .repeat = false, .key = Keycode::A}); // Adjust event with repeat flag first
+
+ event_manager.queue_event<KeyPressEvent>(
+ 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();