[Tizen] Do not call NotifyObjects in case of finished animations 86/252486/1 accepted/tizen/6.0/unified/20210205.032610 submit/tizen_6.0/20210129.011613 submit/tizen_6.0/20210129.074737 submit/tizen_6.0/20210204.105950
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 28 Jan 2021 04:35:15 +0000 (13:35 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Fri, 29 Jan 2021 00:13:04 +0000 (09:13 +0900)
Change-Id: Iaa0f7d0dca73fdfd672a869d83a899ff8755a992

automated-tests/src/dali/utc-Dali-Animation.cpp
dali/internal/event/animation/animation-impl.cpp

index 7c229c0..d453600 100644 (file)
@@ -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<unsigned int>(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<Vector3>(), 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<unsigned int>(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<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
+
+  // Clear the first animation after finished
+  animation1.Clear();
+
+  application.SendNotification();
+  application.Render(static_cast<unsigned int>(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<Vector3>(), targetPosition2, VECTOR3_EPSILON, TEST_LOCATION);
+
+  END_TEST;
+}
+
 int UtcDaliAnimationPausePropertyValue(void)
 {
   const float   durationSeconds(1.0f);
   unsigned int  halfAnimationDuration(static_cast<unsigned int>(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);
 
index 0a05d70..f1f981f 100644 (file)
@@ -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 );
   }