SFML/test/Window/ContextSettings.test.cpp

44 lines
1.7 KiB
C++
Raw Normal View History

2022-01-12 11:17:15 +08:00
#include <SFML/Window/ContextSettings.hpp>
2023-01-18 12:51:08 +08:00
#include <catch2/catch_test_macros.hpp>
2022-01-12 11:17:15 +08:00
#include <type_traits>
TEST_CASE("[Window] sf::ContextSettings")
2022-01-12 11:17:15 +08:00
{
2023-01-18 12:51:08 +08:00
SECTION("Type traits")
{
STATIC_CHECK(std::is_copy_constructible_v<sf::ContextSettings>);
STATIC_CHECK(std::is_copy_assignable_v<sf::ContextSettings>);
STATIC_CHECK(std::is_nothrow_move_constructible_v<sf::ContextSettings>);
STATIC_CHECK(std::is_nothrow_move_assignable_v<sf::ContextSettings>);
}
SECTION("Construction")
2022-01-12 11:17:15 +08:00
{
2023-01-18 12:51:08 +08:00
SECTION("Default constructor")
2022-01-12 11:17:15 +08:00
{
2023-01-18 12:51:08 +08:00
constexpr sf::ContextSettings contextSettings;
STATIC_CHECK(contextSettings.depthBits == 0);
STATIC_CHECK(contextSettings.stencilBits == 0);
STATIC_CHECK(contextSettings.antialiasingLevel == 0);
STATIC_CHECK(contextSettings.majorVersion == 1);
STATIC_CHECK(contextSettings.minorVersion == 1);
STATIC_CHECK(contextSettings.attributeFlags == sf::ContextSettings::Default);
STATIC_CHECK(contextSettings.sRgbCapable == false);
2022-01-12 11:17:15 +08:00
}
2023-01-18 12:51:08 +08:00
SECTION("Verbose constructor")
2022-01-12 11:17:15 +08:00
{
2023-01-18 12:51:08 +08:00
constexpr sf::ContextSettings contextSettings(1, 1, 2, 3, 5, sf::ContextSettings::Core, true);
STATIC_CHECK(contextSettings.depthBits == 1);
STATIC_CHECK(contextSettings.stencilBits == 1);
STATIC_CHECK(contextSettings.antialiasingLevel == 2);
STATIC_CHECK(contextSettings.majorVersion == 3);
STATIC_CHECK(contextSettings.minorVersion == 5);
STATIC_CHECK(contextSettings.attributeFlags == sf::ContextSettings::Core);
STATIC_CHECK(contextSettings.sRgbCapable == true);
2022-01-12 11:17:15 +08:00
}
}
}