diff --git a/CMakeLists.txt b/CMakeLists.txt index 617f3c1c6..d4e5edacf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,12 +27,6 @@ if(WITH_EVERYTHING) endif() if(BUILD_TESTS) - find_package(Qt4) - - if(NOT QT4_FOUND) - message(FATAL_ERROR "Qt4, required for building unit tests, was not found. Set BUILD_TESTS to OFF to skip building them.") - endif() - enable_testing() endif() diff --git a/PKGBUILD b/PKGBUILD index 0953e7761..532445d6f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -7,7 +7,7 @@ arch=('i686' 'x86_64') url="https://github.com/mosra/magnum" license=('LGPLv3') depends=('corrade' 'glew') -makedepends=('cmake' 'qt') +makedepends=('cmake') options=(!strip) provides=('magnum-git') diff --git a/README.md b/README.md index 086fcef4a..07fde48cf 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ Building and running unit tests ------------------------------- If you want to build also unit tests (which are not built by default), pass -`-DBUILD_TESTS=True` to CMake. Unit tests use QtTest framework (you need at -least **Qt 4.6**) and can be run using +`-DBUILD_TESTS=True` to CMake. Unit tests use Corrade's TestSuite framework +and can be run using ctest -V diff --git a/doc/building.dox b/doc/building.dox index cc17e340f..5f85874d8 100644 --- a/doc/building.dox +++ b/doc/building.dox @@ -78,8 +78,8 @@ None of the context libraries is built by default, regardless to @subsection building-tests Building and running unit tests If you want to build also unit tests (which are not built by default), pass -`-DBUILD_TESTS=True` to CMake. Unit tests use QtTest framework (you need at -least **Qt 4.6**) and can be run using +`-DBUILD_TESTS=True` to CMake. Unit tests use Corrade's @ref Corrade::TestSuite +"TestSuite" framework and can be run using ctest -V diff --git a/package/archlinux/magnum-git/PKGBUILD b/package/archlinux/magnum-git/PKGBUILD index 0622a892a..f4931acf7 100644 --- a/package/archlinux/magnum-git/PKGBUILD +++ b/package/archlinux/magnum-git/PKGBUILD @@ -35,6 +35,11 @@ build() { make } +check() { + cd "$startdir/build" + ctest --output-on-failure -E Benchmark +} + package() { cd "$srcdir/build" make DESTDIR="$pkgdir/" install diff --git a/src/Math/Geometry/Test/CMakeLists.txt b/src/Math/Geometry/Test/CMakeLists.txt index ae56b3a13..eb7810334 100644 --- a/src/Math/Geometry/Test/CMakeLists.txt +++ b/src/Math/Geometry/Test/CMakeLists.txt @@ -1,2 +1,2 @@ -corrade_add_test(MathGeometryDistanceTest DistanceTest.h DistanceTest.cpp) -corrade_add_test(MathGeometryIntersectionTest IntersectionTest.h IntersectionTest.cpp) +corrade_add_test2(MathGeometryDistanceTest DistanceTest.cpp) +corrade_add_test2(MathGeometryIntersectionTest IntersectionTest.cpp) diff --git a/src/Math/Geometry/Test/DistanceTest.cpp b/src/Math/Geometry/Test/DistanceTest.cpp index b0738d7df..5f14c0aa4 100644 --- a/src/Math/Geometry/Test/DistanceTest.cpp +++ b/src/Math/Geometry/Test/DistanceTest.cpp @@ -16,12 +16,11 @@ #include "DistanceTest.h" #include -#include #include "Math.h" #include "Distance.h" -QTEST_APPLESS_MAIN(Magnum::Math::Geometry::Test::DistanceTest) +CORRADE_TEST_MAIN(Magnum::Math::Geometry::Test::DistanceTest) using namespace std; @@ -29,17 +28,22 @@ namespace Magnum { namespace Math { namespace Geometry { namespace Test { typedef Magnum::Math::Vector3 Vector3; +DistanceTest::DistanceTest() { + addTests(&DistanceTest::linePoint, + &DistanceTest::lineSegmentPoint); +} + void DistanceTest::linePoint() { Vector3 a(0.0f); Vector3 b(1.0f); /* Point on the line */ - QCOMPARE((Distance::linePoint(a, b, Vector3(0.25f))), 0.0f); + CORRADE_COMPARE((Distance::linePoint(a, b, Vector3(0.25f))), 0.0f); /* The distance should be the same for all equidistant points */ - QCOMPARE((Distance::linePoint(a, b, Vector3(1.0f, 0.0f, 1.0f))), + CORRADE_COMPARE((Distance::linePoint(a, b, Vector3(1.0f, 0.0f, 1.0f))), Constants::sqrt2()/Constants::sqrt3()); - QCOMPARE((Distance::linePoint(a, b, Vector3(1.0f, 0.0f, 1.0f)+Vector3(100.0f))), + CORRADE_COMPARE((Distance::linePoint(a, b, Vector3(1.0f, 0.0f, 1.0f)+Vector3(100.0f))), Constants::sqrt2()/Constants::sqrt3()); } @@ -48,23 +52,23 @@ void DistanceTest::lineSegmentPoint() { Vector3 b(1.0f); /* Point on the line segment */ - QCOMPARE((Distance::lineSegmentPoint(a, b, Vector3(0.25f))), 0.0f); + CORRADE_COMPARE((Distance::lineSegmentPoint(a, b, Vector3(0.25f))), 0.0f); /* Point on the line, outside the segment, closer to A */ - QCOMPARE((Distance::lineSegmentPoint(a, b, Vector3(-1.0f))), +Constants::sqrt3()); + CORRADE_COMPARE((Distance::lineSegmentPoint(a, b, Vector3(-1.0f))), +Constants::sqrt3()); /* Point on the line, outside the segment, closer to B */ - QCOMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f+1.0f/Constants::sqrt3()))), 1.0f); + CORRADE_COMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f+1.0f/Constants::sqrt3()))), 1.0f); /* Point next to the line segment */ - QCOMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f, 0.0f, 1.0f))), + CORRADE_COMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f, 0.0f, 1.0f))), Constants::sqrt2()/Constants::sqrt3()); /* Point outside the line segment, closer to A */ - QCOMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f, 0.0f, 1.0f)-Vector3(1.0f))), 1.0f); + CORRADE_COMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f, 0.0f, 1.0f)-Vector3(1.0f))), 1.0f); /* Point outside the line segment, closer to B */ - QCOMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f, 0.0f, 1.0f)+Vector3(1.0f))), +Constants::sqrt2()); + CORRADE_COMPARE((Distance::lineSegmentPoint(a, b, Vector3(1.0f, 0.0f, 1.0f)+Vector3(1.0f))), +Constants::sqrt2()); } }}}} diff --git a/src/Math/Geometry/Test/DistanceTest.h b/src/Math/Geometry/Test/DistanceTest.h index 311c4fc90..0cae07036 100644 --- a/src/Math/Geometry/Test/DistanceTest.h +++ b/src/Math/Geometry/Test/DistanceTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Geometry { namespace Test { -class DistanceTest: public QObject { - Q_OBJECT +class DistanceTest: public Corrade::TestSuite::Tester { + public: + DistanceTest(); - private slots: void linePoint(); void lineSegmentPoint(); }; diff --git a/src/Math/Geometry/Test/IntersectionTest.cpp b/src/Math/Geometry/Test/IntersectionTest.cpp index 7809fe95c..5112b5e84 100644 --- a/src/Math/Geometry/Test/IntersectionTest.cpp +++ b/src/Math/Geometry/Test/IntersectionTest.cpp @@ -16,11 +16,10 @@ #include "IntersectionTest.h" #include -#include #include "Intersection.h" -QTEST_APPLESS_MAIN(Magnum::Math::Geometry::Test::IntersectionTest) +CORRADE_TEST_MAIN(Magnum::Math::Geometry::Test::IntersectionTest) using namespace std; @@ -28,26 +27,29 @@ namespace Magnum { namespace Math { namespace Geometry { namespace Test { typedef Magnum::Math::Vector3 Vector3; +IntersectionTest::IntersectionTest() { + addTests(&IntersectionTest::planeLine); +} + void IntersectionTest::planeLine() { Vector3 planePosition(-1.0f, 1.0f, 0.5f); Vector3 planeNormal(0.0f, 0.0f, 1.0f); /* Inside line segment */ - QCOMPARE((Intersection::planeLine(planePosition, planeNormal, + CORRADE_COMPARE((Intersection::planeLine(planePosition, planeNormal, Vector3(0.0f, 0.0f, -1.0f), Vector3(0.0f, 0.0f, 1.0f))), 0.75f); /* Outside line segment */ - QCOMPARE((Intersection::planeLine(planePosition, planeNormal, + CORRADE_COMPARE((Intersection::planeLine(planePosition, planeNormal, Vector3(0.0f, 0.0f, 1.0f), Vector3(0.0f, 0.0f, 2.0f))), -0.5f); /* Line lies on the plane */ - float nan = Intersection::planeLine(planePosition, planeNormal, - Vector3(1.0f, 0.5f, 0.5f), Vector3(0.0f, 1.0f, 0.5f)); - QVERIFY(nan != nan); + CORRADE_COMPARE(Intersection::planeLine(planePosition, planeNormal, + Vector3(1.0f, 0.5f, 0.5f), Vector3(0.0f, 1.0f, 0.5f)), numeric_limits::quiet_NaN()); /* Line is parallell to the plane */ - QCOMPARE((Intersection::planeLine(planePosition, planeNormal, - Vector3(1.0f, 0.0f, 1.0f), Vector3(0.0f, 0.0f, 1.0f))), numeric_limits::infinity()); + CORRADE_COMPARE((Intersection::planeLine(planePosition, planeNormal, + Vector3(1.0f, 0.0f, 1.0f), Vector3(0.0f, 0.0f, 1.0f))), -numeric_limits::infinity()); } }}}} diff --git a/src/Math/Geometry/Test/IntersectionTest.h b/src/Math/Geometry/Test/IntersectionTest.h index 61bbd0359..7187a28c2 100644 --- a/src/Math/Geometry/Test/IntersectionTest.h +++ b/src/Math/Geometry/Test/IntersectionTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Geometry { namespace Test { -class IntersectionTest: public QObject { - Q_OBJECT +class IntersectionTest: public Corrade::TestSuite::Tester { + public: + IntersectionTest(); - private slots: void planeLine(); }; diff --git a/src/Math/Test/CMakeLists.txt b/src/Math/Test/CMakeLists.txt index e51e74fde..9c96b0ccb 100644 --- a/src/Math/Test/CMakeLists.txt +++ b/src/Math/Test/CMakeLists.txt @@ -1,14 +1,12 @@ -corrade_add_test(MathMathTypeTraitsTest MathTypeTraitsTest.h MathTypeTraitsTest.cpp) +corrade_add_test2(MathMathTypeTraitsTest MathTypeTraitsTest.cpp) -corrade_add_test(MathVectorTest VectorTest.h VectorTest.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MathVector2Test Vector2Test.h Vector2Test.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MathVector3Test Vector3Test.h Vector3Test.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MathVector4Test Vector4Test.h Vector4Test.cpp ${CORRADE_UTILITY_LIBRARY}) +corrade_add_test2(MathVectorTest VectorTest.cpp) +corrade_add_test2(MathVector2Test Vector2Test.cpp) +corrade_add_test2(MathVector3Test Vector3Test.cpp) +corrade_add_test2(MathVector4Test Vector4Test.cpp) -corrade_add_test(MathMatrixTest MatrixTest.h MatrixTest.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MathMatrix3Test Matrix3Test.h Matrix3Test.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MathMatrix4Test Matrix4Test.h Matrix4Test.cpp ${CORRADE_UTILITY_LIBRARY}) +corrade_add_test2(MathMatrixTest MatrixTest.cpp) +corrade_add_test2(MathMatrix3Test Matrix3Test.cpp) +corrade_add_test2(MathMatrix4Test Matrix4Test.cpp) -set(MathTest_MOC MathTest.h) -set(MathTest_SRCS MathTest.cpp $) -corrade_add_multifile_test(MathTest MathTest_MOC MathTest_SRCS) +corrade_add_test2(MathTest MathTest.cpp $) diff --git a/src/Math/Test/MathTest.cpp b/src/Math/Test/MathTest.cpp index 4626b0673..46babe120 100644 --- a/src/Math/Test/MathTest.cpp +++ b/src/Math/Test/MathTest.cpp @@ -15,29 +15,33 @@ #include "MathTest.h" -#include - #include "Math.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::MathTest) +CORRADE_TEST_MAIN(Magnum::Math::Test::MathTest) namespace Magnum { namespace Math { namespace Test { +MathTest::MathTest() { + addTests(&MathTest::degrad, + &MathTest::pow, + &MathTest::log); +} + void MathTest::degrad() { - QCOMPARE(deg(90.0), Constants::pi()/2); - QCOMPARE(deg(90.0f), Constants::pi()/2); - QCOMPARE(rad(Constants::pi()/2), Constants::pi()/2); + CORRADE_COMPARE(deg(90.0), Constants::pi()/2); + CORRADE_COMPARE(deg(90.0f), Constants::pi()/2); + CORRADE_COMPARE(rad(Constants::pi()/2), Constants::pi()/2); } void MathTest::pow() { - QCOMPARE(Math::pow<10>(2ul), 1024ul); - QCOMPARE(Math::pow<0>(3ul), 1ul); - QCOMPARE(Math::pow<2>(2.0f), 4.0f); + CORRADE_COMPARE(Math::pow<10>(2ul), 1024ul); + CORRADE_COMPARE(Math::pow<0>(3ul), 1ul); + CORRADE_COMPARE(Math::pow<2>(2.0f), 4.0f); } void MathTest::log() { - QCOMPARE(Math::log(2, 256), 8ul); - QCOMPARE(Math::log(256, 2), 0ul); + CORRADE_COMPARE(Math::log(2, 256), 8ul); + CORRADE_COMPARE(Math::log(256, 2), 0ul); } }}} diff --git a/src/Math/Test/MathTest.h b/src/Math/Test/MathTest.h index 7e0258cc6..548b01e3c 100644 --- a/src/Math/Test/MathTest.h +++ b/src/Math/Test/MathTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class MathTest: public QObject { - Q_OBJECT +class MathTest: public Corrade::TestSuite::Tester { + public: + MathTest(); - private slots: void degrad(); void pow(); void log(); diff --git a/src/Math/Test/MathTypeTraitsTest.cpp b/src/Math/Test/MathTypeTraitsTest.cpp index d2d787f9c..523b32017 100644 --- a/src/Math/Test/MathTypeTraitsTest.cpp +++ b/src/Math/Test/MathTypeTraitsTest.cpp @@ -15,14 +15,19 @@ #include "MathTypeTraitsTest.h" -#include +#include #include "MathTypeTraits.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::MathTypeTraitsTest) +CORRADE_TEST_MAIN(Magnum::Math::Test::MathTypeTraitsTest) namespace Magnum { namespace Math { namespace Test { +MathTypeTraitsTest::MathTypeTraitsTest() { + addTests(&MathTypeTraitsTest::equalsIntegral, + &MathTypeTraitsTest::equalsFloatingPoint); +} + void MathTypeTraitsTest::equalsIntegral() { _equalsIntegral(); _equalsIntegral(); @@ -42,18 +47,21 @@ void MathTypeTraitsTest::equalsFloatingPoint() { } template void MathTypeTraitsTest::_equalsIntegral() { - QVERIFY(!MathTypeTraits::equals(1, 1+MathTypeTraits::epsilon())); + CORRADE_VERIFY(!MathTypeTraits::equals(1, 1+MathTypeTraits::epsilon())); } template void MathTypeTraitsTest::_equalsFloatingPoint() { - QVERIFY(MathTypeTraits::equals(T(1)+MathTypeTraits::epsilon()/T(2), T(1))); - QVERIFY(!MathTypeTraits::equals(T(1)+MathTypeTraits::epsilon()*T(2), T(1))); - - QEXPECT_FAIL(0, "Comparing to infinity is broken", Continue); - QVERIFY(MathTypeTraits::equals(std::numeric_limits::infinity(), - std::numeric_limits::infinity())); - QVERIFY(!MathTypeTraits::equals(std::numeric_limits::quiet_NaN(), - std::numeric_limits::quiet_NaN())); + CORRADE_VERIFY(MathTypeTraits::equals(T(1)+MathTypeTraits::epsilon()/T(2), T(1))); + CORRADE_VERIFY(!MathTypeTraits::equals(T(1)+MathTypeTraits::epsilon()*T(2), T(1))); + + { + CORRADE_EXPECT_FAIL("Comparing to infinity is broken"); + CORRADE_VERIFY(MathTypeTraits::equals(std::numeric_limits::infinity(), + std::numeric_limits::infinity())); + } + + CORRADE_VERIFY(!MathTypeTraits::equals(std::numeric_limits::quiet_NaN(), + std::numeric_limits::quiet_NaN())); } }}} diff --git a/src/Math/Test/MathTypeTraitsTest.h b/src/Math/Test/MathTypeTraitsTest.h index 9ea28afc2..76a4f8882 100644 --- a/src/Math/Test/MathTypeTraitsTest.h +++ b/src/Math/Test/MathTypeTraitsTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class MathTypeTraitsTest: public QObject { - Q_OBJECT +class MathTypeTraitsTest: public Corrade::TestSuite::Tester { + public: + MathTypeTraitsTest(); - private slots: void equalsFloatingPoint(); void equalsIntegral(); diff --git a/src/Math/Test/Matrix3Test.cpp b/src/Math/Test/Matrix3Test.cpp index 32d445d72..dc01cb2f2 100644 --- a/src/Math/Test/Matrix3Test.cpp +++ b/src/Math/Test/Matrix3Test.cpp @@ -16,12 +16,11 @@ #include "Matrix3Test.h" #include -#include #include "Matrix3.h" #include "Math.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::Matrix3Test) +CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix3Test) using namespace std; using namespace Corrade::Utility; @@ -30,6 +29,14 @@ namespace Magnum { namespace Math { namespace Test { typedef Math::Matrix3 Matrix3; +Matrix3Test::Matrix3Test() { + addTests(&Matrix3Test::constructIdentity, + &Matrix3Test::translation, + &Matrix3Test::scaling, + &Matrix3Test::rotation, + &Matrix3Test::debug); +} + void Matrix3Test::constructIdentity() { Matrix3 identity; Matrix3 identity2(Matrix3::Identity); @@ -47,9 +54,9 @@ void Matrix3Test::constructIdentity() { 0.0f, 0.0f, 4.0f ); - QVERIFY(identity == identityExpected); - QVERIFY(identity2 == identityExpected); - QVERIFY(identity3 == identity3Expected); + CORRADE_COMPARE(identity, identityExpected); + CORRADE_COMPARE(identity2, identityExpected); + CORRADE_COMPARE(identity3, identity3Expected); } void Matrix3Test::translation() { @@ -59,7 +66,7 @@ void Matrix3Test::translation() { 3.0f, 1.0f, 1.0f ); - QVERIFY(Matrix3::translation({3.0f, 1.0f}) == matrix); + CORRADE_COMPARE(Matrix3::translation({3.0f, 1.0f}), matrix); } void Matrix3Test::scaling() { @@ -69,7 +76,7 @@ void Matrix3Test::scaling() { 0.0f, 0.0f, 1.0f ); - QVERIFY(Matrix3::scaling({3.0f, 1.5f}) == matrix); + CORRADE_COMPARE(Matrix3::scaling({3.0f, 1.5f}), matrix); } void Matrix3Test::rotation() { @@ -79,7 +86,7 @@ void Matrix3Test::rotation() { 0.0f, 0.0f, 1.0f ); - QVERIFY(Matrix3::rotation(deg(15.0f)) == matrix); + CORRADE_COMPARE(Matrix3::rotation(deg(15.0f)), matrix); } void Matrix3Test::debug() { @@ -91,9 +98,9 @@ void Matrix3Test::debug() { ostringstream o; Debug(&o) << m; - QCOMPARE(QString::fromStdString(o.str()), QString("Matrix(3, 4, 7,\n" - " 5, 4, -1,\n" - " 8, 7, 8)\n")); + CORRADE_COMPARE(o.str(), "Matrix(3, 4, 7,\n" + " 5, 4, -1,\n" + " 8, 7, 8)\n"); } }}} diff --git a/src/Math/Test/Matrix3Test.h b/src/Math/Test/Matrix3Test.h index 60aed65b4..27544cd0e 100644 --- a/src/Math/Test/Matrix3Test.h +++ b/src/Math/Test/Matrix3Test.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class Matrix3Test: public QObject { - Q_OBJECT +class Matrix3Test: public Corrade::TestSuite::Tester { + public: + Matrix3Test(); - private slots: void constructIdentity(); void translation(); diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Math/Test/Matrix4Test.cpp index a93036b31..0d9b813cb 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Math/Test/Matrix4Test.cpp @@ -16,12 +16,11 @@ #include "Matrix4Test.h" #include -#include #include "Matrix4.h" #include "Math.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::Matrix4Test) +CORRADE_TEST_MAIN(Magnum::Math::Test::Matrix4Test) using namespace std; using namespace Corrade::Utility; @@ -31,6 +30,16 @@ namespace Magnum { namespace Math { namespace Test { typedef Math::Matrix4 Matrix4; typedef Math::Matrix3 Matrix3; +Matrix4Test::Matrix4Test() { + addTests(&Matrix4Test::constructIdentity, + &Matrix4Test::translation, + &Matrix4Test::scaling, + &Matrix4Test::rotation, + &Matrix4Test::rotationScalingPart, + &Matrix4Test::rotationPart, + &Matrix4Test::debug); +} + void Matrix4Test::constructIdentity() { Matrix4 identity; Matrix4 identity2(Matrix4::Identity); @@ -50,9 +59,9 @@ void Matrix4Test::constructIdentity() { 0.0f, 0.0f, 0.0f, 4.0f ); - QVERIFY(identity == identityExpected); - QVERIFY(identity2 == identityExpected); - QVERIFY(identity3 == identity3Expected); + CORRADE_COMPARE(identity, identityExpected); + CORRADE_COMPARE(identity2, identityExpected); + CORRADE_COMPARE(identity3, identity3Expected); } void Matrix4Test::translation() { @@ -63,7 +72,7 @@ void Matrix4Test::translation() { 3.0f, 1.0f, 2.0f, 1.0f ); - QVERIFY(Matrix4::translation({3.0f, 1.0f, 2.0f}) == matrix); + CORRADE_COMPARE(Matrix4::translation({3.0f, 1.0f, 2.0f}), matrix); } void Matrix4Test::scaling() { @@ -74,7 +83,7 @@ void Matrix4Test::scaling() { 0.0f, 0.0f, 0.0f, 1.0f ); - QVERIFY(Matrix4::scaling({3.0f, 1.5f, 2.0f}) == matrix); + CORRADE_COMPARE(Matrix4::scaling({3.0f, 1.5f, 2.0f}), matrix); } void Matrix4Test::rotation() { @@ -85,7 +94,7 @@ void Matrix4Test::rotation() { 0.0f, 0.0f, 0.0f, 1.0f ); - QVERIFY(Matrix4::rotation(deg(-74.0f), {-1.0f, 2.0f, 2.0f}) == matrix); + CORRADE_COMPARE(Matrix4::rotation(deg(-74.0f), {-1.0f, 2.0f, 2.0f}), matrix); } void Matrix4Test::rotationScalingPart() { @@ -102,7 +111,7 @@ void Matrix4Test::rotationScalingPart() { 7.0f, -1.0f, 8.0f ); - QVERIFY(m.rotationScaling() == expected); + CORRADE_COMPARE(m.rotationScaling(), expected); } void Matrix4Test::rotationPart() { @@ -113,10 +122,10 @@ void Matrix4Test::rotationPart() { ); Matrix4 rotation = Matrix4::rotation(deg(-74.0f), {-1.0f, 2.0f, 2.0f}); - QVERIFY(rotation.rotation() == expectedRotationPart); + CORRADE_COMPARE(rotation.rotation(), expectedRotationPart); Matrix4 rotationTransformed = Matrix4::translation({2.0f, 5.0f, -3.0f})*rotation*Matrix4::scaling(Vector3(9.0f)); - QVERIFY(rotationTransformed.rotation() == expectedRotationPart); + CORRADE_COMPARE(rotationTransformed.rotation(), expectedRotationPart); } void Matrix4Test::debug() { @@ -129,10 +138,10 @@ void Matrix4Test::debug() { ostringstream o; Debug(&o) << m; - QCOMPARE(QString::fromStdString(o.str()), QString("Matrix(3, 4, 7, 9,\n" - " 5, 4, -1, 4,\n" - " 8, 7, 8, 5,\n" - " 4, 3, 0, 9)\n")); + CORRADE_COMPARE(o.str(), "Matrix(3, 4, 7, 9,\n" + " 5, 4, -1, 4,\n" + " 8, 7, 8, 5,\n" + " 4, 3, 0, 9)\n"); } }}} diff --git a/src/Math/Test/Matrix4Test.h b/src/Math/Test/Matrix4Test.h index 026533dba..5138e3a3a 100644 --- a/src/Math/Test/Matrix4Test.h +++ b/src/Math/Test/Matrix4Test.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class Matrix4Test: public QObject { - Q_OBJECT +class Matrix4Test: public Corrade::TestSuite::Tester { + public: + Matrix4Test(); - private slots: void constructIdentity(); void translation(); diff --git a/src/Math/Test/MatrixTest.cpp b/src/Math/Test/MatrixTest.cpp index a88245f86..8514f8779 100644 --- a/src/Math/Test/MatrixTest.cpp +++ b/src/Math/Test/MatrixTest.cpp @@ -16,11 +16,10 @@ #include "MatrixTest.h" #include -#include #include "Matrix.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::MatrixTest) +CORRADE_TEST_MAIN(Magnum::Math::Test::MatrixTest) using namespace std; using namespace Corrade::Utility; @@ -31,6 +30,23 @@ typedef Matrix<4, float> Matrix4; typedef Matrix<3, float> Matrix3; typedef Vector<4, float> Vector4; +MatrixTest::MatrixTest() { + addTests(&MatrixTest::construct, + &MatrixTest::constructFromVectors, + &MatrixTest::constructIdentity, + &MatrixTest::constructZero, + &MatrixTest::data, + &MatrixTest::copy, + &MatrixTest::multiplyIdentity, + &MatrixTest::multiply, + &MatrixTest::multiplyVector, + &MatrixTest::transposed, + &MatrixTest::ij, + &MatrixTest::determinant, + &MatrixTest::inverted, + &MatrixTest::debug); +} + void MatrixTest::construct() { float m[] = { 3.0f, 5.0f, 8.0f, 4.0f, @@ -46,7 +62,7 @@ void MatrixTest::construct() { 9.0f, 4.0f, 5.0f, 9.0f ); - QVERIFY(Matrix4::from(m) == expected); + CORRADE_COMPARE(Matrix4::from(m), expected); } void MatrixTest::constructFromVectors() { @@ -60,7 +76,7 @@ void MatrixTest::constructFromVectors() { 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f); - QVERIFY(actual == expected); + CORRADE_COMPARE(actual, expected); } void MatrixTest::constructIdentity() { @@ -82,9 +98,9 @@ void MatrixTest::constructIdentity() { 0.0f, 0.0f, 0.0f, 4.0f ); - QVERIFY(identity == identityExpected); - QVERIFY(identity2 == identityExpected); - QVERIFY(identity3 == identity3Expected); + CORRADE_COMPARE(identity, identityExpected); + CORRADE_COMPARE(identity2, identityExpected); + CORRADE_COMPARE(identity3, identity3Expected); } void MatrixTest::constructZero() { @@ -97,7 +113,7 @@ void MatrixTest::constructZero() { 0.0f, 0.0f, 0.0f, 0.0f ); - QVERIFY(zero == zeroExpected); + CORRADE_COMPARE(zero, zeroExpected); } void MatrixTest::data() { @@ -110,8 +126,8 @@ void MatrixTest::data() { m[1][2] = 1.5f; - QCOMPARE(m[2][1], 1.0f); - QVERIFY(m[3] == vector); + CORRADE_COMPARE(m[2][1], 1.0f); + CORRADE_COMPARE(m[3], vector); Matrix4 expected( 0.0f, 0.0f, 0.0f, 0.0f, @@ -120,7 +136,7 @@ void MatrixTest::data() { 4.0f, 5.0f, 6.0f, 7.0f ); - QVERIFY(m == expected); + CORRADE_COMPARE(m, expected); } void MatrixTest::copy() { @@ -141,8 +157,8 @@ void MatrixTest::copy() { Matrix4 original(Matrix4::Zero); original[2][3] = 1.0f; - QVERIFY(m2 == original); - QVERIFY(m3 == original); + CORRADE_COMPARE(m2, original); + CORRADE_COMPARE(m3, original); } void MatrixTest::multiplyIdentity() { @@ -153,8 +169,8 @@ void MatrixTest::multiplyIdentity() { 12.0f, 13.0f, 14.0f, 15.0f ); - QVERIFY(Matrix4()*values == values); - QVERIFY(values*Matrix4() == values); + CORRADE_COMPARE(Matrix4()*values, values); + CORRADE_COMPARE(values*Matrix4(), values); } void MatrixTest::multiply() { @@ -182,7 +198,7 @@ void MatrixTest::multiply() { -12, 8, -20, -26, -2 ); - QVERIFY((left *= right) == expected); + CORRADE_COMPARE((left *= right), expected); } void MatrixTest::multiplyVector() { @@ -194,9 +210,7 @@ void MatrixTest::multiplyVector() { 1, 3, -3, -4, -1 ); - bool is = (matrix*Vector<5, int>(0, 5, 3, 4, 4) == Vector<5, int>(-24, -35, -32, -25, 1)); - - QVERIFY(is); + CORRADE_COMPARE((matrix*Vector<5, int>(0, 5, 3, 4, 4)), (Vector<5, int>(-24, -35, -32, -25, 1))); } void MatrixTest::transposed() { @@ -214,7 +228,7 @@ void MatrixTest::transposed() { 3.0f, 7.0f, 11.0f, 15.0f ); - QVERIFY(original.transposed() == transposed); + CORRADE_COMPARE(original.transposed(), transposed); } void MatrixTest::ij() { @@ -231,7 +245,7 @@ void MatrixTest::ij() { 12.0f, 13.0f, 15.0f ); - QVERIFY(original.ij(1, 2) == skipped); + CORRADE_COMPARE(original.ij(1, 2), skipped); } void MatrixTest::determinant() { @@ -243,7 +257,7 @@ void MatrixTest::determinant() { 3, 1, 0, 1, -2 ); - QVERIFY(m.determinant() == -2); + CORRADE_COMPARE(m.determinant(), -2); } void MatrixTest::inverted() { @@ -263,8 +277,8 @@ void MatrixTest::inverted() { Matrix4 _inverse = m.inverted(); - QVERIFY(_inverse == inverse); - QVERIFY(_inverse*m == Matrix4()); + CORRADE_COMPARE(_inverse, inverse); + CORRADE_COMPARE(_inverse*m, Matrix4()); } void MatrixTest::debug() { @@ -277,20 +291,20 @@ void MatrixTest::debug() { ostringstream o; Debug(&o) << m; - QCOMPARE(QString::fromStdString(o.str()), QString("Matrix(3, 4, 7, 9,\n" - " 5, 4, -1, 4,\n" - " 8, 7, 8, 5,\n" - " 4, 3, 0, 9)\n")); + CORRADE_COMPARE(o.str(), "Matrix(3, 4, 7, 9,\n" + " 5, 4, -1, 4,\n" + " 8, 7, 8, 5,\n" + " 4, 3, 0, 9)\n"); o.str(""); Debug(&o) << "a" << Matrix4() << "b" << Matrix4(); - QCOMPARE(QString::fromStdString(o.str()), QString("a Matrix(1, 0, 0, 0,\n" - " 0, 1, 0, 0,\n" - " 0, 0, 1, 0,\n" - " 0, 0, 0, 1) b Matrix(1, 0, 0, 0,\n" - " 0, 1, 0, 0,\n" - " 0, 0, 1, 0,\n" - " 0, 0, 0, 1)\n")); + CORRADE_COMPARE(o.str(), "a Matrix(1, 0, 0, 0,\n" + " 0, 1, 0, 0,\n" + " 0, 0, 1, 0,\n" + " 0, 0, 0, 1) b Matrix(1, 0, 0, 0,\n" + " 0, 1, 0, 0,\n" + " 0, 0, 1, 0,\n" + " 0, 0, 0, 1)\n"); } }}} diff --git a/src/Math/Test/MatrixTest.h b/src/Math/Test/MatrixTest.h index 325df2e94..704c95ff3 100644 --- a/src/Math/Test/MatrixTest.h +++ b/src/Math/Test/MatrixTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class MatrixTest: public QObject { - Q_OBJECT +class MatrixTest: public Corrade::TestSuite::Tester { + public: + MatrixTest(); - private slots: void construct(); void constructFromVectors(); void constructIdentity(); diff --git a/src/Math/Test/Vector2Test.cpp b/src/Math/Test/Vector2Test.cpp index 7f7692e60..636f19c72 100644 --- a/src/Math/Test/Vector2Test.cpp +++ b/src/Math/Test/Vector2Test.cpp @@ -16,11 +16,10 @@ #include "Vector2Test.h" #include -#include #include "Vector2.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::Vector2Test) +CORRADE_TEST_MAIN(Magnum::Math::Test::Vector2Test) using namespace std; using namespace Corrade::Utility; @@ -29,14 +28,19 @@ namespace Magnum { namespace Math { namespace Test { typedef Math::Vector2 Vector2; +Vector2Test::Vector2Test() { + addTests(&Vector2Test::construct, + &Vector2Test::debug); +} + void Vector2Test::construct() { - QVERIFY((Vector2(1, 2) == Vector<2, float>(1.0f, 2.0f))); + CORRADE_COMPARE(Vector2(1, 2), (Vector<2, float>(1.0f, 2.0f))); } void Vector2Test::debug() { ostringstream o; Debug(&o) << Vector2(0.5f, 15.0f); - QCOMPARE(QString::fromStdString(o.str()), QString("Vector(0.5, 15)\n")); + CORRADE_COMPARE(o.str(), "Vector(0.5, 15)\n"); } }}} diff --git a/src/Math/Test/Vector2Test.h b/src/Math/Test/Vector2Test.h index 7d67c7571..39515fbf9 100644 --- a/src/Math/Test/Vector2Test.h +++ b/src/Math/Test/Vector2Test.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class Vector2Test: public QObject { - Q_OBJECT +class Vector2Test: public Corrade::TestSuite::Tester { + public: + Vector2Test(); - private slots: void construct(); void debug(); }; diff --git a/src/Math/Test/Vector3Test.cpp b/src/Math/Test/Vector3Test.cpp index 05218b0d6..6df8a84e7 100644 --- a/src/Math/Test/Vector3Test.cpp +++ b/src/Math/Test/Vector3Test.cpp @@ -16,11 +16,10 @@ #include "Vector3Test.h" #include -#include #include "Vector3.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::Vector3Test) +CORRADE_TEST_MAIN(Magnum::Math::Test::Vector3Test) using namespace std; using namespace Corrade::Utility; @@ -30,32 +29,40 @@ namespace Magnum { namespace Math { namespace Test { typedef Math::Vector3 Vector3; typedef Math::Vector2 Vector2; +Vector3Test::Vector3Test() { + addTests(&Vector3Test::construct, + &Vector3Test::cross, + &Vector3Test::axis, + &Vector3Test::twoComponent, + &Vector3Test::debug); +} + void Vector3Test::construct() { - QVERIFY((Vector3(1, 2, 3) == Vector<3, float>(1.0f, 2.0f, 3.0f))); - QVERIFY((Vector3(Vector<2, float>(1.0f, 2.0f), 3) == Vector<3, float>(1.0f, 2.0f, 3.0f))); + CORRADE_COMPARE(Vector3(1, 2, 3), (Vector<3, float>(1.0f, 2.0f, 3.0f))); + CORRADE_COMPARE(Vector3(Vector<2, float>(1.0f, 2.0f), 3), (Vector<3, float>(1.0f, 2.0f, 3.0f))); } void Vector3Test::cross() { Vector3 a(1, -1, 1); Vector3 b(4, 3, 7); - QVERIFY(Vector3::cross(a, b) == Vector3(-10, -3, 7)); + CORRADE_COMPARE(Vector3::cross(a, b), Vector3(-10, -3, 7)); } void Vector3Test::axis() { - QVERIFY(Vector3::xAxis(5.0f) == Vector3(5.0f, 0.0f, 0.0f)); - QVERIFY(Vector3::yAxis(6.0f) == Vector3(0.0f, 6.0f, 0.0f)); - QVERIFY(Vector3::zAxis(7.0f) == Vector3(0.0f, 0.0f, 7.0f)); + CORRADE_COMPARE(Vector3::xAxis(5.0f), Vector3(5.0f, 0.0f, 0.0f)); + CORRADE_COMPARE(Vector3::yAxis(6.0f), Vector3(0.0f, 6.0f, 0.0f)); + CORRADE_COMPARE(Vector3::zAxis(7.0f), Vector3(0.0f, 0.0f, 7.0f)); } void Vector3Test::twoComponent() { - QVERIFY(Vector3(1.0f, 2.0f, 3.0f).xy() == Vector2(1.0f, 2.0f)); + CORRADE_COMPARE(Vector3(1.0f, 2.0f, 3.0f).xy(), Vector2(1.0f, 2.0f)); } void Vector3Test::debug() { ostringstream o; Debug(&o) << Vector3(0.5f, 15.0f, 1.0f); - QCOMPARE(QString::fromStdString(o.str()), QString("Vector(0.5, 15, 1)\n")); + CORRADE_COMPARE(o.str(), "Vector(0.5, 15, 1)\n"); } }}} diff --git a/src/Math/Test/Vector3Test.h b/src/Math/Test/Vector3Test.h index d3d77f737..73de924e9 100644 --- a/src/Math/Test/Vector3Test.h +++ b/src/Math/Test/Vector3Test.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class Vector3Test: public QObject { - Q_OBJECT +class Vector3Test: public Corrade::TestSuite::Tester { + public: + Vector3Test(); - private slots: void construct(); void cross(); void axis(); diff --git a/src/Math/Test/Vector4Test.cpp b/src/Math/Test/Vector4Test.cpp index dfcdc16b9..57a0b9b7d 100644 --- a/src/Math/Test/Vector4Test.cpp +++ b/src/Math/Test/Vector4Test.cpp @@ -16,11 +16,10 @@ #include "Vector4Test.h" #include -#include #include "Vector4.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::Vector4Test) +CORRADE_TEST_MAIN(Magnum::Math::Test::Vector4Test) using namespace std; using namespace Corrade::Utility; @@ -31,24 +30,31 @@ typedef Math::Vector4 Vector4; typedef Math::Vector3 Vector3; typedef Math::Vector2 Vector2; +Vector4Test::Vector4Test() { + addTests(&Vector4Test::construct, + &Vector4Test::threeComponent, + &Vector4Test::twoComponent, + &Vector4Test::debug); +} + void Vector4Test::construct() { - QVERIFY(Vector4() == Vector4(0.0f, 0.0f, 0.0f, 1.0f)); - QVERIFY((Vector4(1, 2, 3, 4) == Vector<4, float>(1.0f, 2.0f, 3.0f, 4.0f))); - QVERIFY((Vector4(Vector<3, float>(1.0f, 2.0f, 3.0f), 4) == Vector<4, float>(1.0f, 2.0f, 3.0f, 4.0f))); + CORRADE_COMPARE(Vector4(), Vector4(0.0f, 0.0f, 0.0f, 1.0f)); + CORRADE_COMPARE(Vector4(1, 2, 3, 4), (Vector<4, float>(1.0f, 2.0f, 3.0f, 4.0f))); + CORRADE_COMPARE(Vector4(Vector<3, float>(1.0f, 2.0f, 3.0f), 4), (Vector<4, float>(1.0f, 2.0f, 3.0f, 4.0f))); } void Vector4Test::threeComponent() { - QVERIFY(Vector4(1.0f, 2.0f, 3.0f, 4.0f).xyz() == Vector3(1.0f, 2.0f, 3.0f)); + CORRADE_COMPARE(Vector4(1.0f, 2.0f, 3.0f, 4.0f).xyz(), Vector3(1.0f, 2.0f, 3.0f)); } void Vector4Test::twoComponent() { - QVERIFY(Vector4(1.0f, 2.0f, 3.0f, 4.0f).xy() == Vector2(1.0f, 2.0f)); + CORRADE_COMPARE(Vector4(1.0f, 2.0f, 3.0f, 4.0f).xy(), Vector2(1.0f, 2.0f)); } void Vector4Test::debug() { ostringstream o; Debug(&o) << Vector4(0.5f, 15.0f, 1.0f, 1.0f); - QCOMPARE(QString::fromStdString(o.str()), QString("Vector(0.5, 15, 1, 1)\n")); + CORRADE_COMPARE(o.str(), "Vector(0.5, 15, 1, 1)\n"); } }}} diff --git a/src/Math/Test/Vector4Test.h b/src/Math/Test/Vector4Test.h index 95247509e..d31df492a 100644 --- a/src/Math/Test/Vector4Test.h +++ b/src/Math/Test/Vector4Test.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class Vector4Test: public QObject { - Q_OBJECT +class Vector4Test: public Corrade::TestSuite::Tester { + public: + Vector4Test(); - private slots: void construct(); void threeComponent(); void twoComponent(); diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index 3bebbd863..965a4c871 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -16,12 +16,11 @@ #include "VectorTest.h" #include -#include #include "Vector.h" #include "Math.h" -QTEST_APPLESS_MAIN(Magnum::Math::Test::VectorTest) +CORRADE_TEST_MAIN(Magnum::Math::Test::VectorTest) using namespace std; using namespace Corrade::Utility; @@ -31,11 +30,27 @@ namespace Magnum { namespace Math { namespace Test { typedef Vector<4, float> Vector4; typedef Vector<3, float> Vector3; +VectorTest::VectorTest() { + addTests(&VectorTest::construct, + &VectorTest::data, + &VectorTest::copy, + &VectorTest::dot, + &VectorTest::multiplyDivide, + &VectorTest::addSubstract, + &VectorTest::length, + &VectorTest::lengthSquared, + &VectorTest::normalized, + &VectorTest::product, + &VectorTest::angle, + &VectorTest::negative, + &VectorTest::debug); +} + void VectorTest::construct() { - QVERIFY((Vector4() == Vector4(0.0f, 0.0f, 0.0f, 0.0f))); + CORRADE_COMPARE(Vector4(), Vector4(0.0f, 0.0f, 0.0f, 0.0f)); float data[] = { 1.0f, 2.0f, 3.0f, 4.0f }; - QVERIFY((Vector4::from(data) == Vector4(1.0f, 2.0f, 3.0f, 4.0f))); + CORRADE_COMPARE(Vector4::from(data), Vector4(1.0f, 2.0f, 3.0f, 4.0f)); } void VectorTest::data() { @@ -44,7 +59,7 @@ void VectorTest::data() { v[0] = 1.0f; - QVERIFY(v == Vector4(1.0f, 0.0f, 1.5f, 0.0f)); + CORRADE_COMPARE(v, Vector4(1.0f, 0.0f, 1.5f, 0.0f)); } void VectorTest::copy() { @@ -64,25 +79,25 @@ void VectorTest::copy() { Vector4 original; original[3] = 1.0f; - QVERIFY(v2 == original); - QVERIFY(v3 == original); + CORRADE_COMPARE(v2, original); + CORRADE_COMPARE(v3, original); } void VectorTest::dot() { - QCOMPARE(Vector4::dot({1.0f, 0.5f, 0.75f, 1.5f}, {2.0f, 4.0f, 1.0f, 7.0f}), 15.25f); + CORRADE_COMPARE(Vector4::dot({1.0f, 0.5f, 0.75f, 1.5f}, {2.0f, 4.0f, 1.0f, 7.0f}), 15.25f); } void VectorTest::multiplyDivide() { Vector4 vec(1.0f, 2.0f, 3.0f, 4.0f); Vector4 multiplied(-1.5f, -3.0f, -4.5f, -6.0f); - QVERIFY(vec*-1.5f == multiplied); - QVERIFY(multiplied/-1.5f == vec); + CORRADE_COMPARE(vec*-1.5f, multiplied); + CORRADE_COMPARE(multiplied/-1.5f, vec); Math::Vector<1, char> vecChar(32); Math::Vector<1, char> multipliedChar(-48); - QVERIFY(vecChar*-1.5f == multipliedChar); - QVERIFY(multipliedChar/-1.5f == vecChar); + CORRADE_COMPARE(vecChar*-1.5f, multipliedChar); + CORRADE_COMPARE(multipliedChar/-1.5f, vecChar); } void VectorTest::addSubstract() { @@ -90,42 +105,42 @@ void VectorTest::addSubstract() { Vector4 b(-0.5, 1.0f, 0.0f, 7.5f); Vector4 expected(0.0f, -6.5f, 9.0f, -3.5f); - QVERIFY(a + b == expected); - QVERIFY(expected - b == a); + CORRADE_COMPARE(a + b, expected); + CORRADE_COMPARE(expected - b, a); } void VectorTest::length() { - QCOMPARE(Vector4(1.0f, 2.0f, 3.0f, 4.0f).length(), 5.4772256f); + CORRADE_COMPARE(Vector4(1.0f, 2.0f, 3.0f, 4.0f).length(), 5.4772256f); } void VectorTest::lengthSquared() { - QCOMPARE(Vector4(1.0f, 2.0f, 3.0f, 4.0f).lengthSquared(), 30.0f); + CORRADE_COMPARE(Vector4(1.0f, 2.0f, 3.0f, 4.0f).lengthSquared(), 30.0f); } void VectorTest::normalized() { - QVERIFY(Vector4(1.0f, 1.0f, 1.0f, 1.0f).normalized() == Vector4(0.5f, 0.5f, 0.5f, 0.5f)); + CORRADE_COMPARE(Vector4(1.0f, 1.0f, 1.0f, 1.0f).normalized(), Vector4(0.5f, 0.5f, 0.5f, 0.5f)); } void VectorTest::product() { - QCOMPARE(Vector3(1.0f, 2.0f, 3.0f).product(), 6.0f); + CORRADE_COMPARE(Vector3(1.0f, 2.0f, 3.0f).product(), 6.0f); } void VectorTest::angle() { - QCOMPARE(Vector3::angle({2.0f, 3.0f, 4.0f}, {1.0f, -2.0f, 3.0f}), rad(1.16251f)); + CORRADE_COMPARE(Vector3::angle({2.0f, 3.0f, 4.0f}, {1.0f, -2.0f, 3.0f}), rad(1.162514f)); } void VectorTest::negative() { - QVERIFY(-Vector4(1.0f, -3.0f, 5.0f, -10.0f) == Vector4(-1.0f, 3.0f, -5.0f, 10.0f)); + CORRADE_COMPARE(-Vector4(1.0f, -3.0f, 5.0f, -10.0f), Vector4(-1.0f, 3.0f, -5.0f, 10.0f)); } void VectorTest::debug() { ostringstream o; Debug(&o) << Vector4(0.5f, 15.0f, 1.0f, 1.0f); - QCOMPARE(QString::fromStdString(o.str()), QString("Vector(0.5, 15, 1, 1)\n")); + CORRADE_COMPARE(o.str(), "Vector(0.5, 15, 1, 1)\n"); o.str(""); Debug(&o) << "a" << Vector4() << "b" << Vector4(); - QCOMPARE(QString::fromStdString(o.str()), QString("a Vector(0, 0, 0, 0) b Vector(0, 0, 0, 0)\n")); + CORRADE_COMPARE(o.str(), "a Vector(0, 0, 0, 0) b Vector(0, 0, 0, 0)\n"); } }}} diff --git a/src/Math/Test/VectorTest.h b/src/Math/Test/VectorTest.h index 143ea01a3..c9b475e1c 100644 --- a/src/Math/Test/VectorTest.h +++ b/src/Math/Test/VectorTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Math { namespace Test { -class VectorTest: public QObject { - Q_OBJECT +class VectorTest: public Corrade::TestSuite::Tester { + public: + VectorTest(); - private slots: void construct(); void data(); void copy(); diff --git a/src/MeshTools/Test/CMakeLists.txt b/src/MeshTools/Test/CMakeLists.txt index c5ddcd913..830207055 100644 --- a/src/MeshTools/Test/CMakeLists.txt +++ b/src/MeshTools/Test/CMakeLists.txt @@ -1,12 +1,12 @@ -corrade_add_test(MeshToolsCleanTest CleanTest.h CleanTest.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MeshToolsCombineIndexedArraysTest CombineIndexedArraysTest.h CombineIndexedArraysTest.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MeshToolsCompressIndicesTest CompressIndicesTest.h CompressIndicesTest.cpp Magnum) -corrade_add_test(MeshToolsFlipNormalsTest FlipNormalsTest.h FlipNormalsTest.cpp MagnumMeshToolsTestLib) -corrade_add_test(MeshToolsGenerateFlatNormalsTest GenerateFlatNormalsTest.h GenerateFlatNormalsTest.cpp MagnumMeshToolsTestLib) -corrade_add_test(MeshToolsInterleaveTest InterleaveTest.h InterleaveTest.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MeshToolsSubdivideTest SubdivideTest.h SubdivideTest.cpp ${CORRADE_UTILITY_LIBRARY}) -corrade_add_test(MeshToolsSubdivideCleanBenchmark SubdivideCleanBenchmark.h SubdivideCleanBenchmark.cpp MagnumPrimitives) -corrade_add_test(MeshToolsTipsifyTest TipsifyTest.h TipsifyTest.cpp MagnumMeshTools) +corrade_add_test2(MeshToolsCleanTest CleanTest.cpp) +corrade_add_test2(MeshToolsCombineIndexedArraysTest CombineIndexedArraysTest.cpp) +corrade_add_test2(MeshToolsCompressIndicesTest CompressIndicesTest.cpp LIBRARIES Magnum) +corrade_add_test2(MeshToolsFlipNormalsTest FlipNormalsTest.cpp LIBRARIES MagnumMeshToolsTestLib) +corrade_add_test2(MeshToolsGenerateFlatNormalsTest GenerateFlatNormalsTest.cpp LIBRARIES MagnumMeshToolsTestLib) +corrade_add_test2(MeshToolsInterleaveTest InterleaveTest.cpp) +corrade_add_test2(MeshToolsSubdivideTest SubdivideTest.cpp) +# corrade_add_test(MeshToolsSubdivideCleanBenchmark SubdivideCleanBenchmark.h SubdivideCleanBenchmark.cpp MagnumPrimitives) +corrade_add_test2(MeshToolsTipsifyTest TipsifyTest.cpp LIBRARIES MagnumMeshTools) # Graceful assert for testing set_target_properties(MeshToolsCombineIndexedArraysTest MeshToolsInterleaveTest MeshToolsSubdivideTest PROPERTIES COMPILE_FLAGS -DCORRADE_GRACEFUL_ASSERT) diff --git a/src/MeshTools/Test/CleanTest.cpp b/src/MeshTools/Test/CleanTest.cpp index 69c086238..e8978e3c9 100644 --- a/src/MeshTools/Test/CleanTest.cpp +++ b/src/MeshTools/Test/CleanTest.cpp @@ -15,24 +15,26 @@ #include "CleanTest.h" -#include - #include "MeshTools/Clean.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::CleanTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::CleanTest) using namespace std; namespace Magnum { namespace MeshTools { namespace Test { +CleanTest::CleanTest() { + addTests(&CleanTest::cleanMesh); +} + void CleanTest::cleanMesh() { vector vertices{1, 2, 1, 4}; vector indices{0, 1, 2, 1, 2, 3}; MeshTools::clean(indices, vertices); /* Verify cleanup */ - QVERIFY((vertices == vector{1, 2, 4})); - QVERIFY((indices == vector{0, 1, 0, 1, 0, 2})); + CORRADE_VERIFY(vertices == (vector{1, 2, 4})); + CORRADE_COMPARE(indices, (vector{0, 1, 0, 1, 0, 2})); } }}} diff --git a/src/MeshTools/Test/CleanTest.h b/src/MeshTools/Test/CleanTest.h index 98362d2e5..f24e4730e 100644 --- a/src/MeshTools/Test/CleanTest.h +++ b/src/MeshTools/Test/CleanTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class CleanTest: public QObject { - Q_OBJECT +class CleanTest: public Corrade::TestSuite::Tester { + public: + CleanTest(); - private slots: void cleanMesh(); private: diff --git a/src/MeshTools/Test/CombineIndexedArraysTest.cpp b/src/MeshTools/Test/CombineIndexedArraysTest.cpp index ce8ee2134..9cbdcc542 100644 --- a/src/MeshTools/Test/CombineIndexedArraysTest.cpp +++ b/src/MeshTools/Test/CombineIndexedArraysTest.cpp @@ -16,16 +16,20 @@ #include "CombineIndexedArraysTest.h" #include -#include #include "MeshTools/CombineIndexedArrays.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::CombineIndexedArraysTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::CombineIndexedArraysTest) using namespace std; namespace Magnum { namespace MeshTools { namespace Test { +CombineIndexedArraysTest::CombineIndexedArraysTest() { + addTests(&CombineIndexedArraysTest::wrongIndexCount, + &CombineIndexedArraysTest::combine); +} + void CombineIndexedArraysTest::wrongIndexCount() { stringstream ss; Error::setOutput(&ss); @@ -34,8 +38,8 @@ void CombineIndexedArraysTest::wrongIndexCount() { tuple&, vector&>(vector{0, 1, 0}, array), tuple&, vector&>(vector{3, 4}, array)); - QVERIFY(result.size() == 0); - QVERIFY(ss.str() == "MeshTools::combineIndexedArrays(): index arrays don't have the same length, nothing done.\n"); + CORRADE_COMPARE(result.size(), 0); + CORRADE_COMPARE(ss.str(), "MeshTools::combineIndexedArrays(): index arrays don't have the same length, nothing done.\n"); } void CombineIndexedArraysTest::combine() { @@ -48,11 +52,10 @@ void CombineIndexedArraysTest::combine() { tuple&, vector&>(vector{3, 4, 3}, array2), tuple&, vector&>(vector{6, 7, 6}, array3)); - QVERIFY((result == vector{0, 1, 0})); - QVERIFY((array1 == vector{0, 1})); - QVERIFY((array2 == vector{3, 4})); - QVERIFY((array3 == vector{6, 7})); + CORRADE_COMPARE(result, (vector{0, 1, 0})); + CORRADE_COMPARE(array1, (vector{0, 1})); + CORRADE_COMPARE(array2, (vector{3, 4})); + CORRADE_COMPARE(array3, (vector{6, 7})); } - }}} diff --git a/src/MeshTools/Test/CombineIndexedArraysTest.h b/src/MeshTools/Test/CombineIndexedArraysTest.h index cb210290c..df90f02f8 100644 --- a/src/MeshTools/Test/CombineIndexedArraysTest.h +++ b/src/MeshTools/Test/CombineIndexedArraysTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class CombineIndexedArraysTest: public QObject { - Q_OBJECT +class CombineIndexedArraysTest: public Corrade::TestSuite::Tester { + public: + CombineIndexedArraysTest(); - private slots: void wrongIndexCount(); void combine(); }; diff --git a/src/MeshTools/Test/CompressIndicesTest.cpp b/src/MeshTools/Test/CompressIndicesTest.cpp index 23faac289..905918f1c 100644 --- a/src/MeshTools/Test/CompressIndicesTest.cpp +++ b/src/MeshTools/Test/CompressIndicesTest.cpp @@ -15,18 +15,23 @@ #include "CompressIndicesTest.h" -#include #include #include "MeshTools/CompressIndices.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::CompressIndicesTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::CompressIndicesTest) using namespace std; using Corrade::Utility::Endianness; namespace Magnum { namespace MeshTools { namespace Test { +CompressIndicesTest::CompressIndicesTest() { + addTests(&CompressIndicesTest::compressChar, + &CompressIndicesTest::compressShort, + &CompressIndicesTest::compressInt); +} + void CompressIndicesTest::compressChar() { size_t indexCount; Type indexType; @@ -34,10 +39,10 @@ void CompressIndicesTest::compressChar() { tie(indexCount, indexType, data) = MeshTools::compressIndices( vector{1, 2, 3, 0, 4}); - QVERIFY(indexCount == 5); - QVERIFY(indexType == Type::UnsignedByte); - QVERIFY((vector(data, data+indexCount*TypeInfo::sizeOf(indexType)) == - vector{ 0x01, 0x02, 0x03, 0x00, 0x04 })); + CORRADE_COMPARE(indexCount, 5); + CORRADE_VERIFY(indexType == Type::UnsignedByte); + CORRADE_COMPARE(vector(data, data+indexCount*TypeInfo::sizeOf(indexType)), + (vector{ 0x01, 0x02, 0x03, 0x00, 0x04 })); delete[] data; } @@ -49,20 +54,20 @@ void CompressIndicesTest::compressShort() { tie(indexCount, indexType, data) = MeshTools::compressIndices( vector{1, 256, 0, 5}); - QVERIFY(indexCount == 4); - QVERIFY(indexType == Type::UnsignedShort); + CORRADE_COMPARE(indexCount, 4); + CORRADE_VERIFY(indexType == Type::UnsignedShort); if(!Endianness::isBigEndian()) { - QVERIFY((vector(data, data+indexCount*TypeInfo::sizeOf(indexType)) == - vector{ 0x01, 0x00, - 0x00, 0x01, - 0x00, 0x00, - 0x05, 0x00 })); + CORRADE_COMPARE(vector(data, data+indexCount*TypeInfo::sizeOf(indexType)), + (vector{ 0x01, 0x00, + 0x00, 0x01, + 0x00, 0x00, + 0x05, 0x00 })); } else { - QVERIFY((vector(data, data+indexCount*TypeInfo::sizeOf(indexType)) == - vector{ 0x00, 0x01, - 0x01, 0x00, - 0x00, 0x00, - 0x00, 0x05 })); + CORRADE_COMPARE(vector(data, data+indexCount*TypeInfo::sizeOf(indexType)), + (vector{ 0x00, 0x01, + 0x01, 0x00, + 0x00, 0x00, + 0x00, 0x05 })); } delete[] data; @@ -75,21 +80,19 @@ void CompressIndicesTest::compressInt() { tie(indexCount, indexType, data) = MeshTools::compressIndices( vector{65536, 3, 2}); - QVERIFY(indexCount == 3); - QVERIFY(indexType == Type::UnsignedInt); + CORRADE_COMPARE(indexCount, 3); + CORRADE_VERIFY(indexType == Type::UnsignedInt); if(!Endianness::isBigEndian()) { - QVERIFY((vector(data, data+indexCount*TypeInfo::sizeOf(indexType)) == - vector{ 0x00, 0x00, 0x01, 0x00, - 0x03, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00 - })); + CORRADE_COMPARE(vector(data, data+indexCount*TypeInfo::sizeOf(indexType)), + (vector{ 0x00, 0x00, 0x01, 0x00, + 0x03, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00 })); } else { - QVERIFY((vector(data, data+indexCount*TypeInfo::sizeOf(indexType)) == - vector{ 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x02 - })); + CORRADE_COMPARE(vector(data, data+indexCount*TypeInfo::sizeOf(indexType)), + (vector{ 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x02 })); } delete[] data; diff --git a/src/MeshTools/Test/CompressIndicesTest.h b/src/MeshTools/Test/CompressIndicesTest.h index 614748eac..fcbcc85dd 100644 --- a/src/MeshTools/Test/CompressIndicesTest.h +++ b/src/MeshTools/Test/CompressIndicesTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class CompressIndicesTest: public QObject { - Q_OBJECT +class CompressIndicesTest: public Corrade::TestSuite::Tester { + public: + CompressIndicesTest(); - private slots: void compressChar(); void compressShort(); void compressInt(); diff --git a/src/MeshTools/Test/FlipNormalsTest.cpp b/src/MeshTools/Test/FlipNormalsTest.cpp index dd6ec77ae..ec97f1da5 100644 --- a/src/MeshTools/Test/FlipNormalsTest.cpp +++ b/src/MeshTools/Test/FlipNormalsTest.cpp @@ -16,15 +16,21 @@ #include "FlipNormalsTest.h" #include -#include + #include "MeshTools/FlipNormals.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::FlipNormalsTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::FlipNormalsTest) using namespace std; namespace Magnum { namespace MeshTools { namespace Test { +FlipNormalsTest::FlipNormalsTest() { + addTests(&FlipNormalsTest::wrongIndexCount, + &FlipNormalsTest::flipFaceWinding, + &FlipNormalsTest::flipNormals); +} + void FlipNormalsTest::wrongIndexCount() { stringstream ss; Error::setOutput(&ss); @@ -32,7 +38,7 @@ void FlipNormalsTest::wrongIndexCount() { vector indices{0, 1}; MeshTools::flipFaceWinding(indices); - QVERIFY(ss.str() == "MeshTools::flipNormals(): index count is not divisible by 3!\n"); + CORRADE_COMPARE(ss.str(), "MeshTools::flipNormals(): index count is not divisible by 3!\n"); } void FlipNormalsTest::flipFaceWinding() { @@ -40,8 +46,8 @@ void FlipNormalsTest::flipFaceWinding() { 3, 4, 5}; MeshTools::flipFaceWinding(indices); - QVERIFY((indices == vector{0, 2, 1, - 3, 5, 4})); + CORRADE_COMPARE(indices, (vector{0, 2, 1, + 3, 5, 4})); } void FlipNormalsTest::flipNormals() { @@ -50,9 +56,9 @@ void FlipNormalsTest::flipNormals() { Vector3::zAxis()}; MeshTools::flipNormals(normals); - QVERIFY((normals == vector{-Vector3::xAxis(), - -Vector3::yAxis(), - -Vector3::zAxis()})); + CORRADE_COMPARE(normals, (vector{-Vector3::xAxis(), + -Vector3::yAxis(), + -Vector3::zAxis()})); } }}} diff --git a/src/MeshTools/Test/FlipNormalsTest.h b/src/MeshTools/Test/FlipNormalsTest.h index 382c89f74..f6f0422cd 100644 --- a/src/MeshTools/Test/FlipNormalsTest.h +++ b/src/MeshTools/Test/FlipNormalsTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class FlipNormalsTest: public QObject { - Q_OBJECT +class FlipNormalsTest: public Corrade::TestSuite::Tester { + public: + FlipNormalsTest(); - private slots: void wrongIndexCount(); void flipFaceWinding(); void flipNormals(); diff --git a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp b/src/MeshTools/Test/GenerateFlatNormalsTest.cpp index 4fee48d40..8b4cec77f 100644 --- a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp +++ b/src/MeshTools/Test/GenerateFlatNormalsTest.cpp @@ -16,15 +16,20 @@ #include "GenerateFlatNormalsTest.h" #include -#include + #include "MeshTools/GenerateFlatNormals.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::GenerateFlatNormalsTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::GenerateFlatNormalsTest) using namespace std; namespace Magnum { namespace MeshTools { namespace Test { +GenerateFlatNormalsTest::GenerateFlatNormalsTest() { + addTests(&GenerateFlatNormalsTest::wrongIndexCount, + &GenerateFlatNormalsTest::generate); +} + void GenerateFlatNormalsTest::wrongIndexCount() { stringstream ss; Error::setOutput(&ss); @@ -34,9 +39,9 @@ void GenerateFlatNormalsTest::wrongIndexCount() { 0, 1 }, {}); - QVERIFY(indices.size() == 0); - QVERIFY(normals.size() == 0); - QVERIFY(ss.str() == "MeshTools::generateFlatNormals(): index count is not divisible by 3!\n"); + CORRADE_COMPARE(indices.size(), 0); + CORRADE_COMPARE(normals.size(), 0); + CORRADE_COMPARE(ss.str(), "MeshTools::generateFlatNormals(): index count is not divisible by 3!\n"); } void GenerateFlatNormalsTest::generate() { @@ -54,11 +59,11 @@ void GenerateFlatNormalsTest::generate() { }); - QVERIFY((indices == vector{ + CORRADE_COMPARE(indices, (vector{ 0, 0, 0, 1, 1, 1 })); - QVERIFY((normals == vector{ + CORRADE_COMPARE(normals, (vector{ Vector3::zAxis(), -Vector3::zAxis() })); diff --git a/src/MeshTools/Test/GenerateFlatNormalsTest.h b/src/MeshTools/Test/GenerateFlatNormalsTest.h index 32d798d16..130636498 100644 --- a/src/MeshTools/Test/GenerateFlatNormalsTest.h +++ b/src/MeshTools/Test/GenerateFlatNormalsTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class GenerateFlatNormalsTest: public QObject { - Q_OBJECT +class GenerateFlatNormalsTest: public Corrade::TestSuite::Tester { + public: + GenerateFlatNormalsTest(); - private slots: void wrongIndexCount(); void generate(); }; diff --git a/src/MeshTools/Test/InterleaveTest.cpp b/src/MeshTools/Test/InterleaveTest.cpp index 6725560fb..9218a995f 100644 --- a/src/MeshTools/Test/InterleaveTest.cpp +++ b/src/MeshTools/Test/InterleaveTest.cpp @@ -16,34 +16,39 @@ #include "InterleaveTest.h" #include -#include #include "Utility/Endianness.h" #include "Utility/Debug.h" #include "MeshTools/Interleave.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::InterleaveTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::InterleaveTest) using namespace std; using Corrade::Utility::Endianness; namespace Magnum { namespace MeshTools { namespace Test { +InterleaveTest::InterleaveTest() { + addTests(&InterleaveTest::attributeCount, + &InterleaveTest::stride, + &InterleaveTest::write); +} + void InterleaveTest::attributeCount() { stringstream ss; Error::setOutput(&ss); - QCOMPARE((Implementation::Interleave::attributeCount(vector{0, 1, 2}, + CORRADE_COMPARE((Implementation::Interleave::attributeCount(vector{0, 1, 2}, vector{0, 1, 2, 3, 4, 5})), size_t(0)); - QVERIFY(ss.str() == "MeshTools::interleave(): attribute arrays don't have the same length, nothing done.\n"); + CORRADE_COMPARE(ss.str(), "MeshTools::interleave(): attribute arrays don't have the same length, nothing done.\n"); - QCOMPARE((Implementation::Interleave::attributeCount(vector{0, 1, 2}, + CORRADE_COMPARE((Implementation::Interleave::attributeCount(vector{0, 1, 2}, vector{3, 4, 5})), size_t(3)); } void InterleaveTest::stride() { - QCOMPARE(Implementation::Interleave::stride(vector()), size_t(1)); - QCOMPARE(Implementation::Interleave::stride(vector()), size_t(4)); - QCOMPARE((Implementation::Interleave::stride(vector(), vector())), size_t(5)); + CORRADE_COMPARE(Implementation::Interleave::stride(vector()), size_t(1)); + CORRADE_COMPARE(Implementation::Interleave::stride(vector()), size_t(4)); + CORRADE_COMPARE((Implementation::Interleave::stride(vector(), vector())), size_t(5)); } void InterleaveTest::write() { @@ -55,17 +60,17 @@ void InterleaveTest::write() { vector{3, 4, 5}, vector{6, 7, 8}); - QCOMPARE(attributeCount, size_t(3)); - QCOMPARE(stride, size_t(7)); + CORRADE_COMPARE(attributeCount, size_t(3)); + CORRADE_COMPARE(stride, size_t(7)); size_t size = attributeCount*stride; if(!Endianness::isBigEndian()) { - QVERIFY((vector(data, data+size) == vector{ + CORRADE_COMPARE(vector(data, data+size), (vector{ 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x07, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00 })); } else { - QVERIFY((vector(data, data+size) == vector{ + CORRADE_COMPARE(vector(data, data+size), (vector{ 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x06, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x07, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x08 diff --git a/src/MeshTools/Test/InterleaveTest.h b/src/MeshTools/Test/InterleaveTest.h index 02939f37e..e360d0554 100644 --- a/src/MeshTools/Test/InterleaveTest.h +++ b/src/MeshTools/Test/InterleaveTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class InterleaveTest: public QObject { - Q_OBJECT +class InterleaveTest: public Corrade::TestSuite::Tester { + public: + InterleaveTest(); - private slots: void attributeCount(); void stride(); void write(); diff --git a/src/MeshTools/Test/SubdivideTest.cpp b/src/MeshTools/Test/SubdivideTest.cpp index 11941edf7..611155a60 100644 --- a/src/MeshTools/Test/SubdivideTest.cpp +++ b/src/MeshTools/Test/SubdivideTest.cpp @@ -16,17 +16,21 @@ #include "SubdivideTest.h" #include -#include #include "MeshTools/Clean.h" #include "MeshTools/Subdivide.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::SubdivideTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::SubdivideTest) using namespace std; namespace Magnum { namespace MeshTools { namespace Test { +SubdivideTest::SubdivideTest() { + addTests(&SubdivideTest::wrongIndexCount, + &SubdivideTest::subdivide); +} + void SubdivideTest::wrongIndexCount() { stringstream ss; Error::setOutput(&ss); @@ -34,7 +38,7 @@ void SubdivideTest::wrongIndexCount() { vector vertices; vector indices{0, 1}; MeshTools::subdivide(indices, vertices, interpolator); - QVERIFY(ss.str() == "MeshTools::subdivide(): index count is not divisible by 3!\n"); + CORRADE_COMPARE(ss.str(), "MeshTools::subdivide(): index count is not divisible by 3!\n"); } void SubdivideTest::subdivide() { @@ -42,15 +46,15 @@ void SubdivideTest::subdivide() { vector indices{0, 1, 2, 1, 2, 3}; MeshTools::subdivide(indices, vertices, interpolator); - QVERIFY(indices.size() == 24); + CORRADE_COMPARE(indices.size(), 24); - QVERIFY((vertices == vector{0, 2, 6, 8, 1, 4, 3, 4, 7, 5})); - QVERIFY((indices == vector{4, 5, 6, 7, 8, 9, 0, 4, 6, 4, 1, 5, 6, 5, 2, 1, 7, 9, 7, 2, 8, 9, 8, 3})); + CORRADE_VERIFY(vertices == (vector{0, 2, 6, 8, 1, 4, 3, 4, 7, 5})); + CORRADE_COMPARE(indices, (vector{4, 5, 6, 7, 8, 9, 0, 4, 6, 4, 1, 5, 6, 5, 2, 1, 7, 9, 7, 2, 8, 9, 8, 3})); MeshTools::clean(indices, vertices); /* Vertices 0, 1, 2, 3, 4, 5, 6, 7, 8 */ - QVERIFY(vertices.size() == 9); + CORRADE_COMPARE(vertices.size(), 9); } }}} diff --git a/src/MeshTools/Test/SubdivideTest.h b/src/MeshTools/Test/SubdivideTest.h index 28ade77a0..bc7569cb5 100644 --- a/src/MeshTools/Test/SubdivideTest.h +++ b/src/MeshTools/Test/SubdivideTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class SubdivideTest: public QObject { - Q_OBJECT +class SubdivideTest: public Corrade::TestSuite::Tester { + public: + SubdivideTest(); - private slots: void wrongIndexCount(); void subdivide(); diff --git a/src/MeshTools/Test/TipsifyTest.cpp b/src/MeshTools/Test/TipsifyTest.cpp index c33180d36..40a2fbf6c 100644 --- a/src/MeshTools/Test/TipsifyTest.cpp +++ b/src/MeshTools/Test/TipsifyTest.cpp @@ -19,7 +19,7 @@ #include "MeshTools/Tipsify.h" -QTEST_APPLESS_MAIN(Magnum::MeshTools::Test::TipsifyTest) +CORRADE_TEST_MAIN(Magnum::MeshTools::Test::TipsifyTest) using namespace std; @@ -63,13 +63,16 @@ TipsifyTest::TipsifyTest(): indices{ 14, 11, 10, 16, 17, 18 -}, vertexCount(19) {} +}, vertexCount(19) { + addTests(&TipsifyTest::buildAdjacency, + &TipsifyTest::tipsify); +} void TipsifyTest::buildAdjacency() { vector liveTriangleCount, neighborOffset, neighbors; Implementation::Tipsify(indices, vertexCount).buildAdjacency(liveTriangleCount, neighborOffset, neighbors); - QVERIFY((liveTriangleCount == vector{ + CORRADE_COMPARE(liveTriangleCount, (vector{ 1, 3, 3, 2, 4, 6, 6, 2, 2, 6, 6, 4, @@ -77,7 +80,7 @@ void TipsifyTest::buildAdjacency() { 1, 1, 1 })); - QVERIFY((neighborOffset == vector{ + CORRADE_COMPARE(neighborOffset, (vector{ 0, 1, 4, 7, 9, 13, 19, 25, 27, 29, 35, 41, @@ -85,7 +88,7 @@ void TipsifyTest::buildAdjacency() { 54, 55, 56, 57 })); - QVERIFY((neighbors == vector{ + CORRADE_COMPARE(neighbors, (vector{ 0, 0, 7, 11, 2, 7, 13, @@ -113,7 +116,7 @@ void TipsifyTest::buildAdjacency() { void TipsifyTest::tipsify() { MeshTools::tipsify(indices, vertexCount, 3); - QVERIFY((indices == vector{ + CORRADE_COMPARE(indices, (vector{ 4, 1, 0, 9, 5, 4, 1, 4, 5, diff --git a/src/MeshTools/Test/TipsifyTest.h b/src/MeshTools/Test/TipsifyTest.h index 8d9417837..939f6ae5a 100644 --- a/src/MeshTools/Test/TipsifyTest.h +++ b/src/MeshTools/Test/TipsifyTest.h @@ -15,17 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace MeshTools { namespace Test { -class TipsifyTest: public QObject { - Q_OBJECT - +class TipsifyTest: public Corrade::TestSuite::Tester { public: TipsifyTest(); - private slots: void buildAdjacency(); void tipsify(); diff --git a/src/Physics/Test/AbstractShapeTest.h b/src/Physics/Test/AbstractShapeTest.h index 7a393b1ef..6d2096ae1 100644 --- a/src/Physics/Test/AbstractShapeTest.h +++ b/src/Physics/Test/AbstractShapeTest.h @@ -15,13 +15,13 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include #include "Magnum.h" namespace Magnum { namespace Physics { namespace Test { -class AbstractShapeTest: public QObject { +class AbstractShapeTest { protected: template void randomTransformation(T& shape) { shape.applyTransformation(Matrix4::translation({7.0f, 8.0f, -9.0f})); @@ -29,16 +29,16 @@ class AbstractShapeTest: public QObject { }; #define VERIFY_COLLIDES(a, b) \ - QVERIFY(a % b); \ - QVERIFY(b % a); \ - QVERIFY(a.collides(&b)); \ - QVERIFY(b.collides(&a)); + CORRADE_VERIFY(a % b); \ + CORRADE_VERIFY(b % a); \ + CORRADE_VERIFY(a.collides(&b)); \ + CORRADE_VERIFY(b.collides(&a)); #define VERIFY_NOT_COLLIDES(a, b) \ - QVERIFY(!(a % b)); \ - QVERIFY(!(b % a)); \ - QVERIFY(!(a.collides(&b))); \ - QVERIFY(!(b.collides(&a))); + CORRADE_VERIFY(!(a % b)); \ + CORRADE_VERIFY(!(b % a)); \ + CORRADE_VERIFY(!(a.collides(&b))); \ + CORRADE_VERIFY(!(b.collides(&a))); }}} diff --git a/src/Physics/Test/AxisAlignedBoxTest.cpp b/src/Physics/Test/AxisAlignedBoxTest.cpp index c90a549c4..e62e3df6f 100644 --- a/src/Physics/Test/AxisAlignedBoxTest.cpp +++ b/src/Physics/Test/AxisAlignedBoxTest.cpp @@ -15,24 +15,26 @@ #include "AxisAlignedBoxTest.h" -#include - #include "Physics/AxisAlignedBox.h" -QTEST_APPLESS_MAIN(Magnum::Physics::Test::AxisAlignedBoxTest) +CORRADE_TEST_MAIN(Magnum::Physics::Test::AxisAlignedBoxTest) namespace Magnum { namespace Physics { namespace Test { +AxisAlignedBoxTest::AxisAlignedBoxTest() { + addTests(&AxisAlignedBoxTest::applyTransformation); +} + void AxisAlignedBoxTest::applyTransformation() { Physics::AxisAlignedBox box({-1.0f, -2.0f, -3.0f}, {1.0f, 2.0f, 3.0f}); box.applyTransformation(Matrix4::scaling({2.0f, -1.0f, 1.5f})); - QVERIFY((box.transformedPosition() == Vector3(-2.0f, 2.0f, -4.5f))); - QVERIFY((box.transformedSize() == Vector3(2.0f, -2.0f, 4.5f))); + CORRADE_COMPARE(box.transformedPosition(), Vector3(-2.0f, 2.0f, -4.5f)); + CORRADE_COMPARE(box.transformedSize(), Vector3(2.0f, -2.0f, 4.5f)); box.applyTransformation(Matrix4::translation(Vector3(1.0f))*Matrix4::rotation(deg(90.0f), Vector3::xAxis())); - QVERIFY((box.transformedPosition() == Vector3(0.0f, 4.0f, -1.0f))); - QVERIFY((box.transformedSize() == Vector3(1.0f, -3.0f, 2.0f))); + CORRADE_COMPARE(box.transformedPosition(), Vector3(0.0f, 4.0f, -1.0f)); + CORRADE_COMPARE(box.transformedSize(), Vector3(1.0f, -3.0f, 2.0f)); } }}} diff --git a/src/Physics/Test/AxisAlignedBoxTest.h b/src/Physics/Test/AxisAlignedBoxTest.h index fd734336b..bbbbd1083 100644 --- a/src/Physics/Test/AxisAlignedBoxTest.h +++ b/src/Physics/Test/AxisAlignedBoxTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Physics { namespace Test { -class AxisAlignedBoxTest: public QObject { - Q_OBJECT +class AxisAlignedBoxTest: public Corrade::TestSuite::Tester { + public: + AxisAlignedBoxTest(); - private slots: void applyTransformation(); }; diff --git a/src/Physics/Test/CMakeLists.txt b/src/Physics/Test/CMakeLists.txt index a95eb3d45..b182873a0 100644 --- a/src/Physics/Test/CMakeLists.txt +++ b/src/Physics/Test/CMakeLists.txt @@ -1,7 +1,7 @@ -corrade_add_test(PhysicsAxisAlignedBoxTest AxisAlignedBoxTest.h AxisAlignedBoxTest.cpp MagnumPhysics) -corrade_add_test(PhysicsCapsuleTest CapsuleTest.h CapsuleTest.cpp MagnumPhysics) -corrade_add_test(PhysicsLineTest LineTest.h LineTest.cpp MagnumPhysics) -corrade_add_test(PhysicsPlaneTest PlaneTest.h PlaneTest.cpp MagnumPhysics) -corrade_add_test(PhysicsPointTest PointTest.h PointTest.cpp MagnumPhysics) -corrade_add_test(PhysicsShapeGroupTest ShapeGroupTest.h ShapeGroupTest.cpp MagnumPhysics) -corrade_add_test(PhysicsSphereTest SphereTest.h SphereTest.cpp MagnumPhysics) +corrade_add_test2(PhysicsAxisAlignedBoxTest AxisAlignedBoxTest.cpp LIBRARIES MagnumPhysics) +corrade_add_test2(PhysicsCapsuleTest CapsuleTest.cpp LIBRARIES MagnumPhysics) +corrade_add_test2(PhysicsLineTest LineTest.cpp LIBRARIES MagnumPhysics) +corrade_add_test2(PhysicsPlaneTest PlaneTest.cpp LIBRARIES MagnumPhysics) +corrade_add_test2(PhysicsPointTest PointTest.cpp LIBRARIES MagnumPhysics) +corrade_add_test2(PhysicsShapeGroupTest ShapeGroupTest.cpp LIBRARIES MagnumPhysics) +corrade_add_test2(PhysicsSphereTest SphereTest.cpp LIBRARIES MagnumPhysics) diff --git a/src/Physics/Test/CapsuleTest.cpp b/src/Physics/Test/CapsuleTest.cpp index 7b903e1fa..3c4d2ba8d 100644 --- a/src/Physics/Test/CapsuleTest.cpp +++ b/src/Physics/Test/CapsuleTest.cpp @@ -15,25 +15,28 @@ #include "CapsuleTest.h" -#include - #include "Physics/Capsule.h" -QTEST_APPLESS_MAIN(Magnum::Physics::Test::CapsuleTest) +CORRADE_TEST_MAIN(Magnum::Physics::Test::CapsuleTest) namespace Magnum { namespace Physics { namespace Test { +CapsuleTest::CapsuleTest() { + addTests(&CapsuleTest::applyTransformation, + &CapsuleTest::collisionPoint); +} + void CapsuleTest::applyTransformation() { Physics::Capsule capsule({1.0f, 2.0f, 3.0f}, {-1.0f, -2.0f, -3.0f}, 7.0f); capsule.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::zAxis())); - QVERIFY((capsule.transformedA() == Vector3(-2.0f, 1.0f, 3.0f))); - QVERIFY((capsule.transformedB() == Vector3(2.0f, -1.0f, -3.0f))); - QCOMPARE(capsule.radius(), 7.0f); + CORRADE_COMPARE(capsule.transformedA(), Vector3(-2.0f, 1.0f, 3.0f)); + CORRADE_COMPARE(capsule.transformedB(), Vector3(2.0f, -1.0f, -3.0f)); + CORRADE_COMPARE(capsule.radius(), 7.0f); /* Apply average scaling to radius */ capsule.applyTransformation(Matrix4::scaling({Math::Constants::sqrt3(), -Math::Constants::sqrt2(), 2.0f})); - QCOMPARE(capsule.transformedRadius(), Math::Constants::sqrt3()*7.0f); + CORRADE_COMPARE(capsule.transformedRadius(), Math::Constants::sqrt3()*7.0f); } void CapsuleTest::collisionPoint() { diff --git a/src/Physics/Test/CapsuleTest.h b/src/Physics/Test/CapsuleTest.h index 2b5e85e65..6cc79cfbb 100644 --- a/src/Physics/Test/CapsuleTest.h +++ b/src/Physics/Test/CapsuleTest.h @@ -19,10 +19,10 @@ namespace Magnum { namespace Physics { namespace Test { -class CapsuleTest: public AbstractShapeTest { - Q_OBJECT +class CapsuleTest: public Corrade::TestSuite::Tester, AbstractShapeTest { + public: + CapsuleTest(); - private slots: void applyTransformation(); void collisionPoint(); void collisionSphere(); diff --git a/src/Physics/Test/LineTest.cpp b/src/Physics/Test/LineTest.cpp index 372a18820..b4badfba4 100644 --- a/src/Physics/Test/LineTest.cpp +++ b/src/Physics/Test/LineTest.cpp @@ -15,19 +15,21 @@ #include "LineTest.h" -#include - #include "Physics/Line.h" -QTEST_APPLESS_MAIN(Magnum::Physics::Test::LineTest) +CORRADE_TEST_MAIN(Magnum::Physics::Test::LineTest) namespace Magnum { namespace Physics { namespace Test { +LineTest::LineTest() { + addTests(&LineTest::applyTransformation); +} + void LineTest::applyTransformation() { Physics::Line line({1.0f, 2.0f, 3.0f}, {-1.0f, -2.0f, -3.0f}); line.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::zAxis())); - QVERIFY((line.transformedA() == Vector3(-2.0f, 1.0f, 3.0f))); - QVERIFY((line.transformedB() == Vector3(2.0f, -1.0f, -3.0f))); + CORRADE_COMPARE(line.transformedA(), Vector3(-2.0f, 1.0f, 3.0f)); + CORRADE_COMPARE(line.transformedB(), Vector3(2.0f, -1.0f, -3.0f)); } }}} diff --git a/src/Physics/Test/LineTest.h b/src/Physics/Test/LineTest.h index a3a56f4a9..fd264747b 100644 --- a/src/Physics/Test/LineTest.h +++ b/src/Physics/Test/LineTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Physics { namespace Test { -class LineTest: public QObject { - Q_OBJECT +class LineTest: public Corrade::TestSuite::Tester { + public: + LineTest(); - private slots: void applyTransformation(); }; diff --git a/src/Physics/Test/PlaneTest.cpp b/src/Physics/Test/PlaneTest.cpp index f5ebf3952..8b8e4ac4c 100644 --- a/src/Physics/Test/PlaneTest.cpp +++ b/src/Physics/Test/PlaneTest.cpp @@ -15,25 +15,29 @@ #include "PlaneTest.h" -#include - #include "Physics/Plane.h" -QTEST_APPLESS_MAIN(Magnum::Physics::Test::PlaneTest) +CORRADE_TEST_MAIN(Magnum::Physics::Test::PlaneTest) namespace Magnum { namespace Physics { namespace Test { +PlaneTest::PlaneTest() { + addTests(&PlaneTest::applyTransformation, + &PlaneTest::collisionLine, + &PlaneTest::collisionLineSegment); +} + void PlaneTest::applyTransformation() { Physics::Plane plane({1.0f, 2.0f, 3.0f}, {Math::Constants::sqrt2(), -Math::Constants::sqrt2(), 0}); plane.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::xAxis())); - QVERIFY(plane.transformedPosition() == Vector3(1.0f, -3.0f, 2.0f)); - QVERIFY(plane.transformedNormal() == Vector3(Math::Constants::sqrt2(), 0, -Math::Constants::sqrt2())); + CORRADE_COMPARE(plane.transformedPosition(), Vector3(1.0f, -3.0f, 2.0f)); + CORRADE_COMPARE(plane.transformedNormal(), Vector3(Math::Constants::sqrt2(), 0, -Math::Constants::sqrt2())); /* The normal should stay normalized */ plane.applyTransformation(Matrix4::scaling({1.5f, 2.0f, 3.0f})); - QVERIFY(plane.transformedPosition() == Vector3(1.5f, 4.0f, 9.0f)); - QVERIFY(plane.transformedNormal() == Vector3(Math::Constants::sqrt2(), -Math::Constants::sqrt2(), 0)); + CORRADE_COMPARE(plane.transformedPosition(), Vector3(1.5f, 4.0f, 9.0f)); + CORRADE_COMPARE(plane.transformedNormal(), Vector3(Math::Constants::sqrt2(), -Math::Constants::sqrt2(), 0)); } void PlaneTest::collisionLine() { diff --git a/src/Physics/Test/PlaneTest.h b/src/Physics/Test/PlaneTest.h index e8404692f..72baabe19 100644 --- a/src/Physics/Test/PlaneTest.h +++ b/src/Physics/Test/PlaneTest.h @@ -19,10 +19,10 @@ namespace Magnum { namespace Physics { namespace Test { -class PlaneTest: public AbstractShapeTest { - Q_OBJECT +class PlaneTest: public Corrade::TestSuite::Tester, AbstractShapeTest { + public: + PlaneTest(); - private slots: void applyTransformation(); void collisionLine(); void collisionLineSegment(); diff --git a/src/Physics/Test/PointTest.cpp b/src/Physics/Test/PointTest.cpp index 473025c92..5edff1469 100644 --- a/src/Physics/Test/PointTest.cpp +++ b/src/Physics/Test/PointTest.cpp @@ -15,18 +15,20 @@ #include "PointTest.h" -#include - #include "Physics/Point.h" -QTEST_APPLESS_MAIN(Magnum::Physics::Test::PointTest) +CORRADE_TEST_MAIN(Magnum::Physics::Test::PointTest) namespace Magnum { namespace Physics { namespace Test { +PointTest::PointTest() { + addTests(&PointTest::applyTransformation); +} + void PointTest::applyTransformation() { Physics::Point point({1.0f, 2.0f, 3.0f}); point.applyTransformation(Matrix4::translation({5.0f, 6.0f, 7.0f})); - QVERIFY((point.transformedPosition() == Vector3(6.0f, 8.0f, 10.0f))); + CORRADE_COMPARE(point.transformedPosition(), Vector3(6.0f, 8.0f, 10.0f)); } }}} diff --git a/src/Physics/Test/PointTest.h b/src/Physics/Test/PointTest.h index 6db9f7afa..f158954fb 100644 --- a/src/Physics/Test/PointTest.h +++ b/src/Physics/Test/PointTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Physics { namespace Test { -class PointTest: public QObject { - Q_OBJECT +class PointTest: public Corrade::TestSuite::Tester { + public: + PointTest(); - private slots: void applyTransformation(); }; diff --git a/src/Physics/Test/ShapeGroupTest.cpp b/src/Physics/Test/ShapeGroupTest.cpp index dc222fe5e..866a52cbd 100644 --- a/src/Physics/Test/ShapeGroupTest.cpp +++ b/src/Physics/Test/ShapeGroupTest.cpp @@ -15,18 +15,21 @@ #include "ShapeGroupTest.h" -#include - #include "Physics/Point.h" #include "Physics/Sphere.h" #include "Physics/ShapeGroup.h" -QTEST_APPLESS_MAIN(Magnum::Physics::Test::ShapeGroupTest) - using namespace std; +CORRADE_TEST_MAIN(Magnum::Physics::Test::ShapeGroupTest) + namespace Magnum { namespace Physics { namespace Test { +ShapeGroupTest::ShapeGroupTest() { + addTests(&ShapeGroupTest::copy, + &ShapeGroupTest::reference); +} + void ShapeGroupTest::copy() { ShapeGroup group; { @@ -38,6 +41,8 @@ void ShapeGroupTest::copy() { /* Just to test that it doesn't crash */ group.applyTransformation(Matrix4::translation(Vector3::xAxis(1.0f))); + + CORRADE_VERIFY(true); } void ShapeGroupTest::reference() { @@ -48,8 +53,8 @@ void ShapeGroupTest::reference() { group.applyTransformation(Matrix4::translation(Vector3(1.0f))); - QVERIFY((point.transformedPosition() == Vector3(2.0f, 3.0f, 4.0f))); - QVERIFY((sphere.transformedPosition() == Vector3(3.0f, 2.0f, 31.0f))); + CORRADE_VERIFY((point.transformedPosition() == Vector3(2.0f, 3.0f, 4.0f))); + CORRADE_VERIFY((sphere.transformedPosition() == Vector3(3.0f, 2.0f, 31.0f))); } }}} diff --git a/src/Physics/Test/ShapeGroupTest.h b/src/Physics/Test/ShapeGroupTest.h index 640e30d56..7e12a3633 100644 --- a/src/Physics/Test/ShapeGroupTest.h +++ b/src/Physics/Test/ShapeGroupTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Physics { namespace Test { -class ShapeGroupTest: public QObject { - Q_OBJECT +class ShapeGroupTest: public Corrade::TestSuite::Tester { + public: + ShapeGroupTest(); - private slots: void copy(); void reference(); }; diff --git a/src/Physics/Test/SphereTest.cpp b/src/Physics/Test/SphereTest.cpp index f8b1a06b9..432c99db7 100644 --- a/src/Physics/Test/SphereTest.cpp +++ b/src/Physics/Test/SphereTest.cpp @@ -15,29 +15,35 @@ #include "SphereTest.h" -#include - #include "Physics/Sphere.h" -QTEST_APPLESS_MAIN(Magnum::Physics::Test::SphereTest) +CORRADE_TEST_MAIN(Magnum::Physics::Test::SphereTest) namespace Magnum { namespace Physics { namespace Test { +SphereTest::SphereTest() { + addTests(&SphereTest::applyTransformation, + &SphereTest::collisionPoint, + &SphereTest::collisionLine, + &SphereTest::collisionLineSegment, + &SphereTest::collisionSphere); +} + void SphereTest::applyTransformation() { Physics::Sphere sphere({1.0f, 2.0f, 3.0f}, 7.0f); sphere.applyTransformation(Matrix4::rotation(deg(90.0f), Vector3::yAxis())); - QVERIFY((sphere.transformedPosition() == Vector3(3.0f, 2.0f, -1.0f))); - QCOMPARE(sphere.transformedRadius(), 7.0f); + CORRADE_COMPARE(sphere.transformedPosition(), Vector3(3.0f, 2.0f, -1.0f)); + CORRADE_COMPARE(sphere.transformedRadius(), 7.0f); /* Symmetric scaling */ sphere.applyTransformation(Matrix4::scaling(Vector3(2.0f))); - QVERIFY((sphere.transformedPosition() == Vector3(2.0f, 4.0f, 6.0f))); - QCOMPARE(sphere.transformedRadius(), 14.0f); + CORRADE_COMPARE(sphere.transformedPosition(), Vector3(2.0f, 4.0f, 6.0f)); + CORRADE_COMPARE(sphere.transformedRadius(), 14.0f); /* Apply average scaling to radius */ sphere.applyTransformation(Matrix4::scaling({Math::Constants::sqrt3(), -Math::Constants::sqrt2(), 2.0f})); - QCOMPARE(sphere.transformedRadius(), Math::Constants::sqrt3()*7.0f); + CORRADE_COMPARE(sphere.transformedRadius(), Math::Constants::sqrt3()*7.0f); } void SphereTest::collisionPoint() { diff --git a/src/Physics/Test/SphereTest.h b/src/Physics/Test/SphereTest.h index b71a08a09..6ff9c7bc9 100644 --- a/src/Physics/Test/SphereTest.h +++ b/src/Physics/Test/SphereTest.h @@ -19,10 +19,10 @@ namespace Magnum { namespace Physics { namespace Test { -class SphereTest: public AbstractShapeTest { - Q_OBJECT +class SphereTest: public Corrade::TestSuite::Tester, AbstractShapeTest { + public: + SphereTest(); - private slots: void applyTransformation(); void collisionPoint(); void collisionLine(); diff --git a/src/Primitives/Test/CMakeLists.txt b/src/Primitives/Test/CMakeLists.txt index d45a534e9..e30186313 100644 --- a/src/Primitives/Test/CMakeLists.txt +++ b/src/Primitives/Test/CMakeLists.txt @@ -1,2 +1,2 @@ -corrade_add_test(PrimitivesCapsuleTest CapsuleTest.h CapsuleTest.cpp MagnumPrimitives) -corrade_add_test(PrimitivesUVSphereTest UVSphereTest.h UVSphereTest.cpp MagnumPrimitives) +corrade_add_test2(PrimitivesCapsuleTest CapsuleTest.cpp LIBRARIES MagnumPrimitives) +corrade_add_test2(PrimitivesUVSphereTest UVSphereTest.cpp LIBRARIES MagnumPrimitives) diff --git a/src/Primitives/Test/CapsuleTest.cpp b/src/Primitives/Test/CapsuleTest.cpp index 9347d0bf8..a2cc760dd 100644 --- a/src/Primitives/Test/CapsuleTest.cpp +++ b/src/Primitives/Test/CapsuleTest.cpp @@ -18,20 +18,23 @@ #include "CapsuleTest.h" -#include - -QTEST_APPLESS_MAIN(Magnum::Primitives::Test::CapsuleTest) - #include "Primitives/Capsule.h" using namespace std; +CORRADE_TEST_MAIN(Magnum::Primitives::Test::CapsuleTest) + namespace Magnum { namespace Primitives { namespace Test { +CapsuleTest::CapsuleTest() { + addTests(&CapsuleTest::withoutTextureCoords, + &CapsuleTest::withTextureCoords); +} + void CapsuleTest::withoutTextureCoords() { Capsule capsule(2, 3, 1.0f); - QVERIFY((*capsule.vertices(0) == vector{ + CORRADE_COMPARE(*capsule.vertices(0), (vector{ Vector4(0.0f, -1.5f, 0.0f), Vector4(0.0f, -1.20711f, 0.707107f), @@ -53,7 +56,7 @@ void CapsuleTest::withoutTextureCoords() { Vector4(0.0f, 1.5f, 0.0f) })); - QVERIFY((*capsule.normals(0) == vector{ + CORRADE_COMPARE(*capsule.normals(0), (vector{ Vector3(0.0f, -1.0f, 0.0f), Vector3(0.0f, -0.707107f, 0.707107f), @@ -75,7 +78,7 @@ void CapsuleTest::withoutTextureCoords() { Vector3(0.0f, 1.0f, 0.0f) })); - QVERIFY((*capsule.indices() == vector{ + CORRADE_COMPARE(*capsule.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 1, 3, 1, 2, 5, 1, 5, 4, 2, 3, 6, 2, 6, 5, 3, 1, 4, 3, 4, 6, 4, 5, 8, 4, 8, 7, 5, 6, 9, 5, 9, 8, 6, 4, 7, 6, 7, 9, @@ -87,7 +90,7 @@ void CapsuleTest::withoutTextureCoords() { void CapsuleTest::withTextureCoords() { Capsule capsule(2, 3, 1.0f, Capsule::TextureCoords::Generate); - QVERIFY((*capsule.vertices(0) == vector{ + CORRADE_COMPARE(*capsule.vertices(0), (vector{ Vector4(0.0f, -1.5f, 0.0f), Vector4(0.0f, -1.20711f, 0.707107f), @@ -113,7 +116,7 @@ void CapsuleTest::withTextureCoords() { Vector4(0.0f, 1.5f, 0.0f) })); - QVERIFY((*capsule.textureCoords2D(0) == vector{ + CORRADE_COMPARE(*capsule.textureCoords2D(0), (vector{ Vector2(0.5f, 0.0f), Vector2(0.0f, 0.166667f), @@ -139,7 +142,7 @@ void CapsuleTest::withTextureCoords() { Vector2(0.5f, 1.0f) })); - QVERIFY((*capsule.indices() == vector{ + CORRADE_COMPARE(*capsule.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 4, 3, 1, 2, 6, 1, 6, 5, 2, 3, 7, 2, 7, 6, 3, 4, 8, 3, 8, 7, 5, 6, 10, 5, 10, 9, 6, 7, 11, 6, 11, 10, 7, 8, 12, 7, 12, 11, diff --git a/src/Primitives/Test/CapsuleTest.h b/src/Primitives/Test/CapsuleTest.h index 8eb3789ec..e8bc1f495 100644 --- a/src/Primitives/Test/CapsuleTest.h +++ b/src/Primitives/Test/CapsuleTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Primitives { namespace Test { -class CapsuleTest: public QObject { - Q_OBJECT +class CapsuleTest: public Corrade::TestSuite::Tester { + public: + CapsuleTest(); - private slots: void withoutTextureCoords(); void withTextureCoords(); }; diff --git a/src/Primitives/Test/UVSphereTest.cpp b/src/Primitives/Test/UVSphereTest.cpp index b0ff8090d..3fb613c61 100644 --- a/src/Primitives/Test/UVSphereTest.cpp +++ b/src/Primitives/Test/UVSphereTest.cpp @@ -15,20 +15,23 @@ #include "UVSphereTest.h" -#include - #include "Primitives/UVSphere.h" using namespace std; -QTEST_APPLESS_MAIN(Magnum::Primitives::Test::UVSphereTest) +CORRADE_TEST_MAIN(Magnum::Primitives::Test::UVSphereTest) namespace Magnum { namespace Primitives { namespace Test { +UVSphereTest::UVSphereTest() { + addTests(&UVSphereTest::withoutTextureCoords, + &UVSphereTest::withTextureCoords); +} + void UVSphereTest::withoutTextureCoords() { UVSphere sphere(3, 3); - QVERIFY((*sphere.vertices(0) == vector{ + CORRADE_COMPARE(*sphere.vertices(0), (vector{ Vector4(0.0f, -1.0f, 0.0f), Vector4(0.0f, -0.5f, 0.866025f), @@ -42,7 +45,7 @@ void UVSphereTest::withoutTextureCoords() { Vector4(0.0f, 1.0f, 0.0f) })); - QVERIFY((*sphere.normals(0) == vector{ + CORRADE_COMPARE(*sphere.normals(0), (vector{ Vector3(0.0f, -1.0f, 0.0f), Vector3(0.0f, -0.5f, 0.866025f), @@ -56,7 +59,7 @@ void UVSphereTest::withoutTextureCoords() { Vector3(0.0f, 1.0f, 0.0f) })); - QVERIFY((*sphere.indices() == vector{ + CORRADE_COMPARE(*sphere.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 1, 3, 1, 2, 5, 1, 5, 4, 2, 3, 6, 2, 6, 5, 3, 1, 4, 3, 4, 6, 4, 5, 7, 5, 6, 7, 6, 4, 7 @@ -66,7 +69,7 @@ void UVSphereTest::withoutTextureCoords() { void UVSphereTest::withTextureCoords() { UVSphere sphere(3, 3, UVSphere::TextureCoords::Generate); - QVERIFY((*sphere.vertices(0) == vector{ + CORRADE_COMPARE(*sphere.vertices(0), (vector{ Vector4(0.0f, -1.0f, 0.0f), Vector4(0.0f, -0.5f, 0.866025f), @@ -82,7 +85,7 @@ void UVSphereTest::withTextureCoords() { Vector4(0.0f, 1.0f, 0.0f) })); - QVERIFY((*sphere.textureCoords2D(0) == vector{ + CORRADE_COMPARE(*sphere.textureCoords2D(0), (vector{ Vector2(0.5f, 0.0f), Vector2(0.0f, 0.333333f), @@ -98,7 +101,7 @@ void UVSphereTest::withTextureCoords() { Vector2(0.5f, 1.0f) })); - QVERIFY((*sphere.indices() == vector{ + CORRADE_COMPARE(*sphere.indices(), (vector{ 0, 2, 1, 0, 3, 2, 0, 4, 3, 1, 2, 6, 1, 6, 5, 2, 3, 7, 2, 7, 6, 3, 4, 8, 3, 8, 7, 5, 6, 9, 6, 7, 9, 7, 8, 9 diff --git a/src/Primitives/Test/UVSphereTest.h b/src/Primitives/Test/UVSphereTest.h index ecfd7e896..8afd27522 100644 --- a/src/Primitives/Test/UVSphereTest.h +++ b/src/Primitives/Test/UVSphereTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Primitives { namespace Test { -class UVSphereTest: public QObject { - Q_OBJECT +class UVSphereTest: public Corrade::TestSuite::Tester { + public: + UVSphereTest(); - private slots: void withoutTextureCoords(); void withTextureCoords(); }; diff --git a/src/Test/CMakeLists.txt b/src/Test/CMakeLists.txt index b97a6786b..61f80a3a6 100644 --- a/src/Test/CMakeLists.txt +++ b/src/Test/CMakeLists.txt @@ -1,3 +1,3 @@ -corrade_add_test(ObjectTest ObjectTest.h ObjectTest.cpp MagnumTestLib) -corrade_add_test(CameraTest CameraTest.h CameraTest.cpp Magnum) -corrade_add_test(SceneTest SceneTest.h SceneTest.cpp Magnum) +corrade_add_test2(ObjectTest ObjectTest.cpp LIBRARIES MagnumTestLib) +corrade_add_test2(CameraTest CameraTest.cpp LIBRARIES Magnum) +corrade_add_test2(SceneTest SceneTest.cpp LIBRARIES Magnum) diff --git a/src/Test/CameraTest.cpp b/src/Test/CameraTest.cpp index 3da94250f..4211d0235 100644 --- a/src/Test/CameraTest.cpp +++ b/src/Test/CameraTest.cpp @@ -15,15 +15,18 @@ #include "CameraTest.h" -#include - #include "Camera.h" #include "Scene.h" -QTEST_APPLESS_MAIN(Magnum::Test::CameraTest) +CORRADE_TEST_MAIN(Magnum::Test::CameraTest) namespace Magnum { namespace Test { +CameraTest::CameraTest() { + addTests(&CameraTest::orthographic, + &CameraTest::perspective); +} + void CameraTest::orthographic() { Camera camera; camera.setOrthographic(5, 1, 9); @@ -33,7 +36,7 @@ void CameraTest::orthographic() { 0.0f, 0.0f, -0.25f, 0.0f, 0.0f, 0.0f, -1.25f, 1.0f); - QVERIFY(camera.projectionMatrix() == a); + CORRADE_COMPARE(camera.projectionMatrix(), a); } void CameraTest::perspective() { @@ -45,7 +48,7 @@ void CameraTest::perspective() { 0.0f, 0.0f, -1.9411764f, -1.0f, 0.0f, 0.0f, -94.1176452f, 0.0f); - QVERIFY(camera.projectionMatrix() == a); + CORRADE_COMPARE(camera.projectionMatrix(), a); } }} diff --git a/src/Test/CameraTest.h b/src/Test/CameraTest.h index e6151394e..9f5424647 100644 --- a/src/Test/CameraTest.h +++ b/src/Test/CameraTest.h @@ -15,14 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include namespace Magnum { namespace Test { -class CameraTest: public QObject { - Q_OBJECT +class CameraTest: public Corrade::TestSuite::Tester { + public: + CameraTest(); - private slots: void orthographic(); void perspective(); }; diff --git a/src/Test/ObjectTest.cpp b/src/Test/ObjectTest.cpp index 5d119d993..9e9f30a72 100644 --- a/src/Test/ObjectTest.cpp +++ b/src/Test/ObjectTest.cpp @@ -18,39 +18,47 @@ #include "Camera.h" #include -#include using namespace std; -QTEST_APPLESS_MAIN(Magnum::Test::ObjectTest) +CORRADE_TEST_MAIN(Magnum::Test::ObjectTest) namespace Magnum { namespace Test { +ObjectTest::ObjectTest() { + addTests(&ObjectTest::parenting, + &ObjectTest::transformation, + &ObjectTest::absoluteTransformationWrongCamera, + &ObjectTest::absoluteTransformation, + &ObjectTest::scene, + &ObjectTest::dirty); +} + void ObjectTest::parenting() { Object root; Object* childOne = new Object(&root); Object* childTwo = new Object(&root); - QVERIFY(childOne->parent() == &root); - QVERIFY(root.children().size() == 2); + CORRADE_VERIFY(childOne->parent() == &root); + CORRADE_COMPARE(root.children().size(), 2); /* A object cannot be parent of itself */ childOne->setParent(childOne); - QVERIFY(childOne->parent() == &root); + CORRADE_VERIFY(childOne->parent() == &root); /* In fact, cyclic dependencies are not allowed at all */ root.setParent(childTwo); - QVERIFY(root.parent() == nullptr); + CORRADE_VERIFY(root.parent() == nullptr); /* Reparent to another */ childTwo->setParent(childOne); - QVERIFY(root.children().size() == 1 && *root.children().begin() == childOne); - QVERIFY(childOne->children().size() == 1 && *childOne->children().begin() == childTwo); + CORRADE_VERIFY(root.children().size() == 1 && *root.children().begin() == childOne); + CORRADE_VERIFY(childOne->children().size() == 1 && *childOne->children().begin() == childTwo); /* Delete child */ delete childTwo; - QVERIFY(childOne->children().size() == 0); + CORRADE_VERIFY(childOne->children().empty()); } void ObjectTest::transformation() { @@ -62,16 +70,16 @@ void ObjectTest::transformation() { o.multiplyTransformation(Matrix4::rotation(deg(35.0f), Vector3::zAxis())); o2.rotate(deg(35.0f), Vector3::zAxis()); - QVERIFY(o.transformation() == Matrix4::rotation(deg(35.0f), Vector3::zAxis())* + CORRADE_COMPARE(o.transformation(), Matrix4::rotation(deg(35.0f), Vector3::zAxis())* Matrix4::translation(Vector3::xAxis(1.0f))); - QVERIFY(o2.transformation() == o.transformation()); + CORRADE_COMPARE(o2.transformation(), o.transformation()); o.multiplyTransformation(Matrix4::scaling(Vector3(2.0f)), Object::Transformation::Local); o2.scale(Vector3(2.0f), Object::Transformation::Local); - QVERIFY(o.transformation() == Matrix4::rotation(deg(35.0f), Vector3::zAxis())* + CORRADE_COMPARE(o.transformation(), Matrix4::rotation(deg(35.0f), Vector3::zAxis())* Matrix4::translation(Vector3::xAxis(1.0f))* Matrix4::scaling(Vector3(2.0f))); - QVERIFY(o2.transformation() == o.transformation()); + CORRADE_COMPARE(o2.transformation(), o.transformation()); } void ObjectTest::absoluteTransformationWrongCamera() { @@ -82,35 +90,35 @@ void ObjectTest::absoluteTransformationWrongCamera() { Object o(&s); o.translate(Vector3::yAxis()); Camera c; - QVERIFY(o.absoluteTransformation(&c) == Matrix4::translation(Vector3::yAxis())); - QVERIFY(ss.str() == "Object::absoluteTransformation(): the camera is not part of the same scene as object!\n"); + CORRADE_COMPARE(o.absoluteTransformation(&c), Matrix4::translation(Vector3::yAxis())); + CORRADE_COMPARE(ss.str(), "Object::absoluteTransformation(): the camera is not part of the same scene as object!\n"); ss.str(""); Object o2; o2.translate(Vector3::xAxis()); - QVERIFY(o2.absoluteTransformation(&c) == Matrix4::translation(Vector3::xAxis())); - QVERIFY(ss.str() == "Object::absoluteTransformation(): the object is not part of camera scene!\n"); + CORRADE_COMPARE(o2.absoluteTransformation(&c), Matrix4::translation(Vector3::xAxis())); + CORRADE_COMPARE(ss.str(), "Object::absoluteTransformation(): the object is not part of camera scene!\n"); } void ObjectTest::absoluteTransformation() { Scene s; Camera c(&s); c.translate(Vector3::zAxis(2.0f)); - QVERIFY(s.absoluteTransformation() == Matrix4()); - QVERIFY(c.absoluteTransformation(&c) == Matrix4()); + CORRADE_COMPARE(s.absoluteTransformation(), Matrix4()); + CORRADE_COMPARE(c.absoluteTransformation(&c), Matrix4()); Object o(&s); o.scale(Vector3(2.0f)); Object o2(&o); o.rotate(deg(90.0f), Vector3::yAxis()); - QVERIFY((o2.absoluteTransformation() == - Matrix4::scaling(Vector3(2.0f))*Matrix4::rotation(deg(90.0f), Vector3::yAxis()))); - QVERIFY((o2.absoluteTransformation(&c) == - (Matrix4::translation(Vector3::zAxis(2.0f)).inverted())*Matrix4::scaling(Vector3(2.0f))*Matrix4::rotation(deg(90.0f), Vector3::yAxis()))); + CORRADE_COMPARE(o2.absoluteTransformation(), + Matrix4::scaling(Vector3(2.0f))*Matrix4::rotation(deg(90.0f), Vector3::yAxis())); + CORRADE_COMPARE(o2.absoluteTransformation(&c), + (Matrix4::translation(Vector3::zAxis(2.0f)).inverted())*Matrix4::scaling(Vector3(2.0f))*Matrix4::rotation(deg(90.0f), Vector3::yAxis())); Object o3; o3.translate({1.0f, 2.0f, 3.0f}); - QVERIFY(o3.absoluteTransformation() == Matrix4::translation({1.0f, 2.0f, 3.0f})); + CORRADE_COMPARE(o3.absoluteTransformation(), Matrix4::translation({1.0f, 2.0f, 3.0f})); } void ObjectTest::scene() { @@ -122,8 +130,8 @@ void ObjectTest::scene() { Object orphan; Object* childOfOrphan = new Object(&orphan); - QVERIFY(childTwo->scene() == &scene); - QVERIFY(childOfOrphan->scene() == nullptr); + CORRADE_VERIFY(childTwo->scene() == &scene); + CORRADE_VERIFY(childOfOrphan->scene() == nullptr); } void ObjectTest::dirty() { @@ -137,54 +145,54 @@ void ObjectTest::dirty() { childThree->rotate(deg(90.0f), Vector3::yAxis()); /* Object is dirty at the beginning */ - QVERIFY(scene.isDirty()); - QVERIFY(childOne->isDirty()); + CORRADE_VERIFY(scene.isDirty()); + CORRADE_VERIFY(childOne->isDirty()); /* Clean the object and all its dirty parents (but not children) */ childOne->setClean(); - QVERIFY(childOne->cleanedAbsoluteTransformation == childOne->absoluteTransformation()); - QVERIFY(!scene.isDirty()); - QVERIFY(!childOne->isDirty()); - QVERIFY(childTwo->isDirty()); - QVERIFY(childThree->isDirty()); + CORRADE_COMPARE(childOne->cleanedAbsoluteTransformation, childOne->absoluteTransformation()); + CORRADE_VERIFY(!scene.isDirty()); + CORRADE_VERIFY(!childOne->isDirty()); + CORRADE_VERIFY(childTwo->isDirty()); + CORRADE_VERIFY(childThree->isDirty()); /* If the object itself is already clean, it shouldn't clean it again */ childOne->cleanedAbsoluteTransformation = Matrix4(Matrix4::Zero); childOne->setClean(); - QVERIFY(childOne->cleanedAbsoluteTransformation == Matrix4(Matrix4::Zero)); + CORRADE_COMPARE(childOne->cleanedAbsoluteTransformation, Matrix4(Matrix4::Zero)); /* If any object in the hierarchy is already clean, it shouldn't clean it again */ childTwo->setClean(); - QVERIFY(childOne->cleanedAbsoluteTransformation == Matrix4(Matrix4::Zero)); - QVERIFY(childTwo->cleanedAbsoluteTransformation == childTwo->absoluteTransformation()); - QVERIFY(!childOne->isDirty()); - QVERIFY(!childTwo->isDirty()); - QVERIFY(childThree->isDirty()); + CORRADE_COMPARE(childOne->cleanedAbsoluteTransformation, Matrix4(Matrix4::Zero)); + CORRADE_COMPARE(childTwo->cleanedAbsoluteTransformation, childTwo->absoluteTransformation()); + CORRADE_VERIFY(!childOne->isDirty()); + CORRADE_VERIFY(!childTwo->isDirty()); + CORRADE_VERIFY(childThree->isDirty()); /* Mark object and all its children as dirty (but not parents) */ childTwo->setDirty(); - QVERIFY(!scene.isDirty()); - QVERIFY(!childOne->isDirty()); - QVERIFY(childTwo->isDirty()); - QVERIFY(childThree->isDirty()); + CORRADE_VERIFY(!scene.isDirty()); + CORRADE_VERIFY(!childOne->isDirty()); + CORRADE_VERIFY(childTwo->isDirty()); + CORRADE_VERIFY(childThree->isDirty()); /* Reparent object => make it and its children dirty (but not parents) */ childThree->setClean(); - QVERIFY(childThree->cleanedAbsoluteTransformation == childThree->absoluteTransformation()); + CORRADE_COMPARE(childThree->cleanedAbsoluteTransformation, childThree->absoluteTransformation()); childTwo->setParent(nullptr); - QVERIFY(childTwo->isDirty()); - QVERIFY(!childOne->isDirty()); + CORRADE_VERIFY(childTwo->isDirty()); + CORRADE_VERIFY(!childOne->isDirty()); childTwo->setParent(&scene); - QVERIFY(!scene.isDirty()); - QVERIFY(childTwo->isDirty()); - QVERIFY(childThree->isDirty()); + CORRADE_VERIFY(!scene.isDirty()); + CORRADE_VERIFY(childTwo->isDirty()); + CORRADE_VERIFY(childThree->isDirty()); /* Set object transformation => make it and its children dirty (but not parents) */ childThree->setClean(); childTwo->setTransformation(Matrix4::translation(Vector3::xAxis(1.0f))); - QVERIFY(!scene.isDirty()); - QVERIFY(childTwo->isDirty()); - QVERIFY(childThree->isDirty()); + CORRADE_VERIFY(!scene.isDirty()); + CORRADE_VERIFY(childTwo->isDirty()); + CORRADE_VERIFY(childThree->isDirty()); } }} diff --git a/src/Test/ObjectTest.h b/src/Test/ObjectTest.h index 4071c6791..da48eabab 100644 --- a/src/Test/ObjectTest.h +++ b/src/Test/ObjectTest.h @@ -15,16 +15,16 @@ GNU Lesser General Public License version 3 for more details. */ -#include +#include #include "Object.h" namespace Magnum { namespace Test { -class ObjectTest: public QObject { - Q_OBJECT +class ObjectTest: public Corrade::TestSuite::Tester { + public: + ObjectTest(); - private slots: void parenting(); void transformation(); void absoluteTransformationWrongCamera(); diff --git a/src/Test/SceneTest.cpp b/src/Test/SceneTest.cpp index 3a236a88e..ac05d18e8 100644 --- a/src/Test/SceneTest.cpp +++ b/src/Test/SceneTest.cpp @@ -15,34 +15,37 @@ #include "SceneTest.h" -#include - #include "Scene.h" -QTEST_APPLESS_MAIN(Magnum::Test::SceneTest) +CORRADE_TEST_MAIN(Magnum::Test::SceneTest) namespace Magnum { namespace Test { +SceneTest::SceneTest() { + addTests(&SceneTest::transformation, + &SceneTest::parent); +} + void SceneTest::transformation() { Scene scene; Object* scenePointer = &scene; scenePointer->setTransformation(Matrix4::translation({1.0f, 1.0f, 1.0f})); - QVERIFY(scene.transformation() == Matrix4()); + CORRADE_COMPARE(scene.transformation(), Matrix4()); } void SceneTest::parent() { Scene scene; - QVERIFY(scene.parent() == &scene); + CORRADE_VERIFY(scene.parent() == &scene); /* Scene parent cannot be changed */ Object* scenePointer = &scene; Object object; scenePointer->setParent(&object); - QVERIFY(scene.parent() == &scene); - QVERIFY(scene.children().empty()); - QVERIFY(object.children().empty()); + CORRADE_VERIFY(scene.parent() == &scene); + CORRADE_VERIFY(scene.children().empty()); + CORRADE_VERIFY(object.children().empty()); } }} diff --git a/src/Test/SceneTest.h b/src/Test/SceneTest.h index 145676ca6..77af6179d 100644 --- a/src/Test/SceneTest.h +++ b/src/Test/SceneTest.h @@ -15,16 +15,14 @@ GNU Lesser General Public License version 3 for more details. */ -#include - -#include "Object.h" +#include namespace Magnum { namespace Test { -class SceneTest: public QObject { - Q_OBJECT +class SceneTest: public Corrade::TestSuite::Tester { + public: + SceneTest(); - private slots: void transformation(); void parent(); };