From: Adeel Kazmi Date: Tue, 29 Oct 2019 16:54:33 +0000 (+0000) Subject: (Animation) Ensure we do not adjust the current value when stopping an AnimateBy... X-Git-Tag: dali_1.4.44~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-core.git;a=commitdiff_plain;h=84c72db5ce4ddd3d2118ed669200c171a7ddc156 (Animation) Ensure we do not adjust the current value when stopping an AnimateBy animation - The issue was that when issuing a stop, we set the current value but we use that as the amount to adjust for an AnimateBy animation rather than a target. Change-Id: I49ab3a5d004dce5b18d747b9e7791df81d4aaddb --- diff --git a/automated-tests/src/dali/utc-Dali-Animation.cpp b/automated-tests/src/dali/utc-Dali-Animation.cpp index 179ac9b..addc288 100644 --- a/automated-tests/src/dali/utc-Dali-Animation.cpp +++ b/automated-tests/src/dali/utc-Dali-Animation.cpp @@ -13493,3 +13493,38 @@ int UtcDaliAnimationPlayFromWithLoopCount(void) END_TEST; } + +int UtcDaliAnimationCombineToAndByWithStop(void) +{ + tet_infoline( "Ensure the Y Position is not modified when animating the X position using AnimateTo and AnimateBy"); + + TestApplication application; + + auto actor = Actor::New(); + actor.SetPosition( 100.0f, 100.0f ); + Stage::GetCurrent().Add( actor ); + + auto animation = Animation::New( 1.0f ); + const float origY = actor.GetProperty( Actor::Property::POSITION_Y ).Get< float >(); + animation.AnimateTo( Property( actor, Actor::Property::POSITION ), Vector3( 150.0f, origY, 0.0f ), TimePeriod( 1.0f ) ); + animation.AnimateBy( Property( actor, Actor::Property::POSITION ), Vector3( -30.0f, 0.0f, 0.0f ), TimePeriod( 1.0f, 1.0f ) ); + animation.Play(); + + application.SendNotification(); + application.Render( 500 ); + + application.SendNotification(); + application.Render( 500 ); + + application.SendNotification(); + application.Render( 500 ); + + // Stop and clear the animation using the current values + animation.Stop(); + animation.Clear(); + + // Check the y position, it should be the same as before + DALI_TEST_EQUALS( actor.GetProperty( Actor::Property::POSITION_Y).Get< float >(), origY, TEST_LOCATION ); + + END_TEST; +} diff --git a/dali/internal/event/animation/animation-impl.cpp b/dali/internal/event/animation/animation-impl.cpp index ceab690..e82da5e 100644 --- a/dali/internal/event/animation/animation-impl.cpp +++ b/dali/internal/event/animation/animation-impl.cpp @@ -1114,8 +1114,8 @@ void Animation::NotifyObjects( Animation::Notify notifyValueType ) object->NotifyPropertyAnimation( *this, propertyIndex, - ( notifyValueType == Notify::USE_TARGET_VALUE ) ? iter->targetValue : object->GetCurrentProperty( propertyIndex ), - iter->animatorType ); + ( notifyValueType == Notify::USE_TARGET_VALUE ) ? iter->targetValue : object->GetCurrentProperty( propertyIndex ), + ( notifyValueType == Notify::USE_TARGET_VALUE ) ? iter->animatorType : Animation::TO ); // If we're setting the current value, then use TO as we want to set, not adjust, the current value } } }