diff --git a/src/Shapes/Test/CompositionTest.cpp b/src/Shapes/Test/CompositionTest.cpp index e07e34a9d..381616b5e 100644 --- a/src/Shapes/Test/CompositionTest.cpp +++ b/src/Shapes/Test/CompositionTest.cpp @@ -24,6 +24,7 @@ #include +#include "Math/Matrix3.h" #include "Math/Matrix4.h" #include "Shapes/Point.h" #include "Shapes/AxisAlignedBox.h" @@ -44,6 +45,8 @@ class CompositionTest: public TestSuite::Tester { void multipleUnary(); void hierarchy(); void empty(); + + void transformed(); }; CompositionTest::CompositionTest() { @@ -52,7 +55,9 @@ CompositionTest::CompositionTest() { &CompositionTest::ored, &CompositionTest::multipleUnary, &CompositionTest::hierarchy, - &CompositionTest::empty}); + &CompositionTest::empty, + + &CompositionTest::transformed}); } void CompositionTest::negated() { @@ -125,6 +130,18 @@ void CompositionTest::empty() { VERIFY_NOT_COLLIDES(a, Shapes::Sphere2D({}, 1.0f)); } +void CompositionTest::transformed() { + const Shapes::Composition2D a = Shapes::Sphere2D({}, 1.0f) && + (Shapes::Point2D(Vector2::xAxis(1.5f)) || !Shapes::AxisAlignedBox2D({}, Vector2(0.5f))); + + const Shapes::Composition2D b = a.transformed(Matrix3::translation({1.5f, -7.0f})); + CORRADE_COMPARE(b.get(0).position(), Vector2(1.5f, -7.0f)); + CORRADE_COMPARE(b.get(0).radius(), 1.0f); + CORRADE_COMPARE(b.get(1).position(), Vector2(3.0f, -7.0f)); + CORRADE_COMPARE(b.get(2).min(), Vector2(1.5f, -7.0f)); + CORRADE_COMPARE(b.get(2).max(), Vector2(2.0f, -6.5f)); +} + }}} CORRADE_TEST_MAIN(Magnum::Shapes::Test::CompositionTest)