diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 474fc27..b3fa65c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,6 +37,7 @@ add_executable(test-csfml-window Window/Keyboard.test.cpp Window/Mouse.test.cpp Window/Sensor.test.cpp + Window/VideoMode.test.cpp Window/Window.test.cpp Window/WindowBase.test.cpp ) diff --git a/test/Window/VideoMode.test.cpp b/test/Window/VideoMode.test.cpp new file mode 100644 index 0000000..32f93a0 --- /dev/null +++ b/test/Window/VideoMode.test.cpp @@ -0,0 +1,38 @@ +#include + +#include + +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({})); + } +}