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=f84726b3488c1675946ee8b7a841bcadebbb0ecf;hb=175d74ab98dd2f89726ce6594a08d65e0d01056f;hp=429145a8de196c86b113108af537b8373c06830a;hpb=bf663c68252f80cbf6066f9139e8f5c2430dd151;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 429145a..f84726b 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 @@ -21,16 +21,15 @@ // Don't want to include the actual window.h which otherwise will be indirectly included by adaptor.h. #define DALI_WINDOW_H -#include - -#include +#include +#include +#include #include #include #include #include #include -#include namespace Dali { @@ -96,11 +95,7 @@ Adaptor::~Adaptor() void Adaptor::Start( Dali::Window window ) { - if ( window ) - { - mWindows.push_back( window ); - mWindowCreatedSignal.Emit( window ); - } + AddWindow( &GetImplementation( window ) ); } Integration::Scene Adaptor::GetScene( Dali::Window window ) @@ -154,6 +149,70 @@ Dali::WindowContainer Adaptor::GetWindows() return windows; } +Dali::SceneHolderList Adaptor::GetSceneHolders() +{ + Dali::SceneHolderList sceneHolderList; + + for( auto iter = mWindows.begin(); iter != mWindows.end(); ++iter ) + { + sceneHolderList.push_back( Dali::Integration::SceneHolder( *iter ) ); + } + + return sceneHolderList; +} + +Dali::Internal::Adaptor::SceneHolder* Adaptor::GetWindow( Dali::Actor& actor ) +{ + Dali::Integration::Scene scene = Dali::Integration::Scene::Get( actor ); + + for( auto window : mWindows ) + { + if ( scene == window->GetScene() ) + { + return window; + } + } + + return nullptr; +} + +void Adaptor::AddWindow( Internal::Adaptor::SceneHolder* window ) +{ + if ( window ) + { + mWindows.push_back( window ); + + Dali::Integration::SceneHolder newWindow( window ); + mWindowCreatedSignal.Emit( newWindow ); + } +} + +void Adaptor::RemoveWindow( Internal::Adaptor::SceneHolder* window ) +{ + auto iter = std::find( mWindows.begin(), mWindows.end(), window ); + if( iter != mWindows.end() ) + { + mWindows.erase( iter ); + } +} + +void Adaptor::RegisterProcessor( Integration::Processor& processor ) +{ + Integration::Core& core = mTestApplication->GetCore(); + core.RegisterProcessor( processor ); +} + +void Adaptor::UnregisterProcessor( Integration::Processor& processor ) +{ + Integration::Core& core = mTestApplication->GetCore(); + core.UnregisterProcessor( processor ); +} + +void Adaptor::SetApplication( Dali::TestApplication& testApplication ) +{ + mTestApplication = &testApplication; +} + Dali::Adaptor::AdaptorSignalType& Adaptor::ResizedSignal() { return mResizedSignal; @@ -248,6 +307,11 @@ Dali::WindowContainer Adaptor::GetWindows() const return mImpl->GetWindows(); } +Dali::SceneHolderList Adaptor::GetSceneHolders() const +{ + return mImpl->GetSceneHolders(); +} + Any Adaptor::GetNativeWindowHandle() { Any window; @@ -301,24 +365,6 @@ void Adaptor::SceneCreated() { } -class LogFactory : public LogFactoryInterface -{ -public: - virtual void InstallLogFunction() const - { - Dali::Integration::Log::LogFunction logFunction(&ToolkitTestApplication::LogMessage); - Dali::Integration::Log::InstallLogFunction(logFunction); - } - - LogFactory() - { - } - virtual ~LogFactory() - { - } -}; - -LogFactory* gLogFactory = NULL; const LogFactoryInterface& Adaptor::GetLogFactory() { if( gLogFactory == NULL ) @@ -328,4 +374,14 @@ const LogFactoryInterface& Adaptor::GetLogFactory() return *gLogFactory; } +void Adaptor::RegisterProcessor( Integration::Processor& processor ) +{ + mImpl->RegisterProcessor( processor ); +} + +void Adaptor::UnregisterProcessor( Integration::Processor& processor ) +{ + mImpl->UnregisterProcessor( processor ); +} + } // namespace Dali