mirror of
https://github.com/SFML/CSFML.git
synced 2026-10-25 13:05:16 +01:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0066e8f352 |
No files matched your search
+1
-1
@@ -33,11 +33,11 @@ set_target_warnings(test-csfml-system)
|
|||||||
catch_discover_tests(test-csfml-system)
|
catch_discover_tests(test-csfml-system)
|
||||||
|
|
||||||
add_executable(test-csfml-window
|
add_executable(test-csfml-window
|
||||||
Window/Cursor.test.cpp
|
|
||||||
Window/Joystick.test.cpp
|
Window/Joystick.test.cpp
|
||||||
Window/Keyboard.test.cpp
|
Window/Keyboard.test.cpp
|
||||||
Window/Mouse.test.cpp
|
Window/Mouse.test.cpp
|
||||||
Window/Sensor.test.cpp
|
Window/Sensor.test.cpp
|
||||||
|
Window/VideoMode.test.cpp
|
||||||
Window/Window.test.cpp
|
Window/Window.test.cpp
|
||||||
Window/WindowBase.test.cpp
|
Window/WindowBase.test.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
#include <CSFML/Window/Cursor.h>
|
|
||||||
|
|
||||||
#include <SFML/Window/Cursor.hpp>
|
|
||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
TEST_CASE("[Window] sfCursor")
|
|
||||||
{
|
|
||||||
SECTION("sfCursorType")
|
|
||||||
{
|
|
||||||
STATIC_CHECK(sfCursorArrow == static_cast<int>(sf::Cursor::Type::Arrow));
|
|
||||||
STATIC_CHECK(sfCursorArrowWait == static_cast<int>(sf::Cursor::Type::ArrowWait));
|
|
||||||
STATIC_CHECK(sfCursorWait == static_cast<int>(sf::Cursor::Type::Wait));
|
|
||||||
STATIC_CHECK(sfCursorText == static_cast<int>(sf::Cursor::Type::Text));
|
|
||||||
STATIC_CHECK(sfCursorHand == static_cast<int>(sf::Cursor::Type::Hand));
|
|
||||||
STATIC_CHECK(sfCursorSizeHorizontal == static_cast<int>(sf::Cursor::Type::SizeHorizontal));
|
|
||||||
STATIC_CHECK(sfCursorSizeVertical == static_cast<int>(sf::Cursor::Type::SizeVertical));
|
|
||||||
STATIC_CHECK(sfCursorSizeTopLeftBottomRight == static_cast<int>(sf::Cursor::Type::SizeTopLeftBottomRight));
|
|
||||||
STATIC_CHECK(sfCursorSizeBottomLeftTopRight == static_cast<int>(sf::Cursor::Type::SizeBottomLeftTopRight));
|
|
||||||
STATIC_CHECK(sfCursorSizeLeft == static_cast<int>(sf::Cursor::Type::SizeLeft));
|
|
||||||
STATIC_CHECK(sfCursorSizeRight == static_cast<int>(sf::Cursor::Type::SizeRight));
|
|
||||||
STATIC_CHECK(sfCursorSizeTop == static_cast<int>(sf::Cursor::Type::SizeTop));
|
|
||||||
STATIC_CHECK(sfCursorSizeBottom == static_cast<int>(sf::Cursor::Type::SizeBottom));
|
|
||||||
STATIC_CHECK(sfCursorSizeTopLeft == static_cast<int>(sf::Cursor::Type::SizeTopLeft));
|
|
||||||
STATIC_CHECK(sfCursorSizeBottomRight == static_cast<int>(sf::Cursor::Type::SizeBottomRight));
|
|
||||||
STATIC_CHECK(sfCursorSizeBottomLeft == static_cast<int>(sf::Cursor::Type::SizeBottomLeft));
|
|
||||||
STATIC_CHECK(sfCursorSizeTopRight == static_cast<int>(sf::Cursor::Type::SizeTopRight));
|
|
||||||
STATIC_CHECK(sfCursorSizeAll == static_cast<int>(sf::Cursor::Type::SizeAll));
|
|
||||||
STATIC_CHECK(sfCursorCross == static_cast<int>(sf::Cursor::Type::Cross));
|
|
||||||
STATIC_CHECK(sfCursorHelp == static_cast<int>(sf::Cursor::Type::Help));
|
|
||||||
STATIC_CHECK(sfCursorNotAllowed == static_cast<int>(sf::Cursor::Type::NotAllowed));
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION("sfCursor_createFromPixels")
|
|
||||||
{
|
|
||||||
static constexpr std::array<std::uint8_t, 4> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#include <CSFML/Window/VideoMode.h>
|
||||||
|
|
||||||
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
|
TEST_CASE("[Window] sfVideoMode")
|
||||||
|
{
|
||||||
|
SECTION("Construction")
|
||||||
|
{
|
||||||
|
const sfVideoMode videoMode{};
|
||||||
|
CHECK(videoMode.size.x == 0);
|
||||||
|
CHECK(videoMode.size.y == 0);
|
||||||
|
CHECK(videoMode.bitsPerPixel == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("sfVideoMode_getDesktopMode()")
|
||||||
|
{
|
||||||
|
const sfVideoMode videoMode = sfVideoMode_getDesktopMode();
|
||||||
|
CHECK(videoMode.size.x != 0);
|
||||||
|
CHECK(videoMode.size.y != 0);
|
||||||
|
CHECK(videoMode.bitsPerPixel != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("sfVideoMode_getFullscreenModes()")
|
||||||
|
{
|
||||||
|
std::size_t count = 0;
|
||||||
|
const sfVideoMode* videoModes = sfVideoMode_getFullscreenModes(&count);
|
||||||
|
REQUIRE(count > 0);
|
||||||
|
const sfVideoMode& videoMode = videoModes[0];
|
||||||
|
CHECK(videoMode.size.x != 0);
|
||||||
|
CHECK(videoMode.size.y != 0);
|
||||||
|
CHECK(videoMode.bitsPerPixel != 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("sfVideoMode_isValid")
|
||||||
|
{
|
||||||
|
CHECK(!sfVideoMode_isValid({}));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user