Browse Source

SceneGraph: animationStopped() should be called after duration is exceeded.

The test currently fails.
pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
8d71d12187
  1. 11
      src/SceneGraph/Test/AnimableTest.cpp

11
src/SceneGraph/Test/AnimableTest.cpp

@ -144,11 +144,20 @@ class OneShotAnimable: public SceneGraph::Animable<3> {
} }
GLfloat time; GLfloat time;
std::string stateChanges;
protected: protected:
void animationStep(GLfloat time, GLfloat) override { void animationStep(GLfloat time, GLfloat) override {
this->time = time; this->time = time;
} }
void animationStarted() override {
stateChanges += "started;";
}
void animationStopped() override {
stateChanges += "stopped;";
}
}; };
void AnimableTest::step() { void AnimableTest::step() {
@ -199,12 +208,14 @@ void AnimableTest::duration() {
running and animationStep() is called */ running and animationStep() is called */
group.step(1.0f, 0.5f); group.step(1.0f, 0.5f);
CORRADE_COMPARE(animable.state(), AnimationState::Running); CORRADE_COMPARE(animable.state(), AnimationState::Running);
CORRADE_COMPARE(animable.stateChanges, "started;");
CORRADE_COMPARE(animable.time, 0.0f); CORRADE_COMPARE(animable.time, 0.0f);
/* Next animation step is out of duration and repeat is not enabled, /* Next animation step is out of duration and repeat is not enabled,
animationStep() shouldn't be called and animation should be stopped */ animationStep() shouldn't be called and animation should be stopped */
group.step(12.75f, 0.5f); group.step(12.75f, 0.5f);
CORRADE_COMPARE(animable.state(), AnimationState::Stopped); CORRADE_COMPARE(animable.state(), AnimationState::Stopped);
CORRADE_COMPARE(animable.stateChanges, "started;stopped;");
CORRADE_COMPARE(animable.time, 0.0f); CORRADE_COMPARE(animable.time, 0.0f);
} }

Loading…
Cancel
Save