Add tests for sf::ContextSettings

This commit is contained in:
Chris Thrasher 2022-01-11 20:17:15 -07:00 committed by Lukas Dürrenberger
parent a880122836
commit 871c021a75
2 changed files with 34 additions and 0 deletions

View File

@ -21,6 +21,7 @@ target_link_libraries(test-sfml-system PRIVATE sfml-test-main)
if(SFML_BUILD_WINDOW)
SET(WINDOW_SRC
"${SRCROOT}/Window/ContextSettings.cpp"
"${SRCROOT}/Window/VideoMode.cpp"
"${SRCROOT}/TestUtilities/WindowUtil.hpp"
"${SRCROOT}/TestUtilities/WindowUtil.cpp"

View File

@ -0,0 +1,33 @@
#include <SFML/Window/ContextSettings.hpp>
#include <doctest.h>
TEST_CASE("sf::ContextSettings class - [window]")
{
SUBCASE("Construction")
{
SUBCASE("Default constructor")
{
const sf::ContextSettings contextSettings;
CHECK(contextSettings.depthBits == 0);
CHECK(contextSettings.stencilBits == 0);
CHECK(contextSettings.antialiasingLevel == 0);
CHECK(contextSettings.majorVersion == 1);
CHECK(contextSettings.minorVersion == 1);
CHECK(contextSettings.attributeFlags == sf::ContextSettings::Default);
CHECK(contextSettings.sRgbCapable == false);
}
SUBCASE("Verbose constructor")
{
const sf::ContextSettings contextSettings(1, 1, 2, 3, 5, sf::ContextSettings::Core, true);
CHECK(contextSettings.depthBits == 1);
CHECK(contextSettings.stencilBits == 1);
CHECK(contextSettings.antialiasingLevel == 2);
CHECK(contextSettings.majorVersion == 3);
CHECK(contextSettings.minorVersion == 5);
CHECK(contextSettings.attributeFlags == sf::ContextSettings::Core);
CHECK(contextSettings.sRgbCapable == true);
}
}
}