/*
- * 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.
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)
{
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();
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;
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;
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