(AnimatedVectorImage) Ensure the progress is kept according to actions 54/202654/2
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 2 Apr 2019 07:48:24 +0000 (16:48 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Thu, 4 Apr 2019 03:57:34 +0000 (12:57 +0900)
Change-Id: Ifdda34f50d1da431c4e2459ef8619cc572644beb

automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp
dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.cpp

index d2e6332..01716ed 100644 (file)
@@ -648,6 +648,29 @@ int UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress(void)
   value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
   DALI_TEST_EQUALS( value->Get< float >(), 0.4f, TEST_LOCATION );
 
   value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
   DALI_TEST_EQUALS( value->Get< float >(), 0.4f, TEST_LOCATION );
 
+  // Change play range
+  attributes.Clear();
+  attributes.Add( DevelImageVisual::Property::PLAY_RANGE, Vector2( 0.0f, 1.0f ) );
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+  attributes.Clear();
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+  application.SendNotification();
+  application.Render();
+
+  // Stop and jump to 0.2
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::STOP, attributes );
+
+  DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 0.2f );
+
+  application.SendNotification();
+  application.Render();
+
+  map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+  value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
+  DALI_TEST_EQUALS( value->Get< float >(), 0.2f, TEST_LOCATION );
+
   END_TEST;
 }
 
   END_TEST;
 }
 
index da46e1e..25d0743 100644 (file)
@@ -158,6 +158,9 @@ void VectorRasterizeThread::StopAnimation()
   {
     mPlayState = DevelImageVisual::PlayState::STOPPED;
 
   {
     mPlayState = DevelImageVisual::PlayState::STOPPED;
 
+    mCurrentFrame = mStartFrame;
+    mCurrentFrameUpdated = true;
+
     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StopAnimation: Stop\n" );
   }
 }
     DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StopAnimation: Stop\n" );
   }
 }
@@ -332,8 +335,7 @@ void VectorRasterizeThread::Rasterize()
 
       if( mPlayState == DevelImageVisual::PlayState::STOPPED )
       {
 
       if( mPlayState == DevelImageVisual::PlayState::STOPPED )
       {
-        // Reset the current frame and the current loop
-        mCurrentFrame = mStartFrame;
+        // Reset the current loop
         mCurrentLoop = 0;
       }
       mConditionalWait.Wait( lock );
         mCurrentLoop = 0;
       }
       mConditionalWait.Wait( lock );