mirror of https://github.com/mosra/magnum.git
5 changed files with 257 additions and 1 deletions
@ -1,4 +1,8 @@
|
||||
corrade_add_test(SceneGraphAnimableTest AnimableTest.cpp LIBRARIES MagnumSceneGraph) |
||||
corrade_add_test(SceneGraphObjectTest ObjectTest.cpp LIBRARIES MagnumSceneGraphTestLib) |
||||
corrade_add_test(SceneGraphCameraTest CameraTest.cpp LIBRARIES MagnumSceneGraph) |
||||
corrade_add_test(SceneGraphEuclideanMatrixTr___2DTest EuclideanMatrixTransformation2DTest.cpp LIBRARIES MagnumSceneGraph) |
||||
corrade_add_test(SceneGraphEuclideanMatrixTr___3DTest EuclideanMatrixTransformation3DTest.cpp LIBRARIES MagnumSceneGraph) |
||||
corrade_add_test(SceneGraphMatrixTransformation2DTest MatrixTransformation2DTest.cpp LIBRARIES MagnumSceneGraph) |
||||
corrade_add_test(SceneGraphMatrixTransformation3DTest MatrixTransformation3DTest.cpp LIBRARIES MagnumSceneGraph) |
||||
corrade_add_test(SceneGraphObjectTest ObjectTest.cpp LIBRARIES MagnumSceneGraphTestLib) |
||||
corrade_add_test(SceneGraphSceneTest SceneTest.cpp LIBRARIES MagnumSceneGraph) |
||||
|
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include <TestSuite/Tester.h> |
||||
|
||||
#include "Math/Constants.h" |
||||
#include "SceneGraph/EuclideanMatrixTransformation2D.h" |
||||
|
||||
namespace Magnum { namespace SceneGraph { namespace Test { |
||||
|
||||
class EuclideanMatrixTransformation2DTest: public Corrade::TestSuite::Tester { |
||||
public: |
||||
explicit EuclideanMatrixTransformation2DTest(); |
||||
|
||||
void fromMatrix(); |
||||
void toMatrix(); |
||||
void compose(); |
||||
void inverted(); |
||||
}; |
||||
|
||||
EuclideanMatrixTransformation2DTest::EuclideanMatrixTransformation2DTest() { |
||||
addTests(&EuclideanMatrixTransformation2DTest::fromMatrix, |
||||
&EuclideanMatrixTransformation2DTest::toMatrix, |
||||
&EuclideanMatrixTransformation2DTest::compose, |
||||
&EuclideanMatrixTransformation2DTest::inverted); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation2DTest::fromMatrix() { |
||||
Matrix3 m = Matrix3::rotation(deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::fromMatrix(m), m); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation2DTest::toMatrix() { |
||||
Matrix3 m = Matrix3::rotation(deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::toMatrix(m), m); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation2DTest::compose() { |
||||
Matrix3 parent = Matrix3::rotation(deg(17.0f)); |
||||
Matrix3 child = Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::compose(parent, child), parent*child); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation2DTest::inverted() { |
||||
Matrix3 m = Matrix3::rotation(deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation2D<>::inverted(m)*m, Matrix3()); |
||||
} |
||||
|
||||
}}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::EuclideanMatrixTransformation2DTest) |
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include <TestSuite/Tester.h> |
||||
|
||||
#include "Math/Constants.h" |
||||
#include "SceneGraph/EuclideanMatrixTransformation3D.h" |
||||
|
||||
namespace Magnum { namespace SceneGraph { namespace Test { |
||||
|
||||
class EuclideanMatrixTransformation3DTest: public Corrade::TestSuite::Tester { |
||||
public: |
||||
explicit EuclideanMatrixTransformation3DTest(); |
||||
|
||||
void fromMatrix(); |
||||
void toMatrix(); |
||||
void compose(); |
||||
void inverted(); |
||||
}; |
||||
|
||||
EuclideanMatrixTransformation3DTest::EuclideanMatrixTransformation3DTest() { |
||||
addTests(&EuclideanMatrixTransformation3DTest::fromMatrix, |
||||
&EuclideanMatrixTransformation3DTest::toMatrix, |
||||
&EuclideanMatrixTransformation3DTest::compose, |
||||
&EuclideanMatrixTransformation3DTest::inverted); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation3DTest::fromMatrix() { |
||||
Matrix4 m = Matrix4::rotationX(deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::fromMatrix(m), m); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation3DTest::toMatrix() { |
||||
Matrix4 m = Matrix4::rotationX(deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::toMatrix(m), m); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation3DTest::compose() { |
||||
Matrix4 parent = Matrix4::rotationX(deg(17.0f)); |
||||
Matrix4 child = Matrix4::translation({1.0f, -0.3f, 2.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::compose(parent, child), parent*child); |
||||
} |
||||
|
||||
void EuclideanMatrixTransformation3DTest::inverted() { |
||||
Matrix4 m = Matrix4::rotationX(deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f}); |
||||
CORRADE_COMPARE(EuclideanMatrixTransformation3D<>::inverted(m)*m, Matrix4()); |
||||
} |
||||
|
||||
}}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::EuclideanMatrixTransformation3DTest) |
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include <TestSuite/Tester.h> |
||||
|
||||
#include "Math/Constants.h" |
||||
#include "SceneGraph/MatrixTransformation2D.h" |
||||
|
||||
namespace Magnum { namespace SceneGraph { namespace Test { |
||||
|
||||
class MatrixTransformation2DTest: public Corrade::TestSuite::Tester { |
||||
public: |
||||
explicit MatrixTransformation2DTest(); |
||||
|
||||
void fromMatrix(); |
||||
void toMatrix(); |
||||
void compose(); |
||||
void inverted(); |
||||
}; |
||||
|
||||
MatrixTransformation2DTest::MatrixTransformation2DTest() { |
||||
addTests(&MatrixTransformation2DTest::fromMatrix, |
||||
&MatrixTransformation2DTest::toMatrix, |
||||
&MatrixTransformation2DTest::compose, |
||||
&MatrixTransformation2DTest::inverted); |
||||
} |
||||
|
||||
void MatrixTransformation2DTest::fromMatrix() { |
||||
Matrix3 m = Matrix3::rotation(deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(MatrixTransformation2D<>::fromMatrix(m), m); |
||||
} |
||||
|
||||
void MatrixTransformation2DTest::toMatrix() { |
||||
Matrix3 m = Matrix3::rotation(deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(MatrixTransformation2D<>::toMatrix(m), m); |
||||
} |
||||
|
||||
void MatrixTransformation2DTest::compose() { |
||||
Matrix3 parent = Matrix3::rotation(deg(17.0f)); |
||||
Matrix3 child = Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(MatrixTransformation2D<>::compose(parent, child), parent*child); |
||||
} |
||||
|
||||
void MatrixTransformation2DTest::inverted() { |
||||
Matrix3 m = Matrix3::rotation(deg(17.0f))*Matrix3::translation({1.0f, -0.3f}); |
||||
CORRADE_COMPARE(MatrixTransformation2D<>::inverted(m)*m, Matrix3()); |
||||
} |
||||
|
||||
}}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::MatrixTransformation2DTest) |
||||
@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
This file is part of Magnum. |
||||
|
||||
Magnum is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU Lesser General Public License version 3 |
||||
only, as published by the Free Software Foundation. |
||||
|
||||
Magnum is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU Lesser General Public License version 3 for more details. |
||||
*/ |
||||
|
||||
#include <TestSuite/Tester.h> |
||||
|
||||
#include "Math/Constants.h" |
||||
#include "SceneGraph/MatrixTransformation3D.h" |
||||
|
||||
namespace Magnum { namespace SceneGraph { namespace Test { |
||||
|
||||
class MatrixTransformation3DTest: public Corrade::TestSuite::Tester { |
||||
public: |
||||
explicit MatrixTransformation3DTest(); |
||||
|
||||
void fromMatrix(); |
||||
void toMatrix(); |
||||
void compose(); |
||||
void inverted(); |
||||
}; |
||||
|
||||
MatrixTransformation3DTest::MatrixTransformation3DTest() { |
||||
addTests(&MatrixTransformation3DTest::fromMatrix, |
||||
&MatrixTransformation3DTest::toMatrix, |
||||
&MatrixTransformation3DTest::compose, |
||||
&MatrixTransformation3DTest::inverted); |
||||
} |
||||
|
||||
void MatrixTransformation3DTest::fromMatrix() { |
||||
Matrix4 m = Matrix4::rotationX(deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f})*Matrix4::scaling({2.0f, 1.4f, -2.1f}); |
||||
CORRADE_COMPARE(MatrixTransformation3D<>::fromMatrix(m), m); |
||||
} |
||||
|
||||
void MatrixTransformation3DTest::toMatrix() { |
||||
Matrix4 m = Matrix4::rotationX(deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f})*Matrix4::scaling({2.0f, 1.4f, -2.1f}); |
||||
CORRADE_COMPARE(MatrixTransformation3D<>::toMatrix(m), m); |
||||
} |
||||
|
||||
void MatrixTransformation3DTest::compose() { |
||||
Matrix4 parent = Matrix4::rotationX(deg(17.0f)); |
||||
Matrix4 child = Matrix4::translation({1.0f, -0.3f, 2.3f}); |
||||
CORRADE_COMPARE(MatrixTransformation3D<>::compose(parent, child), parent*child); |
||||
} |
||||
|
||||
void MatrixTransformation3DTest::inverted() { |
||||
Matrix4 m = Matrix4::rotationX(deg(17.0f))*Matrix4::translation({1.0f, -0.3f, 2.3f})*Matrix4::scaling({2.0f, 1.4f, -2.1f}); |
||||
CORRADE_COMPARE(MatrixTransformation3D<>::inverted(m)*m, Matrix4()); |
||||
} |
||||
|
||||
}}} |
||||
|
||||
CORRADE_TEST_MAIN(Magnum::SceneGraph::Test::MatrixTransformation3DTest) |
||||
Loading…
Reference in new issue