Merge "Fix Svace issue" into devel/master
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-adaptor.cpp
index 41acc41..ebab526 100644 (file)
  *
  */
 
-#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 <dali/integration-api/adaptors/adaptor.h>
 
-#include "toolkit-adaptor.h"
-#include <map>
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/signals/dali-signal-v2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/devel-api/adaptor-framework/render-surface.h>
 
 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<int> 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<void(void)> 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<void(void)> 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