2022-06-01 23:12:48 -06:00
|
|
|
#include <SFML/Graphics/ConvexShape.hpp>
|
|
|
|
|
2022-07-17 16:18:40 -06:00
|
|
|
#include <doctest/doctest.h>
|
2022-06-01 23:12:48 -06:00
|
|
|
|
2022-07-04 11:20:58 -05:00
|
|
|
#include <SystemUtil.hpp>
|
2022-07-25 00:36:05 -06:00
|
|
|
#include <type_traits>
|
|
|
|
|
|
|
|
static_assert(std::is_copy_constructible_v<sf::ConvexShape>);
|
|
|
|
static_assert(std::is_copy_assignable_v<sf::ConvexShape>);
|
2023-03-05 14:03:27 +01:00
|
|
|
static_assert(std::is_nothrow_move_constructible_v<sf::ConvexShape>);
|
|
|
|
static_assert(std::is_nothrow_move_assignable_v<sf::ConvexShape>);
|
2022-07-04 11:20:58 -05:00
|
|
|
|
2022-07-04 23:51:18 -06:00
|
|
|
TEST_CASE("[Graphics] sf::ConvexShape")
|
2022-06-01 23:12:48 -06:00
|
|
|
{
|
|
|
|
SUBCASE("Default constructor")
|
|
|
|
{
|
|
|
|
const sf::ConvexShape convex;
|
|
|
|
CHECK(convex.getPointCount() == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("Point count constructor")
|
|
|
|
{
|
|
|
|
const sf::ConvexShape convex(15);
|
|
|
|
CHECK(convex.getPointCount() == 15);
|
|
|
|
for (std::size_t i = 0; i < convex.getPointCount(); ++i)
|
|
|
|
CHECK(convex.getPoint(i) == sf::Vector2f(0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("Set point count")
|
|
|
|
{
|
|
|
|
sf::ConvexShape convex;
|
|
|
|
convex.setPointCount(42);
|
|
|
|
CHECK(convex.getPointCount() == 42);
|
|
|
|
for (std::size_t i = 0; i < convex.getPointCount(); ++i)
|
|
|
|
CHECK(convex.getPoint(i) == sf::Vector2f(0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("Set point")
|
|
|
|
{
|
|
|
|
sf::ConvexShape convex;
|
|
|
|
convex.setPointCount(1);
|
|
|
|
convex.setPoint(0, {3, 4});
|
|
|
|
CHECK(convex.getPoint(0) == sf::Vector2f(3, 4));
|
|
|
|
}
|
|
|
|
}
|