|
| 1 | +#include <CSFML/Window/Cursor.h> |
| 2 | + |
| 3 | +#include <SFML/Window/Cursor.hpp> |
| 4 | + |
| 5 | +#include <catch2/catch_test_macros.hpp> |
| 6 | + |
| 7 | +#include <array> |
| 8 | + |
| 9 | +TEST_CASE("[Window] sfCursor") |
| 10 | +{ |
| 11 | + SECTION("sfCursorType") |
| 12 | + { |
| 13 | + STATIC_CHECK(sfCursorArrow == static_cast<int>(sf::Cursor::Type::Arrow)); |
| 14 | + STATIC_CHECK(sfCursorArrowWait == static_cast<int>(sf::Cursor::Type::ArrowWait)); |
| 15 | + STATIC_CHECK(sfCursorWait == static_cast<int>(sf::Cursor::Type::Wait)); |
| 16 | + STATIC_CHECK(sfCursorText == static_cast<int>(sf::Cursor::Type::Text)); |
| 17 | + STATIC_CHECK(sfCursorHand == static_cast<int>(sf::Cursor::Type::Hand)); |
| 18 | + STATIC_CHECK(sfCursorSizeHorizontal == static_cast<int>(sf::Cursor::Type::SizeHorizontal)); |
| 19 | + STATIC_CHECK(sfCursorSizeVertical == static_cast<int>(sf::Cursor::Type::SizeVertical)); |
| 20 | + STATIC_CHECK(sfCursorSizeTopLeftBottomRight == static_cast<int>(sf::Cursor::Type::SizeTopLeftBottomRight)); |
| 21 | + STATIC_CHECK(sfCursorSizeBottomLeftTopRight == static_cast<int>(sf::Cursor::Type::SizeBottomLeftTopRight)); |
| 22 | + STATIC_CHECK(sfCursorSizeLeft == static_cast<int>(sf::Cursor::Type::SizeLeft)); |
| 23 | + STATIC_CHECK(sfCursorSizeRight == static_cast<int>(sf::Cursor::Type::SizeRight)); |
| 24 | + STATIC_CHECK(sfCursorSizeTop == static_cast<int>(sf::Cursor::Type::SizeTop)); |
| 25 | + STATIC_CHECK(sfCursorSizeBottom == static_cast<int>(sf::Cursor::Type::SizeBottom)); |
| 26 | + STATIC_CHECK(sfCursorSizeTopLeft == static_cast<int>(sf::Cursor::Type::SizeTopLeft)); |
| 27 | + STATIC_CHECK(sfCursorSizeBottomRight == static_cast<int>(sf::Cursor::Type::SizeBottomRight)); |
| 28 | + STATIC_CHECK(sfCursorSizeBottomLeft == static_cast<int>(sf::Cursor::Type::SizeBottomLeft)); |
| 29 | + STATIC_CHECK(sfCursorSizeTopRight == static_cast<int>(sf::Cursor::Type::SizeTopRight)); |
| 30 | + STATIC_CHECK(sfCursorSizeAll == static_cast<int>(sf::Cursor::Type::SizeAll)); |
| 31 | + STATIC_CHECK(sfCursorCross == static_cast<int>(sf::Cursor::Type::Cross)); |
| 32 | + STATIC_CHECK(sfCursorHelp == static_cast<int>(sf::Cursor::Type::Help)); |
| 33 | + STATIC_CHECK(sfCursorNotAllowed == static_cast<int>(sf::Cursor::Type::NotAllowed)); |
| 34 | + } |
| 35 | + |
| 36 | + SECTION("sfCursor_createFromPixels") |
| 37 | + { |
| 38 | + static constexpr std::array<std::uint8_t, 4> pixels{}; |
| 39 | + sfCursor* cursor = sfCursor_createFromPixels(pixels.data(), {1, 1}, {}); |
| 40 | + CHECK(cursor); |
| 41 | + sfCursor_destroy(cursor); |
| 42 | + } |
| 43 | + |
| 44 | + SECTION("sfCursor_createFromSystem") |
| 45 | + { |
| 46 | + sfCursor* cursor{}; |
| 47 | + |
| 48 | + SECTION("sfCursorArrow") |
| 49 | + { |
| 50 | + cursor = sfCursor_createFromSystem(sfCursorArrow); |
| 51 | + } |
| 52 | + |
| 53 | + SECTION("sfCursorArrowWait") |
| 54 | + { |
| 55 | + cursor = sfCursor_createFromSystem(sfCursorArrowWait); |
| 56 | + } |
| 57 | + |
| 58 | + SECTION("sfCursorWait") |
| 59 | + { |
| 60 | + cursor = sfCursor_createFromSystem(sfCursorWait); |
| 61 | + } |
| 62 | + |
| 63 | + CHECK(cursor); |
| 64 | + sfCursor_destroy(cursor); |
| 65 | + } |
| 66 | +} |
0 commit comments