(Vector) Fix random tc failure 81/260581/1
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 29 Jun 2021 08:48:59 +0000 (17:48 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 29 Jun 2021 08:48:59 +0000 (17:48 +0900)
Change-Id: Ie1bfd1aa3c745bc445b4b1c1bcd7cbf6af8cb10b

automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
automated-tests/src/dali-toolkit/utc-Dali-AnimatedVectorImageVisual.cpp

index 33a27b5..2ccf2c1 100755 (executable)
@@ -52,6 +52,7 @@ public:
     mDelayTime(0),
     mDroppedFrames(0),
     mFrameRate( 60.0f ),
     mDelayTime(0),
     mDroppedFrames(0),
     mFrameRate( 60.0f ),
+    mTestFrameDrop(false),
     mNeedDroppedFrames(false),
     mEventThreadCallback( new EventThreadCallback( MakeCallback( this, &VectorAnimationRenderer::OnTriggered ) ) )
   {
     mNeedDroppedFrames(false),
     mEventThreadCallback( new EventThreadCallback( MakeCallback( this, &VectorAnimationRenderer::OnTriggered ) ) )
   {
@@ -79,6 +80,7 @@ public:
     {
       // Change total frame number for test
       mTotalFrameNumber = 200;
     {
       // Change total frame number for test
       mTotalFrameNumber = 200;
+      mTestFrameDrop = true;
     }
     return true;
   }
     }
     return true;
   }
@@ -112,10 +114,10 @@ public:
 
   bool Render( uint32_t frameNumber )
   {
 
   bool Render( uint32_t frameNumber )
   {
-    if(mDelayTime != 0)
+    if(mTestFrameDrop)
     {
       std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int32_t>(mDelayTime)));
     {
       std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int32_t>(mDelayTime)));
-      mDelayTime = 0;
+      mTestFrameDrop = false;
       mNeedDroppedFrames = true;
     }
     else if(mNeedDroppedFrames)
       mNeedDroppedFrames = true;
     }
     else if(mNeedDroppedFrames)
@@ -199,6 +201,7 @@ public:
   uint32_t mDelayTime;
   uint32_t mDroppedFrames;
   float mFrameRate;
   uint32_t mDelayTime;
   uint32_t mDroppedFrames;
   float mFrameRate;
+  bool mTestFrameDrop;
   bool mNeedDroppedFrames;
   Dali::VectorAnimationRenderer::UploadCompletedSignalType mUploadCompletedSignal;
   std::unique_ptr< EventThreadCallback > mEventThreadCallback;
   bool mNeedDroppedFrames;
   Dali::VectorAnimationRenderer::UploadCompletedSignalType mUploadCompletedSignal;
   std::unique_ptr< EventThreadCallback > mEventThreadCallback;
index d2be632..4c5bdad 100644 (file)
@@ -1596,18 +1596,19 @@ int UtcDaliAnimatedVectorImageVisualFrameDrops(void)
   Property::Map attributes;
   DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
 
   Property::Map attributes;
   DevelControl::DoAction(actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes);
 
+  // Make delay to drop frames
+  Test::VectorAnimationRenderer::DelayRendering(170); // longer than 16.6 * 10frames
+
   application.SendNotification();
   application.Render();
 
   // Trigger count is 1 - render the first frame
   DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
 
   application.SendNotification();
   application.Render();
 
   // Trigger count is 1 - render the first frame
   DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
 
-  // Make delay to drop frames
-  Test::VectorAnimationRenderer::DelayRendering(170); // longer than 16.6 * 10frames
-
-  // Check dropped frame
+  // Wait for calculating frame drops
   DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
 
   DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
 
+  // Check dropped frame
   uint32_t frames = Test::VectorAnimationRenderer::GetDroppedFrames();
   DALI_TEST_CHECK(frames >= 9);
 
   uint32_t frames = Test::VectorAnimationRenderer::GetDroppedFrames();
   DALI_TEST_CHECK(frames >= 9);