From e91f718bfc41f60ae524fe125f4120cf1efcd65c Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Thu, 28 Jan 2021 13:35:15 +0900 Subject: [PATCH] [Tizen] Do not call NotifyObjects in case of finished animations Change-Id: Iaa0f7d0dca73fdfd672a869d83a899ff8755a992 --- automated-tests/src/dali/utc-Dali-Animation.cpp | 51 +++++++++++++++++++++++- dali/internal/event/animation/animation-impl.cpp | 2 +- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index 7c229c0..d453600 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -13653,17 +13653,64 @@ int UtcDaliAnimationStopPropertyValue(void) END_TEST; } -int UtcDaliAnimationClearPropertyValue(void) +int UtcDaliAnimationClearPropertyValue01(void) { CheckPropertyValuesWhenCallingAnimationMethod(TestFunction::CLEAR, "UtcDaliAnimationStopPropertyValue"); END_TEST; } +int UtcDaliAnimationClearPropertyValue02(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + application.GetScene().Add(actor); + + const float durationSeconds(1.0f); + const Vector3 targetPosition1(10.0f, 10.0f, 10.0f); + const Vector3 targetPosition2(20.0f, 20.0f, 20.0f); + + // Build the animation + Animation animation1 = Animation::New(durationSeconds); + animation1.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition1, AlphaFunction::LINEAR); + animation1.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/); + + // The event side property should be set the current value immediately + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), targetPosition1, VECTOR3_EPSILON, TEST_LOCATION); + + application.SendNotification(); + application.Render(2u /*just beyond the animation duration*/); + + // Build a new animation + Animation animation2 = Animation::New(durationSeconds); + animation2.AnimateTo(Property(actor, Actor::Property::POSITION), targetPosition2, AlphaFunction::LINEAR); + animation2.Play(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/); + + // The event side property should be set the current value immediately + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION); + + // Clear the first animation after finished + animation1.Clear(); + + application.SendNotification(); + application.Render(static_cast(durationSeconds * 1000.0f) - 1u /*just less than the animation duration*/); + + // The property should not be changed. + DALI_TEST_EQUALS(actor.GetProperty(Actor::Property::POSITION).Get(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION); + + END_TEST; +} + int UtcDaliAnimationPausePropertyValue(void) { const float durationSeconds(1.0f); unsigned int halfAnimationDuration(static_cast(durationSeconds * 1000.0f * 0.5f)); - const Vector3 originalPosition(Vector3::ZERO); const Vector3 targetPosition(10.0f, 10.0f, 10.0f); const Vector3 halfWayToTarget(targetPosition * 0.5f); diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index 0a05d70..f1f981f 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -386,7 +386,7 @@ void Animation::Clear() DALI_ASSERT_DEBUG(mAnimation); // Only notify the objects with the current values if the end action is set to BAKE - if( mEndAction == EndAction::BAKE ) + if(mEndAction == EndAction::BAKE && mState != Dali::Animation::STOPPED) { NotifyObjects( Notify::USE_CURRENT_VALUE ); } -- 2.7.4