UTC test coverage
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-PanGestureDetector.cpp
index 57d0651..b68da92 100644 (file)
@@ -157,22 +157,16 @@ struct PanConstraint
 {
   PanConstraint( ConstraintData& data ) : constraintData(data) { }
 
-  Vector3 operator()(const Vector3&       current,
-                     const PropertyInput& screenPositionProperty,
-                     const PropertyInput& screenDisplacementProperty,
-                     const PropertyInput& screenVelocityProperty,
-                     const PropertyInput& localPositionProperty,
-                     const PropertyInput& localDisplacementProperty,
-                     const PropertyInput& localVelocityProperty)
+  void operator()( Vector3& current, const PropertyInputContainer& inputs )
   {
-    constraintData.screenPosition = screenPositionProperty.GetVector2();
-    constraintData.screenDisplacement = screenDisplacementProperty.GetVector2();
-    constraintData.screenVelocity = screenVelocityProperty.GetVector2();
-    constraintData.localPosition = localPositionProperty.GetVector2();
-    constraintData.localDisplacement = localDisplacementProperty.GetVector2();
-    constraintData.localVelocity = localVelocityProperty.GetVector2();
+    constraintData.screenPosition = inputs[0]->GetVector2();
+    constraintData.screenDisplacement = inputs[1]->GetVector2();
+    constraintData.screenVelocity = inputs[2]->GetVector2();
+    constraintData.localPosition = inputs[3]->GetVector2();
+    constraintData.localDisplacement = inputs[4]->GetVector2();
+    constraintData.localVelocity = inputs[5]->GetVector2();
     constraintData.called = true;
-    return Vector3::ZERO;
+    current = Vector3::ZERO;
   }
 
   ConstraintData& constraintData;
@@ -294,6 +288,30 @@ int UtcDaliPanGestureDetectorConstructor(void)
   END_TEST;
 }
 
+int UtcDaliPanGestureDetectorCopyConstructorP(void)
+{
+  TestApplication application;
+
+  PanGestureDetector detector = PanGestureDetector::New();;
+
+  PanGestureDetector copy( detector );
+  DALI_TEST_CHECK( detector );
+  END_TEST;
+}
+
+int UtcDaliPanGestureDetectorAssignmentOperatorP(void)
+{
+  TestApplication application;
+
+  PanGestureDetector detector = PanGestureDetector::New();;
+
+  PanGestureDetector assign;
+  assign = detector;
+  DALI_TEST_CHECK( detector );
+
+  DALI_TEST_CHECK( detector == assign );
+  END_TEST;
+}
 
 // Negative test case for a method
 int UtcDaliPanGestureDetectorNew(void)
@@ -2085,13 +2103,14 @@ int UtcDaliPanGestureNoPredictionNoSmoothing(void)
   Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
 
   ConstraintData constraintData;
-  actor.ApplyConstraint( Constraint::New<Vector3>( property, Source( detector, PanGestureDetector::Property::SCREEN_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ),
-                                                             PanConstraint( constraintData ) ) );
+  Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+  constraint.Apply();
 
   // Render and notify
   application.SendNotification();
@@ -2130,13 +2149,14 @@ int UtcDaliPanGestureNoPredictionSmoothing(void)
   Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
 
   ConstraintData constraintData;
-  actor.ApplyConstraint( Constraint::New<Vector3>( property, Source( detector, PanGestureDetector::Property::SCREEN_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ),
-                                                             PanConstraint( constraintData ) ) );
+  Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+  constraint.Apply();
 
   // Render and notify
   application.SendNotification();
@@ -2176,13 +2196,14 @@ int UtcDaliPanGesturePredictionNoSmoothing(void)
   Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
 
   ConstraintData constraintData;
-  actor.ApplyConstraint( Constraint::New<Vector3>( property, Source( detector, PanGestureDetector::Property::SCREEN_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ),
-                                                             PanConstraint( constraintData ) ) );
+  Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+  constraint.Apply();
 
   // Render and notify
   application.SendNotification();
@@ -2222,13 +2243,14 @@ int UtcDaliPanGesturePredictionSmoothing(void)
   Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
 
   ConstraintData constraintData;
-  actor.ApplyConstraint( Constraint::New<Vector3>( property, Source( detector, PanGestureDetector::Property::SCREEN_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ),
-                                                             PanConstraint( constraintData ) ) );
+  Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+  constraint.Apply();
 
   // Render and notify
   application.SendNotification();
@@ -2269,13 +2291,14 @@ int UtcDaliPanGestureSetProperties(void)
   Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
 
   ConstraintData constraintData;
-  actor.ApplyConstraint( Constraint::New<Vector3>( property, Source( detector, PanGestureDetector::Property::SCREEN_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ),
-                                                             PanConstraint( constraintData ) ) );
+  Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+  constraint.Apply();
 
   // Render and notify
   application.SendNotification();
@@ -2329,13 +2352,14 @@ int UtcDaliPanGestureSetPropertiesAlreadyPanning(void)
   Property::Index property = actor.RegisterProperty( "Dummy Property", Vector3::ZERO );
 
   ConstraintData constraintData;
-  actor.ApplyConstraint( Constraint::New<Vector3>( property, Source( detector, PanGestureDetector::Property::SCREEN_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_POSITION ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ),
-                                                             Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ),
-                                                             PanConstraint( constraintData ) ) );
+  Constraint constraint = Constraint::New<Vector3>( actor, property, PanConstraint( constraintData ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::SCREEN_VELOCITY ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_POSITION ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_DISPLACEMENT ) );
+  constraint.AddSource( Source( detector, PanGestureDetector::Property::LOCAL_VELOCITY ) );
+  constraint.Apply();
 
   // Render and notify
   application.SendNotification();