Browse Source

SceneGraph: test crash and burn when deleting a running animable.

Yes. It does.
pull/231/head
Vladimír Vondruš 8 years ago
parent
commit
dee10204f9
  1. 26
      src/Magnum/SceneGraph/Test/AnimableTest.cpp

26
src/Magnum/SceneGraph/Test/AnimableTest.cpp

@ -42,6 +42,8 @@ struct AnimableTest: TestSuite::Tester {
void stop();
void pause();
void deleteWhileRunning();
void debug();
};
@ -55,6 +57,8 @@ AnimableTest::AnimableTest() {
&AnimableTest::stop,
&AnimableTest::pause,
&AnimableTest::deleteWhileRunning,
&AnimableTest::debug});
}
@ -351,6 +355,28 @@ void AnimableTest::pause() {
CORRADE_COMPARE(animable.time, 2.0f);
}
void AnimableTest::deleteWhileRunning() {
Object3D object;
AnimableGroup3D group;
CORRADE_COMPARE(group.runningCount(), 0);
{
OneShotAnimable animable(object, &group);
/* Eat up some absolute time */
group.step(1.0f, 0.5f);
group.step(1.5f, 0.5f);
CORRADE_COMPARE(group.runningCount(), 1);
CORRADE_COMPARE(animable.state(), AnimationState::Running);
CORRADE_COMPARE(animable.time, 0.5f);
}
/* Animable got deleted, stepping further should not crash and burn (tm) */
group.step(1.5f, 0.5f);
CORRADE_COMPARE(group.runningCount(), 0);
}
void AnimableTest::debug() {
std::ostringstream o;
Debug(&o) << AnimationState::Running << AnimationState(0xbe);

Loading…
Cancel
Save