Move TouchPoint to Devel API
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-DragAndDropDetector.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 9742cee..9f41ad8
@@ -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.
@@ -81,7 +81,7 @@ namespace
     bool returnValue;
     };
 
-  Integration::TouchEvent GenerateSingleTouch(TouchPoint::State state, const Vector2& screenPosition)
+  Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition)
   {
     Integration::TouchEvent touchEvent;
     Integration::Point point;
@@ -270,9 +270,9 @@ int UtcDaliDragAndDropDetectorStartSignal(void)
 
   Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
   Control control = Control::New();
-  control.SetSize(100.0f, 100.0f);
+  control.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
   control.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
-  Stage::GetCurrent().Add(control);
+  application.GetScene().Add(control);
   detector.Attach(control);
 
   application.SendNotification();
@@ -302,17 +302,17 @@ int UtcDaliDragAndDropDetectorEnteredSignal(void)
   Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
   Control control1 = Control::New();
   Control control2 = Control::New();
-  control1.SetSize(100.0f,100.0f);
-  control2.SetSize(100.0f, 100.0f);
+  control1.SetProperty( Actor::Property::SIZE, Vector2(100.0f,100.0f) );
+  control2.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
   control1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control1.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
   control2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
-  control1.SetPosition(0.0f, 0.0f);
-  control2.SetPosition(0.0f, 100.0f);
+  control1.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+  control2.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 100.0f));
 
-  Stage::GetCurrent().Add(control1);
-  Stage::GetCurrent().Add(control2);
+  application.GetScene().Add(control1);
+  application.GetScene().Add(control2);
 
   detector.Attach(control1);
   detector.Attach(control2);
@@ -327,7 +327,7 @@ int UtcDaliDragAndDropDetectorEnteredSignal(void)
   TestGenerateMiniPan(application);
 
   Vector2 screenCoordinates(10.0f, 110.0f);
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(control2, data.control, TEST_LOCATION);
@@ -345,17 +345,17 @@ int UtcDaliDragAndDropDetectorMovedSignal(void)
   Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
   Control control1 = Control::New();
   Control control2 = Control::New();
-  control1.SetSize(100.0f,100.0f);
-  control2.SetSize(100.0f, 100.0f);
+  control1.SetProperty( Actor::Property::SIZE, Vector2(100.0f,100.0f) );
+  control2.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
   control1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control1.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
   control2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
-  control1.SetPosition(0.0f, 0.0f);
-  control2.SetPosition(0.0f, 100.0f);
+  control1.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+  control2.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 100.0f));
 
-  Stage::GetCurrent().Add(control1);
-  Stage::GetCurrent().Add(control2);
+  application.GetScene().Add(control1);
+  application.GetScene().Add(control2);
 
   detector.Attach(control1);
   detector.Attach(control2);
@@ -370,11 +370,11 @@ int UtcDaliDragAndDropDetectorMovedSignal(void)
   TestGenerateMiniPan(application);
 
   Vector2 screenCoordinates(10.0f, 110.0f);
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
 
   screenCoordinates.x = 10.0f;
   screenCoordinates.y = 120.0f;
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(Vector2(10.0f, 120.0f), data.detector.GetCurrentScreenPosition(), TEST_LOCATION);
@@ -392,20 +392,20 @@ int UtcDaliDragAndDropDetectorExitedSignal(void)
   Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
   Control control1 = Control::New();
   Control control2 = Control::New();
-  control1.SetSize(100.0f,100.0f);
-  control2.SetSize(100.0f, 100.0f);
+  control1.SetProperty( Actor::Property::SIZE, Vector2(100.0f,100.0f) );
+  control2.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
   control1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control1.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
   control2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
-  control1.SetPosition(0.0f, 0.0f);
-  control2.SetPosition(0.0f, 100.0f);
+  control1.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+  control2.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 100.0f));
 
   control1.SetProperty( Actor::Property::LEAVE_REQUIRED,true);
   control2.SetProperty( Actor::Property::LEAVE_REQUIRED,true);
 
-  Stage::GetCurrent().Add(control1);
-  Stage::GetCurrent().Add(control2);
+  application.GetScene().Add(control1);
+  application.GetScene().Add(control2);
 
   detector.Attach(control1);
   detector.Attach(control2);
@@ -420,11 +420,11 @@ int UtcDaliDragAndDropDetectorExitedSignal(void)
   TestGenerateMiniPan(application);
 
   Vector2 screenCoordinates(10.0f, 110.0f);
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
 
   screenCoordinates.x = 20.0f;
   screenCoordinates.y = 20.0f;
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(control2, data.control, TEST_LOCATION);
 
@@ -440,17 +440,17 @@ int UtcDaliDragAndDropDetectorDroppedSignal(void)
   Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
   Control control1 = Control::New();
   Control control2 = Control::New();
-  control1.SetSize(100.0f,100.0f);
-  control2.SetSize(100.0f, 100.0f);
+  control1.SetProperty( Actor::Property::SIZE, Vector2(100.0f,100.0f) );
+  control2.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
   control1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control1.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
   control2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
-  control1.SetPosition(0.0f, 0.0f);
-  control2.SetPosition(0.0f, 100.0f);
+  control1.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+  control2.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 100.0f));
 
-  Stage::GetCurrent().Add(control1);
-  Stage::GetCurrent().Add(control2);
+  application.GetScene().Add(control1);
+  application.GetScene().Add(control2);
 
   detector.Attach(control1);
   detector.Attach(control2);
@@ -465,11 +465,11 @@ int UtcDaliDragAndDropDetectorDroppedSignal(void)
   TestGenerateMiniPan(application);
 
   Vector2 screenCoordinates(10.0f, 110.0f);
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
 
   screenCoordinates.x = 10.0f;
   screenCoordinates.y = 112.0f;
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Up, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(control2, data.control, TEST_LOCATION);
@@ -488,17 +488,17 @@ int UtcDaliDragAndDropDetectorEndedSignal(void)
   Dali::Toolkit::DragAndDropDetector detector = Dali::Toolkit::DragAndDropDetector::New();
   Control control1 = Control::New();
   Control control2 = Control::New();
-  control1.SetSize(100.0f,100.0f);
-  control2.SetSize(100.0f, 100.0f);
+  control1.SetProperty( Actor::Property::SIZE, Vector2(100.0f,100.0f) );
+  control2.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
   control1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control1.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
   control2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
-  control1.SetPosition(0.0f, 0.0f);
-  control2.SetPosition(0.0f, 100.0f);
+  control1.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+  control2.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 100.0f));
 
-  Stage::GetCurrent().Add(control1);
-  Stage::GetCurrent().Add(control2);
+  application.GetScene().Add(control1);
+  application.GetScene().Add(control2);
 
   application.SendNotification();
   application.Render(RENDER_FRAME_INTERVAL);
@@ -512,7 +512,7 @@ int UtcDaliDragAndDropDetectorEndedSignal(void)
 
   TestGenerateMiniPan(application);
 
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Down, Vector2(10.0f, 10.0f)));
+  application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(control1, data.control, TEST_LOCATION);
@@ -530,17 +530,17 @@ int UtcDaliDragAndDropDetectorGetContent(void)
   Control control2 = Control::New();
   control1.SetProperty( Dali::Actor::Property::NAME,"control1");
   control2.SetProperty( Dali::Actor::Property::NAME,"control2");
-  control1.SetSize(100.0f,100.0f);
-  control2.SetSize(100.0f, 100.0f);
+  control1.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
+  control2.SetProperty( Actor::Property::SIZE, Vector2(100.0f, 100.0f) );
   control1.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control2.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
   control1.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
   control2.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::TOP_LEFT);
-  control1.SetPosition(0.0f, 0.0f);
-  control2.SetPosition(0.0f, 100.0f);
+  control1.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 0.0f));
+  control2.SetProperty( Actor::Property::POSITION, Vector2(0.0f, 100.0f));
 
-  Stage::GetCurrent().Add(control1);
-  Stage::GetCurrent().Add(control2);
+  application.GetScene().Add(control1);
+  application.GetScene().Add(control2);
 
   detector.Attach(control1);
   detector.Attach(control2);
@@ -555,11 +555,11 @@ int UtcDaliDragAndDropDetectorGetContent(void)
   TestGenerateMiniPan(application);
 
   Vector2 screenCoordinates(10.0f, 110.0f);
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Motion, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
 
   screenCoordinates.x = 10.0f;
   screenCoordinates.y = 112.0f;
-  application.ProcessEvent(GenerateSingleTouch(TouchPoint::Up, screenCoordinates));
+  application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
 
   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
   DALI_TEST_EQUALS(control2, data.control, TEST_LOCATION);