fd3526f742
SFML convention is to only use "" includes when the header is in the same directory as the file including it. Because these test util headers are in a separate directory, it makes more sense to include them via <>.
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#include <SFML/Graphics/RectangleShape.hpp>
|
|
#include <SystemUtil.hpp>
|
|
|
|
#include <doctest.h>
|
|
|
|
TEST_CASE("sf::RectangleShape class - [graphics]")
|
|
{
|
|
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));
|
|
}
|
|
}
|