Browse Source

SceneGraph: cleanup and reorganization of Object test.

No functional change.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
ac38af4ef1
  1. 32
      src/SceneGraph/Test/ObjectTest.cpp

32
src/SceneGraph/Test/ObjectTest.cpp

@ -67,6 +67,20 @@ void ObjectTest::parenting() {
CORRADE_VERIFY(!childOne->hasChildren());
}
void ObjectTest::scene() {
Scene3D scene;
CORRADE_VERIFY(scene.scene() == &scene);
Object3D* childOne = new Object3D(&scene);
Object3D* childTwo = new Object3D(childOne);
Object3D orphan;
Object3D* childOfOrphan = new Object3D(&orphan);
CORRADE_VERIFY(childTwo->scene() == &scene);
CORRADE_VERIFY(childOfOrphan->scene() == nullptr);
}
void ObjectTest::absoluteTransformation() {
Scene3D s;
@ -74,9 +88,9 @@ void ObjectTest::absoluteTransformation() {
Object3D o(&s);
o.translate(Vector3::xAxis(2.0f));
Object3D o2(&o);
o2.rotate(deg(90.0f), Vector3::yAxis());
o2.rotateY(deg(90.0f));
CORRADE_COMPARE(o2.absoluteTransformation(),
Matrix4::translation(Vector3::xAxis(2.0f))*Matrix4::rotation(deg(90.0f), Vector3::yAxis()));
Matrix4::translation(Vector3::xAxis(2.0f))*Matrix4::rotationY(deg(90.0f)));
CORRADE_COMPARE(o2.absoluteTransformation(), o2.absoluteTransformationMatrix());
/* Transformation of root object */
@ -85,20 +99,6 @@ void ObjectTest::absoluteTransformation() {
CORRADE_COMPARE(o3.absoluteTransformation(), Matrix4::translation({1.0f, 2.0f, 3.0f}));
}
void ObjectTest::scene() {
Scene3D scene;
CORRADE_VERIFY(scene.scene() == &scene);
Object3D* childOne = new Object3D(&scene);
Object3D* childTwo = new Object3D(childOne);
Object3D orphan;
Object3D* childOfOrphan = new Object3D(&orphan);
CORRADE_VERIFY(childTwo->scene() == &scene);
CORRADE_VERIFY(childOfOrphan->scene() == nullptr);
}
void ObjectTest::caching() {
Scene3D scene;

Loading…
Cancel
Save