Add a test to check the default Control OnPinch method 69/239569/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 27 Jul 2020 19:15:56 +0000 (20:15 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 27 Jul 2020 19:15:56 +0000 (20:15 +0100)
Change-Id: If8478f4e0e98b31357f9f53d6f4432e3b7c863cf

automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp

index 5eed3b7..bdd74f9 100644 (file)
@@ -1337,3 +1337,28 @@ int UtcDaliControlImplAutoClippingWithVisualsAlreadyOnStage(void)
 
   END_TEST;
 }
+
+int UtcDaliControlImplOnPinch(void)
+{
+  ToolkitTestApplication application;
+
+  Control control = Control::New();
+  control.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+  control.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+  application.GetScene().Add(control);
+
+  application.SendNotification();
+  application.Render();
+
+  Toolkit::Internal::Control& impl = Toolkit::Internal::GetImplementation(control);
+  impl.EnableGestureDetection(Gesture::Pinch);
+
+  // Scale becomes 0.6666666
+  TestStartPinch( application,  Vector2( 5.0f, 20.0f ), Vector2( 35.0f, 20.0f ),
+                                Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
+
+  DALI_TEST_EQUALS(0.666f, control.GetProperty( Actor::Property::SCALE_X).Get<float>(), 0.01f, TEST_LOCATION);
+
+  END_TEST;
+
+}