diff --git a/src/Math/Test/Vector2Test.cpp b/src/Math/Test/Vector2Test.cpp index 78a66cdc7..26287e127 100644 --- a/src/Math/Test/Vector2Test.cpp +++ b/src/Math/Test/Vector2Test.cpp @@ -29,6 +29,10 @@ namespace Magnum { namespace Math { namespace Test { typedef Math::Vector2 Vector2; +void Vector2Test::construct() { + QVERIFY((Vector2(1, 2) == Vector(1.0f, 2.0f))); +} + void Vector2Test::debug() { ostringstream o; Debug(&o) << Vector2(0.5f, 15.0f); diff --git a/src/Math/Test/Vector2Test.h b/src/Math/Test/Vector2Test.h index 5bf539320..7d67c7571 100644 --- a/src/Math/Test/Vector2Test.h +++ b/src/Math/Test/Vector2Test.h @@ -23,6 +23,7 @@ class Vector2Test: public QObject { Q_OBJECT private slots: + void construct(); void debug(); }; diff --git a/src/Math/Test/Vector3Test.cpp b/src/Math/Test/Vector3Test.cpp index 98682a450..ec8cf18eb 100644 --- a/src/Math/Test/Vector3Test.cpp +++ b/src/Math/Test/Vector3Test.cpp @@ -29,6 +29,11 @@ namespace Magnum { namespace Math { namespace Test { typedef Math::Vector3 Vector3; +void Vector3Test::construct() { + QVERIFY((Vector3(1, 2, 3) == Vector(1.0f, 2.0f, 3.0f))); + QVERIFY((Vector3(Vector(1.0f, 2.0f), 3) == Vector(1.0f, 2.0f, 3.0f))); +} + void Vector3Test::cross() { Vector3 a(1, -1, 1); Vector3 b(4, 3, 7); diff --git a/src/Math/Test/Vector3Test.h b/src/Math/Test/Vector3Test.h index 54e2b34df..69fa9d6e9 100644 --- a/src/Math/Test/Vector3Test.h +++ b/src/Math/Test/Vector3Test.h @@ -23,6 +23,7 @@ class Vector3Test: public QObject { Q_OBJECT private slots: + void construct(); void cross(); void debug(); diff --git a/src/Math/Test/Vector4Test.cpp b/src/Math/Test/Vector4Test.cpp index 364bce0ee..c3c8aa061 100644 --- a/src/Math/Test/Vector4Test.cpp +++ b/src/Math/Test/Vector4Test.cpp @@ -32,6 +32,8 @@ typedef Math::Vector3 Vector3; void Vector4Test::construct() { QVERIFY(Vector4() == Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + QVERIFY((Vector4(1, 2, 3, 4) == Vector(1.0f, 2.0f, 3.0f, 4.0f))); + QVERIFY((Vector4(Vector(1.0f, 2.0f, 3.0f), 4) == Vector(1.0f, 2.0f, 3.0f, 4.0f))); } void Vector4Test::threeComponent() { diff --git a/src/Math/Vector3.h b/src/Math/Vector3.h index db1b5a153..7f8c52562 100644 --- a/src/Math/Vector3.h +++ b/src/Math/Vector3.h @@ -64,7 +64,7 @@ template class Vector3: public Vector { * @param other Two component vector * @param z Z / B value */ - inline Vector3(const Vector& other, T z = T(0)): Vector(other[0], other[1], other[2]) {} + inline Vector3(const Vector& other, T z = T(0)): Vector(other[0], other[1], z) {} inline T x() const { return Vector::at(0); } /**< @brief X component */ inline T y() const { return Vector::at(1); } /**< @brief Y component */