Merge "Removed dead code from Actor & fixed minor bugs in GestureDetector" into devel...
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Actor.cpp
index 6dcde41..2386eeb 100644 (file)
@@ -58,7 +58,9 @@ int SimulateTouchForSetOverlayHitTest(TestApplication& app)
   gTouchCallBackCalled = false;
 
   // simulate a touch event
-  Dali::TouchPoint point( 0, TouchPoint::Down, 25.0f, 25.0f );
+  Dali::Integration::Point point;
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( 25.0f, 25.0f ) );
   Dali::Integration::TouchEvent event;
   event.AddPoint( point );
   app.ProcessEvent( event );
@@ -601,6 +603,42 @@ int UtcDaliActorSetParentOrigin(void)
   END_TEST;
 }
 
+int UtcDaliActorSetParentOriginIndividual(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  Vector3 vector(0.7f, 0.8f, 0.9f);
+  DALI_TEST_CHECK(vector != actor.GetCurrentParentOrigin());
+
+  actor.SetProperty( Actor::Property::PARENT_ORIGIN_X, vector.x );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.x, actor.GetCurrentParentOrigin().x, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::PARENT_ORIGIN_Y, vector.y );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.y, actor.GetCurrentParentOrigin().y, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::PARENT_ORIGIN_Z, vector.z );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.z, actor.GetCurrentParentOrigin().z, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliActorGetCurrentParentOrigin(void)
 {
   TestApplication application;
@@ -650,6 +688,42 @@ int UtcDaliActorSetAnchorPoint(void)
   END_TEST;
 }
 
+int UtcDaliActorSetAnchorPointIndividual(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  Vector3 vector(0.7f, 0.8f, 0.9f);
+  DALI_TEST_CHECK(vector != actor.GetCurrentAnchorPoint());
+
+  actor.SetProperty( Actor::Property::ANCHOR_POINT_X, vector.x );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.x, actor.GetCurrentAnchorPoint().x, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::ANCHOR_POINT_Y, vector.y );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.y, actor.GetCurrentAnchorPoint().y, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::ANCHOR_POINT_Z, vector.z );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.z, actor.GetCurrentAnchorPoint().z, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliActorGetCurrentAnchorPoint(void)
 {
   TestApplication application;
@@ -759,6 +833,43 @@ int UtcDaliActorSetSize04(void)
   END_TEST;
 }
 
+int UtcDaliActorSetSizeIndividual(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  Vector3 vector(0.7f, 0.8f, 0.9f);
+  DALI_TEST_CHECK(vector != actor.GetCurrentSize());
+
+  actor.SetProperty( Actor::Property::SIZE_WIDTH, vector.width );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.width, actor.GetCurrentSize().width, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::SIZE_HEIGHT, vector.height );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.height, actor.GetCurrentSize().height, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::SIZE_DEPTH, vector.depth );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.depth, actor.GetCurrentSize().depth, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
 int UtcDaliActorGetCurrentSize(void)
 {
   TestApplication application;
@@ -985,6 +1096,42 @@ int UtcDaliActorSetZ(void)
   END_TEST;
 }
 
+int UtcDaliActorSetPositionProperties(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  Vector3 vector(0.7f, 0.8f, 0.9f);
+  DALI_TEST_CHECK(vector != actor.GetCurrentPosition());
+
+  actor.SetProperty( Actor::Property::POSITION_X, vector.x );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.x, actor.GetCurrentPosition().x, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::POSITION_Y, vector.y );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.y, actor.GetCurrentPosition().y, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::POSITION_Z, vector.z );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.z, actor.GetCurrentPosition().z, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliActorTranslateBy(void)
 {
   TestApplication application;
@@ -1224,6 +1371,24 @@ int UtcDaliActorSetOrientation02(void)
   END_TEST;
 }
 
