Remove StereoMode
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-adaptor.cpp
index ebab526..dcf0560 100644 (file)
@@ -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.
 #include <dali/integration-api/adaptors/adaptor.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;
-
-namespace Integration
-{
-
-class GlAbstraction;
+#include <toolkit-adaptor-impl.h>
+#include <dali/integration-api/debug.h>
+#include <test-application.h>
 
-} // 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 ) {}
-
-};
 
 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<CallbackBase*> Adaptor::mCallbacks = Vector<CallbackBase*>();
 
 Dali::Adaptor& Adaptor::Get()
 {
   Dali::Adaptor* adaptor = new Dali::Adaptor;
+  Adaptor::mAvailable = true;
   return *adaptor;
 }
 
@@ -101,12 +54,8 @@ Dali::Adaptor::AdaptorSignalType& Adaptor::AdaptorSignal()
   return *signal;
 }
 
-}
-}
-}
-
-namespace Dali
-{
+} // namespace Adaptor
+} // namespace Internal
 
 Adaptor& Adaptor::New( Window window )
 {
@@ -148,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<CallbackBase*>::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 )
@@ -197,7 +173,7 @@ Adaptor& Adaptor::Get()
 
 bool Adaptor::IsAvailable()
 {
-  return false;
+  return Internal::Adaptor::Adaptor::mAvailable;
 }
 
 void Adaptor::NotifySceneCreated()
@@ -228,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()