(Vector) Call Finalize method instead of deleting VectorRenderer
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-vector-animation-renderer.cpp
index 8e856bb..b039c57 100755 (executable)
@@ -37,8 +37,20 @@ public:
     mRenderer(),
     mWidth( 0 ),
     mHeight( 0 ),
-    mPreviousFrame( 0 )
+    mPreviousFrame( 0 ),
+    mFrameRate( 60.0f )
   {
+    mCount++;
+
+    if( mCount == 2 )
+    {
+      mFrameRate = 0.1f;
+    }
+  }
+
+  ~VectorAnimationRenderer()
+  {
+    mCount--;
   }
 
   void SetRenderer( Dali::Renderer renderer )
@@ -50,6 +62,7 @@ public:
       Dali::TextureSet textureSet = mRenderer.GetTextures();
       Dali::Texture texture = Dali::Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, mWidth, mHeight );
       textureSet.SetTexture( 0, texture );
+      mUploadCompletedSignal.Emit();
     }
   }
 
@@ -63,13 +76,10 @@ public:
       Dali::TextureSet textureSet = mRenderer.GetTextures();
       Dali::Texture texture = Dali::Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, mWidth, mHeight );
       textureSet.SetTexture( 0, texture );
+      mUploadCompletedSignal.Emit();
     }
   }
 
-  void StopRender()
-  {
-  }
-
   bool Render( uint32_t frameNumber )
   {
     if( frameNumber == 1 && mPreviousFrame != frameNumber )
@@ -89,7 +99,7 @@ public:
 
   float GetFrameRate() const
   {
-    return 60.0f;
+    return mFrameRate;
   }
 
   void GetDefaultSize( uint32_t& width, uint32_t& height ) const
@@ -98,15 +108,26 @@ public:
     height = 100;
   }
 
+  Dali::VectorAnimationRenderer::UploadCompletedSignalType& UploadCompletedSignal()
+  {
+    return mUploadCompletedSignal;
+  }
+
 public:
 
+  static uint32_t mCount;
+
   std::string mUrl;
   Dali::Renderer mRenderer;
   uint32_t mWidth;
   uint32_t mHeight;
   uint32_t mPreviousFrame;
+  float mFrameRate;
+  Dali::VectorAnimationRenderer::UploadCompletedSignalType mUploadCompletedSignal;
 };
 
+uint32_t VectorAnimationRenderer::mCount = 0;
+
 inline VectorAnimationRenderer& GetImplementation( Dali::VectorAnimationRenderer& renderer )
 {
   DALI_ASSERT_ALWAYS( renderer && "VectorAnimationRenderer handle is empty." );
@@ -161,6 +182,10 @@ VectorAnimationRenderer& VectorAnimationRenderer::operator=( const VectorAnimati
   return *this;
 }
 
+void VectorAnimationRenderer::Finalize()
+{
+}
+
 void VectorAnimationRenderer::SetRenderer( Renderer renderer )
 {
   Internal::Adaptor::GetImplementation( *this ).SetRenderer( renderer );
@@ -171,11 +196,6 @@ void VectorAnimationRenderer::SetSize( uint32_t width, uint32_t height )
   Internal::Adaptor::GetImplementation( *this ).SetSize( width, height );
 }
 
-void VectorAnimationRenderer::StopRender()
-{
-  Internal::Adaptor::GetImplementation( *this ).StopRender();
-}
-
 bool VectorAnimationRenderer::Render( uint32_t frameNumber )
 {
   return Internal::Adaptor::GetImplementation( *this ).Render( frameNumber );
@@ -196,5 +216,14 @@ void VectorAnimationRenderer::GetDefaultSize( uint32_t& width, uint32_t& height
   Internal::Adaptor::GetImplementation( *this ).GetDefaultSize( width, height );
 }
 
+void VectorAnimationRenderer::GetLayerInfo( Property::Map& map ) const
+{
+}
+
+VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal()
+{
+  return Internal::Adaptor::GetImplementation( *this ).UploadCompletedSignal();
+}
+
 } // namespace Dali;