+// SetOrientation(float angleRadians, Vector3 axis)
+int UtcDaliActorSetOrientationProperty(void)
+{
+  TestApplication application;
+
+  Quaternion rotation( Radian(0.785f), Vector3(1.0f, 1.0f, 0.0f));
+  Actor actor = Actor::New();
+
+  actor.SetProperty( Actor::Property::ORIENTATION, rotation );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS(rotation, actor.GetCurrentOrientation(), 0.001, TEST_LOCATION);
+  END_TEST;
+}
+
 // RotateBy(float angleRadians, Vector3 axis)
 int UtcDaliActorRotateBy01(void)
 {
@@ -1406,6 +1571,42 @@ int UtcDaliActorSetScale03(void)
   END_TEST;
 }
 
+int UtcDaliActorSetScaleIndividual(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  Vector3 vector(0.7f, 0.8f, 0.9f);
+  DALI_TEST_CHECK(vector != actor.GetCurrentScale());
+
+  actor.SetProperty( Actor::Property::SCALE_X, vector.x );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.x, actor.GetCurrentScale().x, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::SCALE_Y, vector.y );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.y, actor.GetCurrentScale().y, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::SCALE_Z, vector.z );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.z, actor.GetCurrentScale().z, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliActorScaleBy(void)
 {
   TestApplication application;
@@ -1670,6 +1871,51 @@ int UtcDaliActorSetColor(void)
   END_TEST;
 }
 
+int UtcDaliActorSetColorIndividual(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  Vector4 vector(0.7f, 0.8f, 0.9f, 0.6f);
+  DALI_TEST_CHECK(vector != actor.GetCurrentColor());
+
+  actor.SetProperty( Actor::Property::COLOR_RED, vector.r );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.r, actor.GetCurrentColor().r, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::COLOR_GREEN, vector.g );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.g, actor.GetCurrentColor().g, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::COLOR_BLUE, vector.b );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.b, actor.GetCurrentColor().b, TEST_LOCATION );
+
+  actor.SetProperty( Actor::Property::COLOR_ALPHA, vector.a );
+
+  // flush the queue and render once
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_EQUALS( vector.a, actor.GetCurrentColor().a, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
 int UtcDaliActorGetCurrentColor(void)
 {
   TestApplication application;
@@ -1968,7 +2214,10 @@ int UtcDaliActorTouchedSignal(void)
 
   // simulate a touch event in the middle of the screen
   Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
-  Dali::TouchPoint point( 1, TouchPoint::Down, touchPoint.x, touchPoint.y );
+  Dali::Integration::Point point;
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::DOWN );
+  point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
   Dali::Integration::TouchEvent event;
   event.AddPoint( point );
   application.ProcessEvent( event );
@@ -1995,7 +2244,10 @@ int UtcDaliActorHoveredSignal(void)
 
   // simulate a hover event in the middle of the screen
   Vector2 touchPoint( Stage::GetCurrent().GetSize() * 0.5 );
-  Dali::TouchPoint point( 1, TouchPoint::Motion, touchPoint.x, touchPoint.y );
+  Dali::Integration::Point point;
+  point.SetDeviceId( 1 );
+  point.SetState( PointState::MOTION );
+  point.SetScreenPosition( Vector2( touchPoint.x, touchPoint.y ) );
   Dali::Integration::HoverEvent event;
   event.AddPoint( point );
   application.ProcessEvent( event );
@@ -2201,7 +2453,9 @@ int UtcDaliActorHitTest(void)
     // connect to its touch signal
     actor.TouchedSignal().Connect(TestCallback);
 
-    Dali::TouchPoint point( 0, TouchPoint::Down, hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y );
+    Dali::Integration::Point point;
+    point.SetState( PointState::DOWN );
+    point.SetScreenPosition( Vector2( hitTestData[index]->mTouchPoint.x, hitTestData[index]->mTouchPoint.y ) );
     Dali::Integration::TouchEvent event;
     event.AddPoint( point );