aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-01-01 22:20:21 +0800
committercrupest <crupest@outlook.com>2024-02-02 22:11:30 +0800
commit9760767f112e67718ba5dc1af20ce10d773545d3 (patch)
treeae91b9f5918dddeba81c2b3ca0fc57e36f7a7563
parentc1e86826ddcd337bb0ff5bc9f5f65b11933c4a54 (diff)
downloadcru-9760767f112e67718ba5dc1af20ce10d773545d3.tar.gz
cru-9760767f112e67718ba5dc1af20ce10d773545d3.tar.bz2
cru-9760767f112e67718ba5dc1af20ce10d773545d3.zip
Add Event2 stop handling test.
-rw-r--r--test/common/Event2Test.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/common/Event2Test.cpp b/test/common/Event2Test.cpp
index e14174cf..0d3222cc 100644
--- a/test/common/Event2Test.cpp
+++ b/test/common/Event2Test.cpp
@@ -39,4 +39,16 @@ TEST_CASE("Event2", "[event2]") {
event.Raise();
REQUIRE(counter == 3);
}
+
+ SECTION("stop handling should work.") {
+ auto short_circuit_handler = [&counter](decltype(event)::Context* context) {
+ context->SetStopHandling();
+ };
+
+ event.AddHandler(short_circuit_handler);
+ event.AddHandler(handler2);
+
+ event.Raise();
+ REQUIRE(counter == 1);
+ }
}