From 37c87ee11e127e897d01ce169186c838c8d5eb5c Mon Sep 17 00:00:00 2001 From: kimci86 Date: Sat, 25 Jan 2025 18:56:09 +0100 Subject: [PATCH] Test Event::visit with move-only visitor --- test/Window/Event.test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/Window/Event.test.cpp b/test/Window/Event.test.cpp index 9977f3618..88e01a82f 100644 --- a/test/Window/Event.test.cpp +++ b/test/Window/Event.test.cpp @@ -2,6 +2,7 @@ #include +#include #include #include @@ -340,5 +341,13 @@ TEST_CASE("[Window] sf::Event") const sf::Event focusLost = sf::Event::FocusLost{}; CHECK(focusLost.visit(visitor) == "Other"); } + + SECTION("Move-only visitor") + { + auto moveOnlyVisitor = [ptr = std::make_unique("It works")](const auto&) { return *ptr; }; + + const sf::Event closed = sf::Event::Closed{}; + CHECK(closed.visit(moveOnlyVisitor) == "It works"); + } } }