Revert "[Tizen] Appendix log for ttrace + Print keycode and timestamp"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-PanGestureDetector.cpp
index 98019b2..a1d4483 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -238,6 +238,34 @@ int UtcDaliPanGestureDetectorAssignmentOperatorP(void)
   END_TEST;
 }
 
+int UtcDaliPanGestureDetectorMoveConstructorP(void)
+{
+  TestApplication application;
+
+  PanGestureDetector detector = PanGestureDetector::New();
+  DALI_TEST_CHECK(detector);
+
+  PanGestureDetector moved = std::move(detector);
+  DALI_TEST_CHECK(moved);
+  DALI_TEST_CHECK(!detector);
+  END_TEST;
+}
+
+int UtcDaliPanGestureDetectorMoveAssignmentOperatorP(void)
+{
+  TestApplication application;
+
+  PanGestureDetector detector;
+  detector = PanGestureDetector::New();
+  DALI_TEST_CHECK(detector);
+
+  PanGestureDetector moved;
+  moved = std::move(detector);
+  DALI_TEST_CHECK(moved);
+  DALI_TEST_CHECK(!detector);
+  END_TEST;
+}
+
 // Negative test case for a method
 int UtcDaliPanGestureDetectorNew(void)
 {
@@ -249,6 +277,7 @@ int UtcDaliPanGestureDetectorNew(void)
 
   DALI_TEST_EQUALS(1u, detector.GetMinimumTouchesRequired(), TEST_LOCATION);
   DALI_TEST_EQUALS(1u, detector.GetMaximumTouchesRequired(), TEST_LOCATION);
+  DALI_TEST_EQUALS(std::numeric_limits<uint32_t>::max(), detector.GetMaximumMotionEventAge(), TEST_LOCATION);
 
   // Attach an actor and emit a touch event on the actor to ensure complete line coverage
   Actor actor = Actor::New();
@@ -376,6 +405,44 @@ int UtcDaliPanGestureSetMaximumTouchesRequired(void)
   END_TEST;
 }
 
+int UtcDaliPanGestureSetMaximumMotionEventAge(void)
+{
+  TestApplication application;
+
+  PanGestureDetector detector = PanGestureDetector::New();
+
+  uint32_t minTime = 20;
+
+  DALI_TEST_CHECK(minTime != detector.GetMaximumMotionEventAge());
+
+  detector.SetMaximumMotionEventAge(minTime);
+
+  DALI_TEST_EQUALS(minTime, detector.GetMaximumMotionEventAge(), TEST_LOCATION);
+
+  // Attach an actor and change the maximum touches
+
+  Actor actor = Actor::New();
+  actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  application.GetScene().Add(actor);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  SignalData             data;
+  GestureReceivedFunctor functor(data);
+
+  detector.Attach(actor);
+  detector.DetectedSignal().Connect(&application, functor);
+
+  detector.SetMaximumMotionEventAge(minTime * 2);
+
+  DALI_TEST_EQUALS(minTime * 2, detector.GetMaximumMotionEventAge(), TEST_LOCATION);
+
+  END_TEST;
+}
+
 int UtcDaliPanGestureGetMinimumTouchesRequired(void)
 {
   TestApplication application;
@@ -394,6 +461,15 @@ int UtcDaliPanGestureGetMaximumTouchesRequired(void)
   END_TEST;
 }
 
+int UtcDaliPanGestureGetMaximumMotionEventAge(void)
+{
+  TestApplication application;
+
+  PanGestureDetector detector = PanGestureDetector::New();
+  DALI_TEST_EQUALS(std::numeric_limits<uint32_t>::max(), detector.GetMaximumMotionEventAge(), TEST_LOCATION);
+  END_TEST;
+}
+
 int UtcDaliPanGestureSignalReceptionNegative(void)
 {
   TestApplication application;
@@ -2835,50 +2911,6 @@ int UtcDaliPanGestureNoTimeDiff(void)
   END_TEST;
 }
 
-int UtcDaliPanGestureInterruptedWhenTouchConsumed(void)
-{
-  TestApplication application;
-
-  Actor actor = Actor::New();
-  actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
-  actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  application.GetScene().Add(actor);
-
-  bool                           consume = false;
-  TouchEventFunctorConsumeSetter touchFunctor(consume);
-  actor.TouchedSignal().Connect(&application, touchFunctor);
-
-  // Render and notify
-  application.SendNotification();
-  application.Render();
-
-  SignalData             data;
-  GestureReceivedFunctor functor(data);
-
-  PanGestureDetector detector = PanGestureDetector::New();
-  detector.Attach(actor);
-  detector.DetectedSignal().Connect(&application, functor);
-
-  // Start gesture within the actor's area, we should receive the pan as the touch is NOT being consumed
-  uint32_t time = 100;
-  TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
-  data.Reset();
-
-  // Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
-  consume = true;
-
-  TestMovePan(application, Vector2(26.0f, 4.0f), time);
-  time += TestGetFrameInterval();
-
-  DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
-  DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
-
-  END_TEST;
-}
-
 int UtcDaliPanGestureDisableDetectionDuringPanN(void)
 {
   // Crash occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached