X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali-toolkit%2Fdali-toolkit-test-utils%2Ftoolkit-adaptor.cpp;h=4b25c5da0f4e9ea71e35a349ab532c92b7009921;hb=0ade1ea02b460b002d9cd82cd3023a5107eb6294;hp=ebab526f12bcc6b474f5f78fedfd6c562a94a166;hpb=f4f74e774495b9c798c86e5697fe84db6decc327;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp index ebab526..4b25c5d 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -19,73 +19,24 @@ #include #include -#include -namespace Dali -{ - -class EglInterface; -class DisplayConnection; -class ThreadSynchronizationInterface; - -namespace Integration -{ +#include -class GlAbstraction; - -} // namespace Integration - -class TestRenderSurface : public RenderSurface +namespace Dali { -public: - virtual PositionSize GetPositionSize() const { PositionSize size; return size; } - - virtual void InitializeEgl( EglInterface& egl ) {} - - virtual void CreateEglSurface( EglInterface& egl ) {} - - virtual void DestroyEglSurface( EglInterface& egl ) {} - - virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; } - - virtual void MoveResize( Dali::PositionSize positionSize ) {} - - virtual void SetViewMode( ViewMode viewMode ) {} - - virtual void StartRender() {} - - virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; } - - virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {} - - virtual void StopRender() {} - - virtual void ReleaseLock() {} - - virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {} - -}; namespace Internal { namespace Adaptor { -class Adaptor: public BaseObject -{ -public: - static Dali::Adaptor& Get(); - Adaptor(); - ~Adaptor(); - -public: - static Dali::RenderSurface& GetSurface(); - static Dali::Adaptor::AdaptorSignalType& AdaptorSignal(); -}; +bool Adaptor::mAvailable = false; +Vector Adaptor::mCallbacks = Vector(); Dali::Adaptor& Adaptor::Get() { Dali::Adaptor* adaptor = new Dali::Adaptor; + Adaptor::mAvailable = true; return *adaptor; } @@ -101,12 +52,8 @@ Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal() return *signal; } -} -} -} - -namespace Dali -{ +} // namespace Adaptor +} // namespace Internal Adaptor& Adaptor::New( Window window ) { @@ -150,7 +97,34 @@ void Adaptor::Stop() bool Adaptor::AddIdle( CallbackBase* callback ) { - return false; + const bool isAvailable = IsAvailable(); + + if( isAvailable ) + { + Internal::Adaptor::Adaptor::mCallbacks.PushBack( callback ); + } + + return isAvailable; +} + +void Adaptor::RemoveIdle( CallbackBase* callback ) +{ + const bool isAvailable = IsAvailable(); + + if( isAvailable ) + { + for( Vector::Iterator it = Internal::Adaptor::Adaptor::mCallbacks.Begin(), + endIt = Internal::Adaptor::Adaptor::mCallbacks.End(); + it != endIt; + ++it ) + { + if( callback == *it ) + { + Internal::Adaptor::Adaptor::mCallbacks.Remove( it ); + return; + } + } + } } void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface ) @@ -197,7 +171,7 @@ Adaptor& Adaptor::Get() bool Adaptor::IsAvailable() { - return false; + return Internal::Adaptor::Adaptor::mAvailable; } void Adaptor::NotifySceneCreated()