diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 474fc27..3ce534c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -33,6 +33,7 @@ set_target_warnings(test-csfml-system) catch_discover_tests(test-csfml-system) add_executable(test-csfml-window + Window/Cursor.test.cpp Window/Joystick.test.cpp Window/Keyboard.test.cpp Window/Mouse.test.cpp diff --git a/test/Window/Cursor.test.cpp b/test/Window/Cursor.test.cpp new file mode 100644 index 0000000..587f67b --- /dev/null +++ b/test/Window/Cursor.test.cpp @@ -0,0 +1,66 @@ +#include + +#include + +#include + +#include + +TEST_CASE("[Window] sfCursor") +{ + SECTION("sfCursorType") + { + STATIC_CHECK(sfCursorArrow == static_cast(sf::Cursor::Type::Arrow)); + STATIC_CHECK(sfCursorArrowWait == static_cast(sf::Cursor::Type::ArrowWait)); + STATIC_CHECK(sfCursorWait == static_cast(sf::Cursor::Type::Wait)); + STATIC_CHECK(sfCursorText == static_cast(sf::Cursor::Type::Text)); + STATIC_CHECK(sfCursorHand == static_cast(sf::Cursor::Type::Hand)); + STATIC_CHECK(sfCursorSizeHorizontal == static_cast(sf::Cursor::Type::SizeHorizontal)); + STATIC_CHECK(sfCursorSizeVertical == static_cast(sf::Cursor::Type::SizeVertical)); + STATIC_CHECK(sfCursorSizeTopLeftBottomRight == static_cast(sf::Cursor::Type::SizeTopLeftBottomRight)); + STATIC_CHECK(sfCursorSizeBottomLeftTopRight == static_cast(sf::Cursor::Type::SizeBottomLeftTopRight)); + STATIC_CHECK(sfCursorSizeLeft == static_cast(sf::Cursor::Type::SizeLeft)); + STATIC_CHECK(sfCursorSizeRight == static_cast(sf::Cursor::Type::SizeRight)); + STATIC_CHECK(sfCursorSizeTop == static_cast(sf::Cursor::Type::SizeTop)); + STATIC_CHECK(sfCursorSizeBottom == static_cast(sf::Cursor::Type::SizeBottom)); + STATIC_CHECK(sfCursorSizeTopLeft == static_cast(sf::Cursor::Type::SizeTopLeft)); + STATIC_CHECK(sfCursorSizeBottomRight == static_cast(sf::Cursor::Type::SizeBottomRight)); + STATIC_CHECK(sfCursorSizeBottomLeft == static_cast(sf::Cursor::Type::SizeBottomLeft)); + STATIC_CHECK(sfCursorSizeTopRight == static_cast(sf::Cursor::Type::SizeTopRight)); + STATIC_CHECK(sfCursorSizeAll == static_cast(sf::Cursor::Type::SizeAll)); + STATIC_CHECK(sfCursorCross == static_cast(sf::Cursor::Type::Cross)); + STATIC_CHECK(sfCursorHelp == static_cast(sf::Cursor::Type::Help)); + STATIC_CHECK(sfCursorNotAllowed == static_cast(sf::Cursor::Type::NotAllowed)); + } + + SECTION("sfCursor_createFromPixels") + { + static constexpr std::array pixels{}; + sfCursor* cursor = sfCursor_createFromPixels(pixels.data(), {1, 1}, {}); + CHECK(cursor); + sfCursor_destroy(cursor); + } + + SECTION("sfCursor_createFromSystem") + { + sfCursor* cursor{}; + + SECTION("sfCursorArrow") + { + cursor = sfCursor_createFromSystem(sfCursorArrow); + } + + SECTION("sfCursorArrowWait") + { + cursor = sfCursor_createFromSystem(sfCursorArrowWait); + } + + SECTION("sfCursorWait") + { + cursor = sfCursor_createFromSystem(sfCursorWait); + } + + CHECK(cursor); + sfCursor_destroy(cursor); + } +}