X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-vector-animation-renderer.cpp;h=b039c5780751c7302c31df142449e9877fff7edb;hp=869bbc2bdbba93e6483d63cb00466156073cfff5;hb=374298ffaa32c7c4bef9ba379d366e33588529c4;hpb=e42dc155f49bacd9635433efafcfe3004392ddcf diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp index 869bbc2..b039c57 100755 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,53 +36,98 @@ public: : mUrl( url ), mRenderer(), mWidth( 0 ), - mHeight( 0 ) + mHeight( 0 ), + mPreviousFrame( 0 ), + mFrameRate( 60.0f ) { + mCount++; + + if( mCount == 2 ) + { + mFrameRate = 0.1f; + } + } + + ~VectorAnimationRenderer() + { + mCount--; } void SetRenderer( Dali::Renderer renderer ) { mRenderer = renderer; + + if( mWidth != 0 && mHeight != 0 ) + { + 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 SetSize( uint32_t width, uint32_t height ) { mWidth = width; mHeight = height; + + if( mRenderer ) + { + Dali::TextureSet textureSet = mRenderer.GetTextures(); + Dali::Texture texture = Dali::Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, mWidth, mHeight ); + textureSet.SetTexture( 0, texture ); + mUploadCompletedSignal.Emit(); + } } - bool StartRender() + bool Render( uint32_t frameNumber ) { + if( frameNumber == 1 && mPreviousFrame != frameNumber ) + { + mPreviousFrame = frameNumber; + // For test corverage + return false; + } + mPreviousFrame = frameNumber; return true; } - void StopRender() + uint32_t GetTotalFrameNumber() const { + return 5; } - void Render( uint32_t frameNumber ) + float GetFrameRate() const { + return mFrameRate; } - uint32_t GetTotalFrameNumber() const + void GetDefaultSize( uint32_t& width, uint32_t& height ) const { - return 5; + width = 100; + height = 100; } - float GetFrameRate() const + Dali::VectorAnimationRenderer::UploadCompletedSignalType& UploadCompletedSignal() { - return 60.0f; + 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." ); @@ -137,6 +182,10 @@ VectorAnimationRenderer& VectorAnimationRenderer::operator=( const VectorAnimati return *this; } +void VectorAnimationRenderer::Finalize() +{ +} + void VectorAnimationRenderer::SetRenderer( Renderer renderer ) { Internal::Adaptor::GetImplementation( *this ).SetRenderer( renderer ); @@ -147,29 +196,33 @@ void VectorAnimationRenderer::SetSize( uint32_t width, uint32_t height ) Internal::Adaptor::GetImplementation( *this ).SetSize( width, height ); } -bool VectorAnimationRenderer::StartRender() +bool VectorAnimationRenderer::Render( uint32_t frameNumber ) +{ + return Internal::Adaptor::GetImplementation( *this ).Render( frameNumber ); +} + +uint32_t VectorAnimationRenderer::GetTotalFrameNumber() const { - return Internal::Adaptor::GetImplementation( *this ).StartRender(); + return Internal::Adaptor::GetImplementation( *this ).GetTotalFrameNumber(); } -void VectorAnimationRenderer::StopRender() +float VectorAnimationRenderer::GetFrameRate() const { - Internal::Adaptor::GetImplementation( *this ).StopRender(); + return Internal::Adaptor::GetImplementation( *this ).GetFrameRate(); } -void VectorAnimationRenderer::Render( uint32_t frameNumber ) +void VectorAnimationRenderer::GetDefaultSize( uint32_t& width, uint32_t& height ) const { - Internal::Adaptor::GetImplementation( *this ).Render( frameNumber ); + Internal::Adaptor::GetImplementation( *this ).GetDefaultSize( width, height ); } -uint32_t VectorAnimationRenderer::GetTotalFrameNumber() const +void VectorAnimationRenderer::GetLayerInfo( Property::Map& map ) const { - return Internal::Adaptor::GetImplementation( *this ).GetTotalFrameNumber(); } -float VectorAnimationRenderer::GetFrameRate() const +VectorAnimationRenderer::UploadCompletedSignalType& VectorAnimationRenderer::UploadCompletedSignal() { - return Internal::Adaptor::GetImplementation( *this ).GetFrameRate(); + return Internal::Adaptor::GetImplementation( *this ).UploadCompletedSignal(); } } // namespace Dali;