2022-04-09 08:33:50 +08:00
|
|
|
#include <SFML/Graphics/RectangleShape.hpp>
|
|
|
|
|
2022-07-18 06:18:40 +08:00
|
|
|
#include <doctest/doctest.h>
|
2022-04-09 08:33:50 +08:00
|
|
|
|
2022-07-05 00:20:58 +08:00
|
|
|
#include <SystemUtil.hpp>
|
2022-07-25 14:36:05 +08:00
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
static_assert(std::is_copy_constructible_v<sf::RectangleShape>);
|
|
|
|
static_assert(std::is_copy_assignable_v<sf::RectangleShape>);
|
2023-03-05 21:03:27 +08:00
|
|
|
static_assert(std::is_nothrow_move_constructible_v<sf::RectangleShape>);
|
|
|
|
static_assert(std::is_nothrow_move_assignable_v<sf::RectangleShape>);
|
2022-07-05 00:20:58 +08:00
|
|
|
|
2022-07-05 13:51:18 +08:00
|
|
|
TEST_CASE("[Graphics] sf::RectangleShape")
|
2022-04-09 08:33:50 +08:00
|
|
|
{
|
|
|
|
SUBCASE("Default constructor")
|
|
|
|
{
|
|
|
|
const sf::RectangleShape rectangle;
|
|
|
|
CHECK(rectangle.getSize() == sf::Vector2f(0, 0));
|
|
|
|
CHECK(rectangle.getPointCount() == 4);
|
|
|
|
CHECK(rectangle.getPoint(0) == sf::Vector2f(0, 0));
|
|
|
|
CHECK(rectangle.getPoint(1) == sf::Vector2f(0, 0));
|
|
|
|
CHECK(rectangle.getPoint(2) == sf::Vector2f(0, 0));
|
|
|
|
CHECK(rectangle.getPoint(3) == sf::Vector2f(0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("Size constructor")
|
|
|
|
{
|
|
|
|
const sf::RectangleShape rectangle({9, 8});
|
|
|
|
CHECK(rectangle.getSize() == sf::Vector2f(9, 8));
|
|
|
|
CHECK(rectangle.getPointCount() == 4);
|
|
|
|
CHECK(rectangle.getPoint(0) == sf::Vector2f(0, 0));
|
|
|
|
CHECK(rectangle.getPoint(1) == sf::Vector2f(9, 0));
|
|
|
|
CHECK(rectangle.getPoint(2) == sf::Vector2f(9, 8));
|
|
|
|
CHECK(rectangle.getPoint(3) == sf::Vector2f(0, 8));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("Set size")
|
|
|
|
{
|
|
|
|
sf::RectangleShape rectangle({7, 6});
|
|
|
|
rectangle.setSize({5, 4});
|
|
|
|
CHECK(rectangle.getSize() == sf::Vector2f(5, 4));
|
|
|
|
}
|
|
|
|
}
|