feat: add log messages for event test
This commit is contained in:
@@ -14,24 +14,33 @@ class EventTest : ITest
|
||||
|
||||
virtual void run() override
|
||||
{
|
||||
logInfo("Instantiating event");
|
||||
Event<std::string> testEvent;
|
||||
|
||||
auto listener1 = testEvent.addListener(
|
||||
[](std::string str) { std::cout << "(Listener 1) Event has been fired with string: " << str << std::endl; });
|
||||
logInfo("Registering listeners");
|
||||
auto listener1 = testEvent.addListener([](std::string str) {
|
||||
std::cout << "(Listener 1) Event has been fired with string: " << str << std::endl;
|
||||
});
|
||||
|
||||
auto listener2 = testEvent.addListener(
|
||||
[](std::string str) { std::cout << "(Listener 2) Event has been fired, string: " << str << std::endl; });
|
||||
auto listener2 = testEvent.addListener([](std::string str) {
|
||||
std::cout << "(Listener 2) Event has been fired, string: " << str << std::endl;
|
||||
});
|
||||
|
||||
logInfo("Running event with both listeners");
|
||||
const char* str1 = "somestring";
|
||||
testEvent.run(str1);
|
||||
|
||||
std::string str2("hello world");
|
||||
testEvent.run(str2);
|
||||
|
||||
logInfo("Removing listener 2");
|
||||
testEvent.removeListener(listener2);
|
||||
|
||||
logInfo("Running event with only 1 listener");
|
||||
testEvent.run("event without listener 2");
|
||||
};
|
||||
|
||||
virtual const char* getName() override { return "EventTest"; }
|
||||
};
|
||||
|
||||
static EventTest g_eventTest;
|
||||
|
||||
Reference in New Issue
Block a user