mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Add more tests for sf::VideoMode
This commit is contained in:
parent
3a0d074b2f
commit
ff5eaca6a2
@ -3,9 +3,10 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include <WindowUtil.hpp>
|
#include <WindowUtil.hpp>
|
||||||
|
#include <algorithm>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
TEST_CASE("[Window] sf::VideoMode")
|
TEST_CASE("[Window] sf::VideoMode", runDisplayTests())
|
||||||
{
|
{
|
||||||
SECTION("Type traits")
|
SECTION("Type traits")
|
||||||
{
|
{
|
||||||
@ -19,26 +20,38 @@ TEST_CASE("[Window] sf::VideoMode")
|
|||||||
{
|
{
|
||||||
SECTION("Default constructor")
|
SECTION("Default constructor")
|
||||||
{
|
{
|
||||||
sf::VideoMode videoMode;
|
const sf::VideoMode videoMode;
|
||||||
CHECK(videoMode.size == sf::Vector2u(0, 0));
|
CHECK(videoMode.size == sf::Vector2u(0, 0));
|
||||||
CHECK(videoMode.bitsPerPixel == 0);
|
CHECK(videoMode.bitsPerPixel == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Width, height constructor")
|
SECTION("Width, height constructor")
|
||||||
{
|
{
|
||||||
sf::VideoMode videoMode({800, 600});
|
const sf::VideoMode videoMode({800, 600});
|
||||||
CHECK(videoMode.size == sf::Vector2u(800, 600));
|
CHECK(videoMode.size == sf::Vector2u(800, 600));
|
||||||
CHECK(videoMode.bitsPerPixel == 32);
|
CHECK(videoMode.bitsPerPixel == 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Width, height, bit depth constructor")
|
SECTION("Width, height, bit depth constructor")
|
||||||
{
|
{
|
||||||
sf::VideoMode videoMode({800, 600}, 24);
|
const sf::VideoMode videoMode({800, 600}, 24);
|
||||||
CHECK(videoMode.size == sf::Vector2u(800, 600));
|
CHECK(videoMode.size == sf::Vector2u(800, 600));
|
||||||
CHECK(videoMode.bitsPerPixel == 24);
|
CHECK(videoMode.bitsPerPixel == 24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SECTION("getFullscreenModes()")
|
||||||
|
{
|
||||||
|
const auto& modes = sf::VideoMode::getFullscreenModes();
|
||||||
|
CHECK(std::is_sorted(modes.begin(), modes.end(), std::greater<>()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("isValid()")
|
||||||
|
{
|
||||||
|
const sf::VideoMode videoMode;
|
||||||
|
CHECK(!videoMode.isValid());
|
||||||
|
}
|
||||||
|
|
||||||
SECTION("Operators")
|
SECTION("Operators")
|
||||||
{
|
{
|
||||||
SECTION("operator==")
|
SECTION("operator==")
|
||||||
|
Loading…
Reference in New Issue
Block a user