[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-adaptor-impl.h
index 5e71771..6a69f93 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_ADAPTOR_IMPL_H__
-#define __DALI_TOOLKIT_ADAPTOR_IMPL_H__
+#ifndef DALI_TOOLKIT_ADAPTOR_IMPL_H
+#define DALI_TOOLKIT_ADAPTOR_IMPL_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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/devel-api/adaptor-framework/render-surface.h>
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
 
 namespace Dali
 {
 class EglInterface;
 class DisplayConnection;
 class ThreadSynchronizationInterface;
+class Window;
+class TestApplication;
 
 namespace Integration
 {
+class Scene;
+}
 
-class GlAbstraction;
-
-} // namespace Integration
+using WindowContainer = std::vector<Window>;
 
-class TestRenderSurface : public RenderSurface
+namespace Internal
 {
-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 ) {}
+namespace Adaptor
+{
+class GraphicsInterface;
+class SceneHolder;
 
-  virtual void StopRender() {}
+} // namespace Adaptor
 
-  virtual void ReleaseLock() {}
+} // namespace Internal
 
-  virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {}
+namespace Integration
+{
+class GlAbstraction;
 
-  virtual RenderSurface::Type GetSurfaceType() { return RenderSurface::ECORE_RENDER_SURFACE; }
-};
+} // namespace Integration
 
 namespace Internal
 {
 namespace Adaptor
 {
-
-class Adaptor: public BaseObject
+class Adaptor
 {
 public:
+  static Dali::Adaptor& New();
   static Dali::Adaptor& Get();
   Adaptor();
   ~Adaptor();
 
-public:
-  static Dali::RenderSurface& GetSurface();
-  static Dali::Adaptor::AdaptorSignalType& AdaptorSignal();
-  static bool mAvailable;
-  static Vector<CallbackBase*> mCallbacks;
+  void Start(Dali::Window window);
+  void Stop();
+
+  bool AddIdle(CallbackBase* callback, bool hasReturnValue);
+  void RemoveIdle(CallbackBase* callback);
+  void RunIdles();
+
+  void RequestUpdateOnce();
+
+  static Integration::Scene GetScene(Dali::Window window);
+
+  Dali::RenderSurfaceInterface& GetSurface();
+  Dali::WindowContainer         GetWindows();
+  Dali::SceneHolderList         GetSceneHolders();
+
+  Dali::Internal::Adaptor::SceneHolder* GetWindow(Dali::Actor& actor);
+  void                                  AddWindow(Internal::Adaptor::SceneHolder* window);
+  void                                  RemoveWindow(Internal::Adaptor::SceneHolder* window);
+
+  void RegisterProcessor(Integration::Processor& processor, bool postProcessor = false);
+  void UnregisterProcessor(Integration::Processor& processor, bool postProcessor = false);
+
+  void SetApplication(Dali::TestApplication& testApplication);
+
+  bool IsStopped() const
+  {
+    return mStopped;
+  }
+
+  Dali::Adaptor::AdaptorSignalType&       ResizedSignal();
+  Dali::Adaptor::AdaptorSignalType&       LanguageChangedSignal();
+  Dali::Adaptor::WindowCreatedSignalType& WindowCreatedSignal();
+  Dali::Adaptor::LocaleChangedSignalType& LocaleChangedSignal();
+
+  static Adaptor& GetImpl(Dali::Adaptor& adaptor)
+  {
+    return *adaptor.mImpl;
+  }
+  static const Adaptor& GetImpl(const Dali::Adaptor& adaptor)
+  {
+    return *adaptor.mImpl;
+  }
+
+private:
+  Vector<CallbackBase*>                        mCallbacks;
+  Vector<CallbackBase*>                        mReturnCallbacks;
+  std::vector<Internal::Adaptor::SceneHolder*> mWindows;
+  Dali::Adaptor::AdaptorSignalType             mResizedSignal;
+  Dali::Adaptor::AdaptorSignalType             mLanguageChangedSignal;
+  Dali::Adaptor::WindowCreatedSignalType       mWindowCreatedSignal;
+  Dali::Adaptor::LocaleChangedSignalType       mLocaleChangedSignal;
+  TestApplication*                             mTestApplication;
+  bool                                         mStopped{false};
 };
 
 } // namespace Adaptor
 } // namespace Internal
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_ADAPTOR_IMPL_H__
+#endif // DALI_TOOLKIT_ADAPTOR_IMPL_H