Applying changes to Scene::New()
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-window.cpp
index 05c4836..2726434 100644 (file)
@@ -15,6 +15,9 @@
  *
  */
 
  *
  */
 
+// CLASS HEADER
+#include "toolkit-window.h"
+
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/layer.h>
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/layer.h>
@@ -22,7 +25,7 @@
 #include <dali/public-api/object/base-object.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/object/base-object.h>
 
 // INTERNAL INCLUDES
-#include "toolkit-window.h"
+#include "test-render-surface.h"
 
 namespace Dali
 {
 
 namespace Dali
 {
@@ -37,33 +40,37 @@ namespace Internal
 {
 namespace Adaptor
 {
 {
 namespace Adaptor
 {
-
 class Window : public Dali::BaseObject
 {
 public:
 
 class Window : public Dali::BaseObject
 {
 public:
 
-  Window()
+  Window( const PositionSize& positionSize )
+  : mRenderSurface( positionSize ),
+    mScene( Dali::Integration::Scene::New( mRenderSurface ) )
   {
   }
 
   {
   }
 
-  virtual ~Window()
-  {
-  }
+  virtual ~Window() = default;
 
   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
   {
 
   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent)
   {
-    return new Window();
+    return new Window( positionSize );
   }
 
   }
 
-  static Dali::Window Get( Dali::Actor actor )
-  {
-    return Dali::Window();
-  }
+  TestRenderSurface mRenderSurface;
+  Integration::Scene mScene;
 };
 
 } // Adaptor
 } // Internal
 
 };
 
 } // Adaptor
 } // Internal
 
+inline Internal::Adaptor::Window& GetImplementation(Dali::Window& window)
+{
+  DALI_ASSERT_ALWAYS( window && "Window handle is empty" );
+  BaseObject& object = window.GetBaseObject();
+  return static_cast<Internal::Adaptor::Window&>(object);
+}
+
 Window::Window()
 {
 }
 Window::Window()
 {
 }
@@ -72,6 +79,17 @@ Window::~Window()
 {
 }
 
 {
 }
 
+Window::Window(const Window& handle)
+: BaseHandle( handle )
+{
+}
+
+Window& Window::operator=(const Window& rhs)
+{
+  BaseHandle::operator=(rhs);
+  return *this;
+}
+
 Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
 {
   Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, "", isTransparent );
 Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
 {
   Internal::Adaptor::Window* window = Internal::Adaptor::Window::New( windowPosition, name, "", isTransparent );
@@ -94,22 +112,42 @@ Window::Window( Internal::Adaptor::Window* window )
 {
 }
 
 {
 }
 
+Integration::Scene Window::GetScene()
+{
+  return GetImplementation( *this ).mScene;
+}
+
+Integration::RenderSurface& Window::GetRenderSurface()
+{
+  return GetImplementation( *this ).mRenderSurface;
+}
+
 namespace DevelWindow
 {
 
 Window Get( Actor actor )
 {
 namespace DevelWindow
 {
 
 Window Get( Actor actor )
 {
-  return Internal::Adaptor::Window::Get( actor );
+  return Window();
+}
+
+EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
+{
+  return GetImplementation( window ).mScene.EventProcessingFinishedSignal();
 }
 
 KeyEventSignalType& KeyEventSignal( Window window )
 {
 }
 
 KeyEventSignalType& KeyEventSignal( Window window )
 {
-  return Dali::Stage::GetCurrent().KeyEventSignal();
+  return GetImplementation( window ).mScene.KeyEventSignal();
 }
 
 TouchSignalType& TouchSignal( Window window )
 {
 }
 
 TouchSignalType& TouchSignal( Window window )
 {
-  return Dali::Stage::GetCurrent().TouchSignal();
+  return GetImplementation( window ).mScene.TouchSignal();
+}
+
+WheelEventSignalType& WheelEventSignal( Window window )
+{
+  return GetImplementation( window ).mScene.WheelEventSignal();
 }
 
 } // namespace DevelWindow
 }
 
 } // namespace DevelWindow