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=17bd210923227881bc485909c65d2d2a7f32965e;hb=fd9780b06023ca21988b0913c6539b733491c6e1;hpb=0eed173d0b1a957811af9f0afa022f714bf2b5dc 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 17bd210..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 @@ -15,214 +15,230 @@ * */ -#define __DALI_ADAPTOR_H__ -#define __DALI_ACCESSIBILITY_MANAGER_H__ -#define __DALI_TIMER_H__ -#define __DALI_CLIPBOARD_H__ -#define __DALI_IMF_MANAGER_H__ +// CLASS HEADER +#include -#include "toolkit-adaptor.h" -#include -#include -#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);} -}; -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 ) {} -public: + virtual void CreateEglSurface( EglInterface& egl ) {} - Adaptor(ToolkitAdaptor& toolkitAdaptor); - ~Adaptor(); + virtual void DestroyEglSurface( EglInterface& egl ) {} -public: + virtual bool ReplaceEGLSurface( EglInterface& egl ) { return false; } - 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 MoveResize( Dali::PositionSize positionSize ) {} -public: // static methods - static Adaptor& Get(); - static bool IsAvailable(); + virtual void SetViewMode( ViewMode viewMode ) {} -public: // Signals + virtual void StartRender() {} - AdaptorSignalV2& SignalResize(); + virtual bool PreRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction ) { return false; } - void EmitSignalResize() - { - mResizeSignal.Emit( *this ); - } + virtual void PostRender( EglInterface& egl, Integration::GlAbstraction& glAbstraction, DisplayConnection* displayConnection, bool replacingSurface ) {} -private: + virtual void StopRender() {} - // Undefined - Adaptor(const Adaptor&); - Adaptor& operator=(Adaptor&); + virtual void ReleaseLock() {} + + virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {} - AdaptorSignalV2 mResizeSignal; - TestRenderSurface mRenderSurface; - ToolkitAdaptor& mToolkitAdaptor; }; -namespace +namespace Internal +{ +namespace Adaptor +{ + +class Adaptor: public BaseObject { -Adaptor* gAdaptor = NULL; +public: + static Dali::Adaptor& Get(); + Adaptor(); + ~Adaptor(); +public: + static Dali::RenderSurface& GetSurface(); + static Dali::Adaptor::AdaptorSignalType& AdaptorSignal(); +}; + +Dali::Adaptor& Adaptor::Get() +{ + Dali::Adaptor* adaptor = new Dali::Adaptor; + return *adaptor; } -Adaptor::Adaptor(ToolkitAdaptor& toolkitAdaptor) -: mToolkitAdaptor(toolkitAdaptor) +Dali::RenderSurface& Adaptor::GetSurface() { + Dali::RenderSurface *renderSurface = new Dali::TestRenderSurface; + return *renderSurface; } -Adaptor::~Adaptor() +Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal() +{ + Dali::Adaptor::AdaptorSignalType* signal = new Dali::Adaptor::AdaptorSignalType; + return *signal; +} + +} +} +} + +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() +{ +} + +void Adaptor::SetRenderRefreshRate( unsigned int numberOfVSyncsPerRender ) +{ +} + +void Adaptor::SetUseHardwareVSync(bool useHardware) { - mToolkitAdaptor.mFunctionsCalled.GetSurface = true; - return mRenderSurface; } Adaptor& Adaptor::Get() { - DALI_ASSERT_ALWAYS(gAdaptor); - gAdaptor->mToolkitAdaptor.mFunctionsCalled.Get = true; - return *gAdaptor; + return Internal::Adaptor::Adaptor::Get(); } bool Adaptor::IsAvailable() { - bool available(false); + return false; +} + +void Adaptor::NotifySceneCreated() +{ +} + +void Adaptor::NotifyLanguageChanged() +{ +} + +void Adaptor::SetMinimumPinchDistance(float distance) +{ +} - if (gAdaptor) - { - gAdaptor->mToolkitAdaptor.mFunctionsCalled.IsAvailable = true; - available = true; - } +void Adaptor::FeedTouchPoint( TouchPoint& point, int timeStamp ) +{ +} - return available; +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