|
@@ -3,7 +3,7 @@
|
|
* Company: Lynar Studios
|
|
* Company: Lynar Studios
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* E-Mail: webmaster@lynarstudios.com
|
|
* Created: 2024-05-16
|
|
* Created: 2024-05-16
|
|
-* Changed: 2024-05-17
|
|
|
|
|
|
+* Changed: 2024-05-30
|
|
*
|
|
*
|
|
* */
|
|
* */
|
|
|
|
|
|
@@ -76,7 +76,7 @@ namespace
|
|
TEST_F(EventListenerTest, subscribe)
|
|
TEST_F(EventListenerTest, subscribe)
|
|
{
|
|
{
|
|
auto myButton = make_shared<Button>();
|
|
auto myButton = make_shared<Button>();
|
|
- ASSERT_TRUE(myButton->subscribe(OnClickEvent().of(make_shared<EventManager>()), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
|
|
+ ASSERT_TRUE(myButton->subscribe(OnClickEvent().supervisedBy(make_shared<EventManager>()), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
}
|
|
}
|
|
|
|
|
|
TEST_F(EventListenerTest, subscribe_second_time)
|
|
TEST_F(EventListenerTest, subscribe_second_time)
|
|
@@ -84,8 +84,8 @@ namespace
|
|
auto myButton = make_shared<Button>();
|
|
auto myButton = make_shared<Button>();
|
|
auto eventManager = make_shared<EventManager>();
|
|
auto eventManager = make_shared<EventManager>();
|
|
|
|
|
|
- ASSERT_TRUE(myButton->subscribe(OnClickEvent().of(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
- ASSERT_FALSE(myButton->subscribe(OnClickEvent().of(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
|
|
+ ASSERT_TRUE(myButton->subscribe(OnClickEvent().supervisedBy(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
+ ASSERT_FALSE(myButton->subscribe(OnClickEvent().supervisedBy(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
}
|
|
}
|
|
|
|
|
|
TEST_F(EventListenerTest, unsubscribe_with_missing_event_manager)
|
|
TEST_F(EventListenerTest, unsubscribe_with_missing_event_manager)
|
|
@@ -115,8 +115,8 @@ namespace
|
|
auto myButton = make_shared<Button>();
|
|
auto myButton = make_shared<Button>();
|
|
auto eventManager = make_shared<EventManager>();
|
|
auto eventManager = make_shared<EventManager>();
|
|
|
|
|
|
- ASSERT_TRUE(myButton->subscribe(OnClickEvent().of(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
- ASSERT_TRUE(myButton->unsubscribe(OnClickEvent().of(eventManager)));
|
|
|
|
|
|
+ ASSERT_TRUE(myButton->subscribe(OnClickEvent().supervisedBy(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
+ ASSERT_TRUE(myButton->unsubscribe(OnClickEvent().supervisedBy(eventManager)));
|
|
}
|
|
}
|
|
|
|
|
|
TEST_F(EventListenerTest, unsubscribe_second_time)
|
|
TEST_F(EventListenerTest, unsubscribe_second_time)
|
|
@@ -124,8 +124,8 @@ namespace
|
|
auto myButton = make_shared<Button>();
|
|
auto myButton = make_shared<Button>();
|
|
auto eventManager = make_shared<EventManager>();
|
|
auto eventManager = make_shared<EventManager>();
|
|
|
|
|
|
- ASSERT_TRUE(myButton->subscribe(OnClickEvent().of(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
- ASSERT_TRUE(myButton->unsubscribe(OnClickEvent().of(eventManager)));
|
|
|
|
- ASSERT_FALSE(myButton->unsubscribe(OnClickEvent().of(eventManager)));
|
|
|
|
|
|
+ ASSERT_TRUE(myButton->subscribe(OnClickEvent().supervisedBy(eventManager), [myButton]() mutable { myButton->onClickEvent(); }));
|
|
|
|
+ ASSERT_TRUE(myButton->unsubscribe(OnClickEvent().supervisedBy(eventManager)));
|
|
|
|
+ ASSERT_FALSE(myButton->unsubscribe(OnClickEvent().supervisedBy(eventManager)));
|
|
}
|
|
}
|
|
}
|
|
}
|