Merge "PositionSize API at dali-toolkit-test-utils/toolkit-window.cpp" into devel...
authorEunki Hong <eunkiki.hong@samsung.com>
Tue, 3 Aug 2021 11:10:06 +0000 (11:10 +0000)
committerGerrit Code Review <gerrit@review>
Tue, 3 Aug 2021 11:10:06 +0000 (11:10 +0000)
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp

index 0cfdcc0..fb67a4b 100644 (file)
@@ -31,9 +31,9 @@ class TestRenderSurface : public Dali::RenderSurfaceInterface
 {
 public:
 
-  TestRenderSurface( PositionSize positionSize ) {};
+  TestRenderSurface( PositionSize positionSize ) : mPositionSize(positionSize) {};
 
-  PositionSize GetPositionSize() const override { PositionSize size; return size; };
+  PositionSize GetPositionSize() const override { return mPositionSize; };
 
   virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) { dpiHorizontal = dpiVertical = 96; }
 
@@ -45,7 +45,7 @@ public:
 
   bool ReplaceGraphicsSurface() override { return false; };
 
-  void MoveResize( Dali::PositionSize positionSize ) override {};
+  void MoveResize( Dali::PositionSize positionSize ) override { mPositionSize = positionSize; };
 
   void StartRender() override {};
 
@@ -76,6 +76,9 @@ public:
   void SetBackgroundColor( Vector4 color ) {};
 
   Vector4 GetBackgroundColor() { return Color::WHITE; };
+
+private:
+  PositionSize mPositionSize;
 };
 
 namespace Internal
@@ -120,7 +123,7 @@ public:
 
   Dali::RenderSurfaceInterface& GetRenderSurface();
 
-private:
+protected:
 
   TestRenderSurface mRenderSurface;
   Integration::Scene mScene;
index f443251..a61569f 100644 (file)
@@ -29,7 +29,8 @@
 namespace Dali
 {
 
-typedef Dali::Rect<int> PositionSize;
+using PositionSize   = Dali::Rect<int>;
+using WindowPosition = Uint16Pair;
 
 namespace Internal
 {
@@ -43,6 +44,12 @@ public:
   Window( const PositionSize& positionSize );
   virtual ~Window() = default;
   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent);
+
+  WindowPosition GetPosition() const;
+  PositionSize   GetPositionSize() const;
+
+  void SetPositionSize(PositionSize positionSize);
+
   FocusChangeSignalType mFocusChangeSignal;
   ResizeSignalType      mResizeSignal;
   int                   mRotationAngle;
index 9ab5021..cfdee85 100644 (file)
@@ -57,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
 
@@ -204,8 +225,7 @@ Window DownCast( BaseHandle handle )
 
 void SetPositionSize(Window window, PositionSize positionSize)
 {
-  Uint16Pair newSize(positionSize.width, positionSize.height);
-  GetImplementation( window ).mResizeSignal.Emit(window,newSize);
+  GetImplementation( window ).SetPositionSize(positionSize);
 }
 
 int GetPhysicalOrientation(Window window)