mirror of
https://github.com/gelldur/EventBus.git
synced 2024-12-27 12:21:02 +08:00
Fix test
This commit is contained in:
parent
df155bf897
commit
8f0b5f3b08
@ -114,6 +114,7 @@ TEST_CASE("eventbus/EventBus type conversion", "Check for type conversion")
|
|||||||
{
|
{
|
||||||
Dexode::Event<int> event{"event1"};
|
Dexode::Event<int> event{"event1"};
|
||||||
_token = bus.listen(event, std::bind(&Example::onEvent1, this, std::placeholders::_1));
|
_token = bus.listen(event, std::bind(&Example::onEvent1, this, std::placeholders::_1));
|
||||||
|
// Using bind we can convert types
|
||||||
bus.listen(_token, event, std::bind(&Example::onEvent2, this, std::placeholders::_1));
|
bus.listen(_token, event, std::bind(&Example::onEvent2, this, std::placeholders::_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,5 +144,5 @@ TEST_CASE("eventbus/EventBus type conversion", "Check for type conversion")
|
|||||||
REQUIRE(ex.calledEvent2 == 0);
|
REQUIRE(ex.calledEvent2 == 0);
|
||||||
bus.notify<int>("event1", 2);
|
bus.notify<int>("event1", 2);
|
||||||
REQUIRE(ex.calledEvent1 == 1);
|
REQUIRE(ex.calledEvent1 == 1);
|
||||||
REQUIRE(ex.calledEvent2 == 0);
|
REQUIRE(ex.calledEvent2 == 1);//Lookout for std::bind!
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user