mirror of
https://github.com/SFML/SFML.git
synced 2025-02-19 06:39:59 +08:00
Add tests for sf::RectangleShape
This commit is contained in:
parent
a302a9829e
commit
9010e7ba38
@ -31,6 +31,7 @@ SET(GRAPHICS_SRC
|
|||||||
Graphics/BlendMode.cpp
|
Graphics/BlendMode.cpp
|
||||||
Graphics/Color.cpp
|
Graphics/Color.cpp
|
||||||
Graphics/Rect.cpp
|
Graphics/Rect.cpp
|
||||||
|
Graphics/RectangleShape.cpp
|
||||||
Graphics/Shape.cpp
|
Graphics/Shape.cpp
|
||||||
Graphics/Transform.cpp
|
Graphics/Transform.cpp
|
||||||
Graphics/Transformable.cpp
|
Graphics/Transformable.cpp
|
||||||
|
36
test/Graphics/RectangleShape.cpp
Normal file
36
test/Graphics/RectangleShape.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#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));
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user