Triangles/src/unittest/test_helpers.cpp
Stephen Seo d30a792aca Impl edit tri color, and more
Added way to select and edit colors of placed Tris.
Added third_party catch unit test framework that builds the UnitTest in
Debug builds.
Refactor internal use of notification_text.
Rename src/imgui_helper.hpp to src/helpers.hpp
Added some helper functions, including "is_within_shape" (used for
selecting a Tri).
Fixed use of flags in helpers not using enum values.
2020-08-04 21:13:17 +09:00

19 lines
553 B
C++

#include "catch.hpp"
#include <SFML/Graphics.hpp>
#include "helpers.hpp"
TEST_CASE("Test is_within_shape", "[Triangles]") {
sf::ConvexShape shape;
shape.setPointCount(3);
shape.setPoint(0, {0.0f, 10.0f});
shape.setPoint(1, {10.0f, 10.0f});
shape.setPoint(2, {10.0f, 0.0f});
CHECK(Tri::is_within_shape(shape, {2.0f, 2.0f}) == false);
CHECK(Tri::is_within_shape(shape, {5.0f, 15.0f}) == false);
CHECK(Tri::is_within_shape(shape, {15.0f, 5.0f}) == false);
CHECK(Tri::is_within_shape(shape, {7.0f, 7.0f}) == true);
}