aboutsummaryrefslogtreecommitdiff
path: root/src/test/EventTest.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-27 14:59:03 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-27 14:59:03 +0100
commit9d60b7b70abd832dc229c59114e465d457fcd0a3 (patch)
treee8f072ccb8e3a24a42295e53afac1892eda039ab /src/test/EventTest.cpp
parent6e9879896e620e6113c11e48f23a5f71b4fc87f0 (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();