X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=automated-tests%2Fsrc%2Fdali%2Futc-Dali-RotationGestureDetector.cpp;h=8c1d92936b039a3eaeda10883d0b46aa5122aa2f;hb=a3d1c0e03068de2d010009baac4007bec662ee45;hp=2f3e3f92443afd76772198993cdb3ecbd358b1c4;hpb=0741b58e8e53e8ea7b897c2e21aac6b4da733192;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp index 2f3e3f9..8c1d929 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 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. @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -130,7 +131,6 @@ int UtcDaliRotationGestureDetectorCopyConstructorP(void) TestApplication application; RotationGestureDetector detector = RotationGestureDetector::New(); - ; RotationGestureDetector copy(detector); DALI_TEST_CHECK(detector); @@ -142,7 +142,6 @@ int UtcDaliRotationGestureDetectorAssignmentOperatorP(void) TestApplication application; RotationGestureDetector detector = RotationGestureDetector::New(); - ; RotationGestureDetector assign; assign = detector; @@ -152,6 +151,34 @@ int UtcDaliRotationGestureDetectorAssignmentOperatorP(void) END_TEST; } +int UtcDaliRotationGestureDetectorMoveConstructorP(void) +{ + TestApplication application; + + RotationGestureDetector detector = RotationGestureDetector::New(); + DALI_TEST_CHECK(detector); + + RotationGestureDetector moved = std::move(detector); + DALI_TEST_CHECK(moved); + DALI_TEST_CHECK(!detector); + END_TEST; +} + +int UtcDaliRotationGestureDetectorMoveAssignmentOperatorP(void) +{ + TestApplication application; + + RotationGestureDetector detector; + detector = RotationGestureDetector::New(); + DALI_TEST_CHECK(detector); + + RotationGestureDetector moved; + moved = std::move(detector); + DALI_TEST_CHECK(moved); + DALI_TEST_CHECK(!detector); + END_TEST; +} + int UtcDaliRotationGestureDetectorNew(void) { TestApplication application; @@ -1044,52 +1071,6 @@ int UtcDaliRotationGestureLayerConsumesTouch(void) END_TEST; } -int UtcDaliRotationGestureInterruptedWhenTouchConsumed(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); - - RotationGestureDetector detector = RotationGestureDetector::New(); - detector.Attach(actor); - detector.DetectedSignal().Connect(&application, functor); - - // Start gesture within the actor's area, we should receive the rotation as the touch is NOT being consumed - TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); - - 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; - - TestContinueRotation(application, Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), Vector2(15.0f, 20.0f), Vector2(25.0f, 20.0f), 500); - DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); - DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION); - data.Reset(); - - // Start another rotation, we should not even get the callback this time - TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); - DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION); - - END_TEST; -} - int UtcDaliRotationGestureDisableDetectionDuringRotationN(void) { // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached @@ -1136,3 +1117,58 @@ int UtcDaliRotationGestureDisableDetectionDuringRotationN(void) END_TEST; } + +int UtcDaliRotationGestureWhenGesturePropargation(void) +{ + TestApplication application; + + Actor parentActor = Actor::New(); + parentActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + parentActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + + Actor childActor = Actor::New(); + childActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + childActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + + parentActor.Add(childActor); + application.GetScene().Add(parentActor); + + // Render and notify + application.SendNotification(); + application.Render(); + + SignalData pData; + GestureReceivedFunctor pFunctor(pData); + + RotationGestureDetector parentDetector = RotationGestureDetector::New(); + parentDetector.Attach(parentActor); + parentDetector.DetectedSignal().Connect(&application, pFunctor); + + SignalData cData; + GestureReceivedFunctor cFunctor(cData); + + RotationGestureDetector childDetector = RotationGestureDetector::New(); + childDetector.Attach(childActor); + childDetector.DetectedSignal().Connect(&application, cFunctor); + + // Start gesture within the actor's area, we receive the gesture not parent actor but child actor. + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 100); + TestEndRotation(application, Vector2(6.0f, 6.0f), Vector2(18.0f, 18.0f), Vector2(10.0f, 8.0f), Vector2(14.0f, 16.0f), 300); + DALI_TEST_EQUALS(true, cData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(false, pData.functorCalled, TEST_LOCATION); + cData.Reset(); + pData.Reset(); + + // If GesturePropargation is set, a gesture event is to pass over to the parent. + Dali::DevelActor::SetNeedGesturePropagation(childActor, true); + + // So now the parent got the gesture event. + TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 700); + TestEndRotation(application, Vector2(6.0f, 6.0f), Vector2(18.0f, 18.0f), Vector2(10.0f, 8.0f), Vector2(14.0f, 16.0f), 900); + DALI_TEST_EQUALS(true, cData.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(true, pData.functorCalled, TEST_LOCATION); + cData.Reset(); + pData.Reset(); + + END_TEST; +} \ No newline at end of file