Browse Source

SceneGraph: restarting animation should allow the same repeat count.

Updated test to check that.
pull/7/head
Vladimír Vondruš 13 years ago
parent
commit
780228d0b8
  1. 4
      src/SceneGraph/Animable.hpp
  2. 15
      src/SceneGraph/Test/AnimableTest.cpp

4
src/SceneGraph/Animable.hpp

@ -80,10 +80,12 @@ template<std::uint8_t dimensions, class T> void AnimableGroup<dimensions, T>::st
CORRADE_INTERNAL_ASSERT(animable->previousState == animable->currentState);
continue;
/* The animation was started recently, set start time to previous frame time */
/* The animation was started recently, set start time to previous frame
time, reset repeat count */
} else if(animable->previousState == AnimationState::Stopped) {
animable->previousState = AnimationState::Running;
animable->startTime = time;
animable->repeats = 0;
++_runningCount;
animable->animationStarted();

15
src/SceneGraph/Test/AnimableTest.cpp

@ -266,6 +266,21 @@ void AnimableTest::repeat() {
group.step(33.0f, 0.5f);
CORRADE_COMPARE(animable.state(), AnimationState::Stopped);
CORRADE_COMPARE(animable.time, 4.5f);
/* Starting the animation again, should be repeatable again */
animable.setState(AnimationState::Running);
/* Three animation repeats */
group.step(1.0f, 0.5f);
CORRADE_COMPARE(animable.state(), AnimationState::Running);
group.step(11.5f, 0.5f);
CORRADE_COMPARE(animable.state(), AnimationState::Running);
group.step(25.5f, 0.5f);
CORRADE_COMPARE(animable.state(), AnimationState::Running);
/* Should be stopped now */
group.step(33.0f, 0.5f);
CORRADE_COMPARE(animable.state(), AnimationState::Stopped);
}
void AnimableTest::stop() {

Loading…
Cancel
Save