|
|
|
@ -35,7 +35,9 @@ |
|
|
|
namespace Magnum { namespace Math { namespace Test { |
|
|
|
namespace Magnum { namespace Math { namespace Test { |
|
|
|
|
|
|
|
|
|
|
|
typedef Math::Vector2<Float> Vector2; |
|
|
|
typedef Math::Vector2<Float> Vector2; |
|
|
|
|
|
|
|
typedef Math::Vector2<Double> Vector2d; |
|
|
|
typedef Math::QuadraticBezier2D<Float> QuadraticBezier2D; |
|
|
|
typedef Math::QuadraticBezier2D<Float> QuadraticBezier2D; |
|
|
|
|
|
|
|
typedef Math::QuadraticBezier2D<Double> QuadraticBezier2Dd; |
|
|
|
typedef Math::CubicBezier2D<Float> CubicBezier2D; |
|
|
|
typedef Math::CubicBezier2D<Float> CubicBezier2D; |
|
|
|
|
|
|
|
|
|
|
|
struct BezierTest : Corrade::TestSuite::Tester { |
|
|
|
struct BezierTest : Corrade::TestSuite::Tester { |
|
|
|
@ -44,6 +46,7 @@ struct BezierTest : Corrade::TestSuite::Tester { |
|
|
|
void construct(); |
|
|
|
void construct(); |
|
|
|
void constructDefault(); |
|
|
|
void constructDefault(); |
|
|
|
void constructNoInit(); |
|
|
|
void constructNoInit(); |
|
|
|
|
|
|
|
void constructConversion(); |
|
|
|
void constructCopy(); |
|
|
|
void constructCopy(); |
|
|
|
|
|
|
|
|
|
|
|
void data(); |
|
|
|
void data(); |
|
|
|
@ -61,6 +64,7 @@ BezierTest::BezierTest() { |
|
|
|
addTests({&BezierTest::construct, |
|
|
|
addTests({&BezierTest::construct, |
|
|
|
&BezierTest::constructDefault, |
|
|
|
&BezierTest::constructDefault, |
|
|
|
&BezierTest::constructNoInit, |
|
|
|
&BezierTest::constructNoInit, |
|
|
|
|
|
|
|
&BezierTest::constructConversion, |
|
|
|
&BezierTest::constructCopy, |
|
|
|
&BezierTest::constructCopy, |
|
|
|
|
|
|
|
|
|
|
|
&BezierTest::data, |
|
|
|
&BezierTest::data, |
|
|
|
@ -100,6 +104,18 @@ void BezierTest::constructNoInit() { |
|
|
|
CORRADE_VERIFY((std::is_nothrow_constructible<QuadraticBezier2D, NoInitT>::value)); |
|
|
|
CORRADE_VERIFY((std::is_nothrow_constructible<QuadraticBezier2D, NoInitT>::value)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BezierTest::constructConversion() { |
|
|
|
|
|
|
|
constexpr QuadraticBezier2Dd a{Vector2d{0.5, 1.0}, Vector2d{1.1, 0.3}, Vector2d{0.1, 1.2}}; |
|
|
|
|
|
|
|
constexpr QuadraticBezier2D b{a}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CORRADE_COMPARE(b, (QuadraticBezier2D{Vector2{0.5f, 1.0f}, Vector2{1.1f, 0.3f}, Vector2{0.1f, 1.2f}})); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Implicit conversion is not allowed */ |
|
|
|
|
|
|
|
CORRADE_VERIFY(!(std::is_convertible<QuadraticBezier2Dd, QuadraticBezier2D>::value)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CORRADE_VERIFY((std::is_nothrow_constructible<QuadraticBezier2D, QuadraticBezier2Dd>::value)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BezierTest::constructCopy() { |
|
|
|
void BezierTest::constructCopy() { |
|
|
|
constexpr QuadraticBezier2D a{Vector2{0.5f, 1.0f}, Vector2{1.1f, 0.3f}, Vector2{0.1f, 1.2f}}; |
|
|
|
constexpr QuadraticBezier2D a{Vector2{0.5f, 1.0f}, Vector2{1.1f, 0.3f}, Vector2{0.1f, 1.2f}}; |
|
|
|
constexpr QuadraticBezier2D b{a}; |
|
|
|
constexpr QuadraticBezier2D b{a}; |
|
|
|
|