{
}
- void operator()(Animation& animation)
+ void operator()()
{
mSignalReceived = true;
}
bool signalReceived(false);
AnimationFinishCheck finishCheck(signalReceived);
- animation.FinishedSignal().Connect(&application, finishCheck);
+ // use the handle API to connect the signal
+ animation.ConnectSignal( &application, "finished", finishCheck );
+ // just for coverage connect to non-existant signal as well
+ animation.ConnectSignal( &application, "foo", finishCheck );
+ DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) /* half of time */);
+ DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+
+ // pause
+ animationObject.DoAction("pause", attributes);
+ application.SendNotification();
+ application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) + 1u/*just beyond the animation duration*/);
+ DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+ // continue
+ animationObject.DoAction("play", attributes);
application.SendNotification();
- application.Render(static_cast<unsigned int>(newDurationSeconds * 1000.0f) + 1u/*just beyond the animation duration*/);
+ application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) + 1u/*just beyond the animation duration*/);
// We expect the animation to finish
application.SendNotification();
finishCheck.CheckSignalReceived();
DALI_TEST_EQUALS( actor.GetCurrentPosition(), targetPosition, TEST_LOCATION );
+ // play again
+ signalReceived = false;
+ animationObject.DoAction("play", attributes);
+ DALI_TEST_EQUALS(animation.GetCurrentProgress(), 0.f, TEST_LOCATION);
+ application.SendNotification();
+ application.Render(static_cast<uint32_t>(newDurationSeconds * 500.0f) /* half of time */);
+ animationObject.DoAction("stop", attributes);
+ application.SendNotification();
+ application.Render(static_cast<uint32_t>(newDurationSeconds * 1000.0f) /* full time */);
+ DALI_TEST_EQUALS( signalReceived, false, TEST_LOCATION );
+
// Check the new animation duration is 2 seconds
DALI_TEST_EQUALS(animation.GetDuration(), newDurationSeconds, TEST_LOCATION);
END_TEST;
bool Animation::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
- bool connected( true );
+ bool connected( false );
Animation* animation = static_cast< Animation* >(object); // TypeRegistry guarantees that this is the correct type.
if( 0 == signalName.compare( SIGNAL_FINISHED ) )
{
animation->FinishedSignal().Connect( tracker, functor );
- }
- else
- {
- // signalName does not match any signal
- connected = false;
+ connected = true;
}
return connected;
float Animation::GetCurrentProgress()
{
- if( mAnimation )
+ float progress = 0.f;
+ if( mAnimation ) // always exists in practice
{
- return mAnimation->GetCurrentProgress();
+ progress = mAnimation->GetCurrentProgress();
}
- return 0.0f;
+ return progress;
}
void Animation::ExtendDuration( const TimePeriod& timePeriod )