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=ebab526f12bcc6b474f5f78fedfd6c562a94a166;hp=c27157d0b45f3956d2ba781fe2b1b7d5a9e3cabb;hb=fd9780b06023ca21988b0913c6539b733491c6e1;hpb=fa6279fb2830427d5ab569ca14e6ade1557ef2fa 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 c27157d..ebab526 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,263 +1,244 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#define __DALI_ADAPTOR_H__ -#define __DALI_ACCESSIBILITY_MANAGER_H__ -#define __DALI_TIMER_H__ -#define __DALI_CLIPBOARD_H__ -#define IMFMANAGER_H - -#include "toolkit-adaptor.h" -#include -#include -#include +/* + * Copyright (c) 2014 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +#include +#include namespace Dali { -//////////////////////////////////////////////////////////////////////////////////////////////////// +class EglInterface; +class DisplayConnection; +class ThreadSynchronizationInterface; -class TestRenderSurface : public RenderSurface +namespace Integration { -public: - TestRenderSurface(){} - virtual ~TestRenderSurface(){} - virtual SurfaceType GetType() { return RenderSurface::WINDOW; } - virtual Dali::Any GetSurface() { return Dali::Any(); } - virtual Dali::Any GetDisplay() { return Dali::Any(); } - virtual PositionSize GetPositionSize() const { return PositionSize(0, 0, 640, 480);} - virtual void SetRenderMode(RenderMode mode){} - virtual RenderMode GetRenderMode() const { return RenderSurface::RENDER_60FPS; } -}; -typedef Dali::Rect PositionSize; +class GlAbstraction; -/** - * Stub for the Adaptor - */ -class Adaptor +} // namespace Integration + +class TestRenderSurface : public RenderSurface { public: + virtual PositionSize GetPositionSize() const { PositionSize size; return size; } - typedef SignalV2< void ( Adaptor& ) > AdaptorSignalV2; + virtual void InitializeEgl( EglInterface& egl ) {} - typedef std::pair SingletonPair; - typedef std::map SingletonContainer; - typedef SingletonContainer::const_iterator SingletonConstIter; + virtual void CreateEglSurface( EglInterface& egl ) {} -public: + virtual void DestroyEglSurface( EglInterface& egl ) {} - Adaptor(ToolkitAdaptor& toolkitAdaptor); - ~Adaptor(); + virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; } -public: + virtual void MoveResize( Dali::PositionSize positionSize ) {} - void Start(); - void Pause(); - void Resume(); - void Stop(); - bool AddIdle(boost::function callBack); - void FeedEvent(TouchPoint& point, int timeStamp); - bool MoveResize(const PositionSize& positionSize); - void SurfaceResized(const PositionSize& positionSize); - void ReplaceSurface(RenderSurface& surface); - void RenderSync(); - RenderSurface& GetSurface(); + virtual void SetViewMode( ViewMode viewMode ) {} - void RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton); - Dali::BaseHandle GetSingleton(const std::type_info& info) const; + virtual void StartRender() {} -public: // static methods - static Adaptor& Get(); - static bool IsAvailable(); + virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; } -public: // Signals + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {} - AdaptorSignalV2& SignalResize(); + virtual void StopRender() {} - void EmitSignalResize() - { - mResizeSignal.Emit( *this ); - } + virtual void ReleaseLock() {} -private: + virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {} - // Undefined - Adaptor(const Adaptor&); - Adaptor& operator=(Adaptor&); +}; - AdaptorSignalV2 mResizeSignal; - TestRenderSurface mRenderSurface; - ToolkitAdaptor& mToolkitAdaptor; +namespace Internal +{ +namespace Adaptor +{ - SingletonContainer mSingletonContainer; +class Adaptor: public BaseObject +{ +public: + static Dali::Adaptor& Get(); + Adaptor(); + ~Adaptor(); + +public: + static Dali::RenderSurface& GetSurface(); + static Dali::Adaptor::AdaptorSignalType& AdaptorSignal(); }; -namespace +Dali::Adaptor& Adaptor::Get() { -Adaptor* gAdaptor = NULL; + Dali::Adaptor* adaptor = new Dali::Adaptor; + return *adaptor; +} +Dali::RenderSurface& Adaptor::GetSurface() +{ + Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface; + return *renderSurface; } -Adaptor::Adaptor(ToolkitAdaptor& toolkitAdaptor) -: mToolkitAdaptor(toolkitAdaptor) +Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal() { + Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType; + return *signal; } -Adaptor::~Adaptor() +} +} +} + +namespace Dali { +Adaptor& Adaptor::New( Window window ) +{ + return Internal::Adaptor::Adaptor::Get(); +} + +Adaptor& Adaptor::New( Window window, Configuration::ContextLoss configuration ) +{ + return Internal::Adaptor::Adaptor::Get(); +} + +Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface ) +{ + return Internal::Adaptor::Adaptor::Get(); +} + +Adaptor& Adaptor::New( Any nativeWindow, const Dali::RenderSurface& surface, Configuration::ContextLoss configuration ) +{ + return Internal::Adaptor::Adaptor::Get(); +} + +Adaptor::~Adaptor() +{ } void Adaptor::Start() { - mToolkitAdaptor.mFunctionsCalled.Start = true; } void Adaptor::Pause() { - mToolkitAdaptor.mFunctionsCalled.Pause = true; } void Adaptor::Resume() { - mToolkitAdaptor.mFunctionsCalled.Resume = true; } void Adaptor::Stop() { - mToolkitAdaptor.mFunctionsCalled.Stop = true; } -bool Adaptor::AddIdle(boost::function callBack) +bool Adaptor::AddIdle( CallbackBase* callback ) { - mToolkitAdaptor.mFunctionsCalled.AddIdle = true; - mToolkitAdaptor.mLastIdleAdded = callBack; - return true; + return false; } -void Adaptor::FeedEvent(TouchPoint& point, int timeStamp) +void Adaptor::ReplaceSurface( Any nativeWindow, Dali::RenderSurface& surface ) { - mToolkitAdaptor.mFunctionsCalled.FeedEvent = true; - mToolkitAdaptor.mLastTouchPointFed = point; - mToolkitAdaptor.mLastTimeStampFed = timeStamp; } -bool Adaptor::MoveResize(const PositionSize& positionSize) +Adaptor::AdaptorSignalType& Adaptor::ResizedSignal() { - mToolkitAdaptor.mFunctionsCalled.MoveResize = true; - mToolkitAdaptor.mLastSizeSet = positionSize; - return true; + return Internal::Adaptor::Adaptor::AdaptorSignal(); } -void Adaptor::SurfaceResized(const PositionSize& positionSize) +Adaptor::AdaptorSignalType& Adaptor::LanguageChangedSignal() { - mToolkitAdaptor.mFunctionsCalled.SurfaceResized = true; - mToolkitAdaptor.mLastSizeSet = positionSize; + return Internal::Adaptor::Adaptor::AdaptorSignal(); } -void Adaptor::ReplaceSurface(RenderSurface& surface) +RenderSurface& Adaptor::GetSurface() { - mToolkitAdaptor.mFunctionsCalled.ReplaceSurface = true; + return Internal::Adaptor::Adaptor::GetSurface(); } -void Adaptor::RenderSync() +Any Adaptor::GetNativeWindowHandle() { - mToolkitAdaptor.mFunctionsCalled.RenderSync = true; + Any window; + return window; } -RenderSurface& Adaptor::GetSurface() +void Adaptor::ReleaseSurfaceLock() { - mToolkitAdaptor.mFunctionsCalled.GetSurface = true; - return mRenderSurface; } -Adaptor& Adaptor::Get() +void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ) { - DALI_ASSERT_ALWAYS(gAdaptor); - gAdaptor->mToolkitAdaptor.mFunctionsCalled.Get = true; - return *gAdaptor; } -bool Adaptor::IsAvailable() +void Adaptor::SetUseHardwareVSync(bool useHardware) { - bool available(false); - - if (gAdaptor) - { - gAdaptor->mToolkitAdaptor.mFunctionsCalled.IsAvailable = true; - available = true; - } +} - return available; +Adaptor& Adaptor::Get() +{ + return Internal::Adaptor::Adaptor::Get(); } -void Adaptor::RegisterSingleton(const std::type_info& info, Dali::BaseHandle singleton) +bool Adaptor::IsAvailable() { - mToolkitAdaptor.mFunctionsCalled.RegisterSingleton = true; + return false; +} - if(singleton) - { - mSingletonContainer.insert(SingletonPair(info.name(), singleton)); - } +void Adaptor::NotifySceneCreated() +{ } -Dali::BaseHandle Adaptor::GetSingleton(const std::type_info& info) const +void Adaptor::NotifyLanguageChanged() { - mToolkitAdaptor.mFunctionsCalled.GetSingleton = true; +} - Dali::BaseHandle object = Dali::BaseHandle(); +void Adaptor::SetMinimumPinchDistance(float distance) +{ +} - SingletonConstIter iter = mSingletonContainer.find(info.name()); - if(iter != mSingletonContainer.end()) - { - object = (*iter).second; - } +void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp ) +{ +} - return object; +void Adaptor::FeedWheelEvent( WheelEvent& wheelEvent ) +{ } -Adaptor::AdaptorSignalV2& Adaptor::SignalResize() +void Adaptor::FeedKeyEvent( KeyEvent& keyEvent ) { - mToolkitAdaptor.mFunctionsCalled.SignalResize = true; - return mResizeSignal; } -//////////////////////////////////////////////////////////////////////////////////////////////////// +void Adaptor::SceneCreated() +{ +} -ToolkitAdaptor::ToolkitAdaptor() -: mLastTouchPointFed(0, TouchPoint::Down, 0.0f, 0.0f), - mLastTimeStampFed(0), - mStyleMonitor(StyleMonitor::Get()), - mAccessibilityManager(AccessibilityManager::Get()), - mImfManager(ImfManager::Get()), - mAdaptorStub(new Adaptor(*this)) +void Adaptor::SetViewMode( ViewMode mode ) { - gAdaptor = mAdaptorStub; } -ToolkitAdaptor::~ToolkitAdaptor() +void Adaptor::SetStereoBase( float stereoBase ) { - delete mAdaptorStub; - gAdaptor = NULL; } -void ToolkitAdaptor::EmitSignalResize() +Adaptor::Adaptor() +: mImpl( NULL ) { - mAdaptorStub->EmitSignalResize(); } } // namespace Dali