/* * Author: Patrick-Christopher Mattulat * Company: Lynar Studios * E-Mail: webmaster@lynarstudios.com * Created: 2024-05-16 * Changed: 2024-05-30 * * */ #include #include #include #include #include using ls::std::core::EventNotHandledException; using ls::std::event::EventManager; using ::std::make_shared; using ::std::string; using test::event::Button; using test::event::ChangeColorEvent; using test::event::OnClickEvent; using testing::Test; namespace { class EventManagerTest : public Test { public: EventManagerTest() = default; ~EventManagerTest() override = default; }; TEST_F(EventManagerTest, getClassName) { ASSERT_STREQ("EventManager", EventManager().getClassName().c_str()); } TEST_F(EventManagerTest, getNextProvisionId) { auto eventManager = EventManager(); ASSERT_EQ(1, eventManager.getNextProvisionId()); ASSERT_EQ(1, eventManager.requestListenerId()); ASSERT_EQ(2, eventManager.getNextProvisionId()); } TEST_F(EventManagerTest, holdsListenerForEvent) { auto eventManager = make_shared(); ASSERT_FALSE(eventManager->holdsListenerForEvent(1, OnClickEvent())); } TEST_F(EventManagerTest, invoke) { auto eventManager = make_shared(); auto myBlueButton = make_shared