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-adaptor.cpp;h=dcf0560ab189ec2c1c875ab5c78f34ec5c24523e;hp=4e884e0ee73e85f48f94bc6b21314c104f6c29cb;hb=65194fe250e7933d0cd4896a41cccb905f098881;hpb=600d7859cddf8ee59d6ddd49002af5fc99e48bf8 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 4e884e0..dcf0560 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) 2017 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,74 +19,26 @@ #include #include -#include -namespace Dali -{ - -class EglInterface; -class DisplayConnection; -class ThreadSynchronizationInterface; - -namespace Integration -{ - -class GlAbstraction; +#include +#include +#include -} // 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 ) {} - - virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::ECORE_RENDER_SURFACE; } -}; 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; } @@ -102,12 +54,8 @@ Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal() return *signal; } -} -} -} - -namespace Dali -{ +} // namespace Adaptor +} // namespace Internal Adaptor& Adaptor::New( Window window ) { @@ -149,9 +97,36 @@ void Adaptor::Stop() { } -bool Adaptor::AddIdle( CallbackBase* callback ) +bool Adaptor::AddIdle( CallbackBase* callback, bool hasReturnValue ) +{ + const bool isAvailable = IsAvailable(); + + if( isAvailable ) + { + Internal::Adaptor::Adaptor::mCallbacks.PushBack( callback ); + } + + return isAvailable; +} + +void Adaptor::RemoveIdle( CallbackBase* callback ) { - return false; + 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 ) @@ -198,7 +173,7 @@ Adaptor& Adaptor::Get() bool Adaptor::IsAvailable() { - return false; + return Internal::Adaptor::Adaptor::mAvailable; } void Adaptor::NotifySceneCreated() @@ -229,12 +204,31 @@ void Adaptor::SceneCreated() { } -void Adaptor::SetViewMode( ViewMode mode ) +class LogFactory : public LogFactoryInterface { -} +public: + virtual void InstallLogFunction() const + { + Dali::Integration::Log::LogFunction logFunction(&TestApplication::LogMessage); + Dali::Integration::Log::InstallLogFunction(logFunction); + } + + LogFactory() + { + } + virtual ~LogFactory() + { + } +}; -void Adaptor::SetStereoBase( float stereoBase ) +LogFactory* gLogFactory = NULL; +const LogFactoryInterface& Adaptor::GetLogFactory() { + if( gLogFactory == NULL ) + { + gLogFactory = new LogFactory; + } + return *gLogFactory; } Adaptor::Adaptor()