aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-25 11:54:06 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-11-25 11:54:06 +0100
commitfd7dfd2202c9435b86ac10ed96c6515f2505daa8 (patch)
tree0e734d6684f5ea247697bf3db5502e39ae9b188c /src/test
parent48015cd425b26eb68eb07f4e4b1adf71e81e11b1 (diff)
changed enum name
Diffstat (limited to 'src/test')
-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 c75bcc1..4af0830 100644
--- a/src/test/EventTest.cpp
+++ b/src/test/EventTest.cpp
@@ -154,45 +154,45 @@ 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();