PositionSize API at dali-toolkit-test-utils/toolkit-window.cpp
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-window.cpp
index 5ee2dcb..cfdee85 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/actors/layer.h>
-#include <dali/public-api/common/stage.h>
 #include <dali/public-api/object/base-object.h>
 
 #define DALI_WINDOW_H
-#include <dali/integration-api/adaptors/adaptor.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <toolkit-adaptor-impl.h>
 
-// INTERNAL INCLUDES
-#include "test-render-surface.h"
-
 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
 
 namespace Dali
@@ -50,6 +46,8 @@ namespace Adaptor
 Window::Window( const PositionSize& positionSize )
 : SceneHolder( positionSize ),
   mFocusChangeSignal(),
+  mResizeSignal(),
+  mRotationAngle(90), // dummy angle for test coverage
   mVisibilityChangedSignal()
 {
 }
@@ -59,6 +57,27 @@ Window* Window::New(const PositionSize& positionSize, const std::string& name, c
   return new Window( positionSize );
 }
 
+WindowPosition Window::GetPosition() const
+{
+  PositionSize positionSize = mRenderSurface.GetPositionSize();
+
+  return WindowPosition(positionSize.x, positionSize.y);
+}
+
+PositionSize Window::GetPositionSize() const
+{
+  return mRenderSurface.GetPositionSize();
+}
+
+void Window::SetPositionSize(PositionSize positionSize)
+{
+  mRenderSurface.MoveResize(positionSize);
+
+  Uint16Pair newSize(positionSize.width, positionSize.height);
+  Dali::Window handle(this);
+  mResizeSignal.Emit(handle, newSize);
+}
+
 } // Adaptor
 } // Internal
 
@@ -84,16 +103,13 @@ Window::~Window()
 {
 }
 
-Window::Window(const Window& handle)
-: BaseHandle( handle )
-{
-}
+Window::Window( const Window& copy ) = default;
 
-Window& Window::operator=(const Window& rhs)
-{
-  BaseHandle::operator=(rhs);
-  return *this;
-}
+Window& Window::operator=( const Window& rhs ) = default;
+
+Window::Window( Window&& rhs ) = default;
+
+Window& Window::operator=( Window&& rhs ) = default;
 
 Dali::Window Window::New( PositionSize windowPosition, const std::string& name, bool isTransparent )
 {
@@ -122,7 +138,7 @@ Integration::Scene Window::GetScene()
   return GetImplementation( *this ).GetScene();
 }
 
-Integration::RenderSurface& Window::GetRenderSurface()
+Dali::RenderSurfaceInterface& Window::GetRenderSurface()
 {
   return GetImplementation( *this ).GetRenderSurface();
 }
@@ -167,6 +183,21 @@ FocusChangeSignalType& Window::FocusChangeSignal()
   return GetImplementation( *this ).mFocusChangeSignal;
 }
 
+ResizeSignalType& Window::ResizeSignal()
+{
+  return GetImplementation( *this ).mResizeSignal;
+}
+
+Window::KeyEventSignalType& Window::KeyEventSignal()
+{
+  return GetImplementation( *this ).KeyEventSignal();
+}
+
+Window::TouchEventSignalType& Window::TouchedSignal()
+{
+  return GetImplementation( *this ).TouchedSignal();
+}
+
 namespace DevelWindow
 {
 
@@ -192,24 +223,34 @@ Window DownCast( BaseHandle handle )
   return Dali::Window( windowImpl );
 }
 
-EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
+void SetPositionSize(Window window, PositionSize positionSize)
 {
-  return GetImplementation( window ).GetScene().EventProcessingFinishedSignal();
+  GetImplementation( window ).SetPositionSize(positionSize);
 }
 
-KeyEventSignalType& KeyEventSignal( Window window )
+int GetPhysicalOrientation(Window window)
 {
-  return GetImplementation( window ).KeyEventSignal();
+  return GetImplementation( window ).mRotationAngle;
 }
 
-KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window )
+void AddFrameRenderedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId )
 {
-  return GetImplementation( window ).KeyEventGeneratedSignal();
+  CallbackBase::Execute( *callback, frameId );
 }
 
-TouchSignalType& TouchSignal( Window window )
+void AddFramePresentedCallback( Window window, std::unique_ptr< CallbackBase > callback, int32_t frameId )
 {
-  return GetImplementation( window ).TouchSignal();
+  CallbackBase::Execute( *callback, frameId );
+}
+
+EventProcessingFinishedSignalType& EventProcessingFinishedSignal( Window window )
+{
+  return GetImplementation( window ).GetScene().EventProcessingFinishedSignal();
+}
+
+KeyEventGeneratedSignalType& KeyEventGeneratedSignal( Window window )
+{
+  return GetImplementation( window ).KeyEventGeneratedSignal();
 }
 
 WheelEventSignalType& WheelEventSignal( Window window )