mirror of
https://github.com/SFML/SFML.git
synced 2025-01-31 13:45:13 +08:00
Test Event::visit with move-only visitor
This commit is contained in:
parent
c6df55eed8
commit
37c87ee11e
@ -2,6 +2,7 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
@ -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<std::string_view>("It works")](const auto&) { return *ptr; };
|
||||
|
||||
const sf::Event closed = sf::Event::Closed{};
|
||||
CHECK(closed.visit(moveOnlyVisitor) == "It works");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user