Skip to content

Commit 184e9ba

Browse files
committed
Add tests for sfVideoMode
1 parent ab1a1a2 commit 184e9ba

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ add_executable(test-csfml-window
3737
Window/Keyboard.test.cpp
3838
Window/Mouse.test.cpp
3939
Window/Sensor.test.cpp
40+
Window/VideoMode.test.cpp
4041
Window/Window.test.cpp
4142
Window/WindowBase.test.cpp
4243
)

test/Window/VideoMode.test.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <CSFML/Window/VideoMode.h>
2+
3+
#include <catch2/catch_test_macros.hpp>
4+
5+
TEST_CASE("[Window] sfVideoMode")
6+
{
7+
SECTION("Construction")
8+
{
9+
const sfVideoMode videoMode{};
10+
CHECK(videoMode.width == 0);
11+
CHECK(videoMode.height == 0);
12+
CHECK(videoMode.bitsPerPixel == 0);
13+
}
14+
15+
SECTION("sfVideoMode_getDesktopMode()")
16+
{
17+
const sfVideoMode videoMode = sfVideoMode_getDesktopMode();
18+
CHECK(videoMode.width != 0);
19+
CHECK(videoMode.height != 0);
20+
CHECK(videoMode.bitsPerPixel != 0);
21+
}
22+
23+
SECTION("sfVideoMode_getFullscreenModes()")
24+
{
25+
std::size_t count = 0;
26+
const sfVideoMode* videoModes = sfVideoMode_getFullscreenModes(&count);
27+
REQUIRE(count > 0);
28+
const sfVideoMode& videoMode = videoModes[0];
29+
CHECK(videoMode.width != 0);
30+
CHECK(videoMode.height != 0);
31+
CHECK(videoMode.bitsPerPixel != 0);
32+
}
33+
34+
SECTION("sfVideoMode_isValid")
35+
{
36+
CHECK(!sfVideoMode_isValid({}));
37+
}
38+
}

0 commit comments

Comments
 (0)