mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
#include <SFML/Graphics/ConvexShape.hpp>
|
|
|
|
#include <doctest/doctest.h>
|
|
|
|
#include <SystemUtil.hpp>
|
|
#include <type_traits>
|
|
|
|
static_assert(std::is_copy_constructible_v<sf::ConvexShape>);
|
|
static_assert(std::is_copy_assignable_v<sf::ConvexShape>);
|
|
static_assert(std::is_move_constructible_v<sf::ConvexShape>);
|
|
static_assert(std::is_move_assignable_v<sf::ConvexShape>);
|
|
|
|
TEST_CASE("[Graphics] sf::ConvexShape")
|
|
{
|
|
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));
|
|
}
|
|
}
|