|
@@ -54,12 +54,20 @@ namespace
|
|
{
|
|
{
|
|
auto eventManager = make_shared<EventManager>();
|
|
auto eventManager = make_shared<EventManager>();
|
|
|
|
|
|
- auto myButton = make_shared<Button>();
|
|
|
|
- myButton->subscribe(OnClickEvent().of(eventManager), [myButton]() mutable { myButton->onClickEvent(); });
|
|
|
|
|
|
+ auto myBlueButton = make_shared<Button>();
|
|
|
|
+ myBlueButton->subscribe(OnClickEvent().of(eventManager), [myBlueButton]() mutable { myBlueButton->onClickEvent(); });
|
|
|
|
+ auto myRedButton = make_shared<Button>();
|
|
|
|
+ auto myGreenButton = make_shared<Button>();
|
|
|
|
+
|
|
|
|
+ ASSERT_FALSE(myBlueButton->isClicked());
|
|
|
|
+ ASSERT_FALSE(myRedButton->isClicked());
|
|
|
|
+ ASSERT_FALSE(myGreenButton->isClicked());
|
|
|
|
|
|
- ASSERT_FALSE(myButton->isClicked());
|
|
|
|
eventManager->invoke(OnClickEvent());
|
|
eventManager->invoke(OnClickEvent());
|
|
- ASSERT_TRUE(myButton->isClicked());
|
|
|
|
|
|
+
|
|
|
|
+ ASSERT_TRUE(myBlueButton->isClicked());
|
|
|
|
+ ASSERT_FALSE(myRedButton->isClicked());
|
|
|
|
+ ASSERT_FALSE(myGreenButton->isClicked());
|
|
}
|
|
}
|
|
|
|
|
|
TEST_F(EventManagerTest, invoke_event_not_known)
|
|
TEST_F(EventManagerTest, invoke_event_not_known)
|