2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-test-suite-utils.h>
19 #include <dali/devel-api/actors/actor-devel.h>
20 #include <dali/integration-api/events/touch-event-integ.h>
21 #include <dali/integration-api/events/touch-integ.h>
22 #include <dali/integration-api/render-task-list-integ.h>
23 #include <dali/internal/event/events/touch-event-impl.h>
24 #include <dali/internal/event/render-tasks/render-task-impl.h>
25 #include <dali/public-api/dali-core.h>
27 #include <test-touch-event-utils.h>
33 void utc_dali_tap_gesture_detector_startup(void)
35 test_return_value = TET_UNDEF;
38 void utc_dali_tap_gesture_detector_cleanup(void)
40 test_return_value = TET_PASS;
43 ///////////////////////////////////////////////////////////////////////////////
46 bool gHitTestTouchCallBackCalled = false;
47 static bool TestHitTestTouchCallback(Actor, const TouchEvent&)
49 gHitTestTouchCallBackCalled = true;
53 // Stores data that is populated in the callback and will be read by the TET cases
57 : functorCalled(false),
58 voidFunctorCalled(false)
64 functorCalled = false;
65 voidFunctorCalled = false;
67 receivedGesture.Reset();
73 bool voidFunctorCalled;
74 TapGesture receivedGesture;
78 // Functor that sets the data when called
79 struct GestureReceivedFunctor
81 GestureReceivedFunctor(SignalData& data)
86 void operator()(Actor actor, const TapGesture& tap)
88 signalData.functorCalled = true;
89 signalData.receivedGesture = tap;
90 signalData.tappedActor = actor;
95 signalData.voidFunctorCalled = true;
98 SignalData& signalData;
101 // Functor that removes the gestured actor from stage
102 struct UnstageActorFunctor : public GestureReceivedFunctor
104 UnstageActorFunctor(SignalData& data, Integration::Scene scene)
105 : GestureReceivedFunctor(data),
110 void operator()(Actor actor, const TapGesture& tap)
112 GestureReceivedFunctor::operator()(actor, tap);
116 Integration::Scene scene;
119 // Functor for receiving a touch event
120 struct TouchEventFunctor
122 bool operator()(Actor actor, const TouchEvent& touch)
125 unsigned int points = touch.GetPointCount();
128 tet_printf("Touch Point state = %d\n", touch.GetState(0));
134 Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, int source, uint32_t time)
136 Integration::TouchEvent touchEvent;
137 Integration::Point point;
138 point.SetState(state);
139 point.SetDeviceId(4);
140 point.SetScreenPosition(screenPosition);
141 point.SetDeviceClass(Device::Class::TOUCH);
142 point.SetDeviceSubclass(Device::Subclass::NONE);
143 point.SetMouseButton(static_cast<MouseButton::Type>(source));
144 touchEvent.points.push_back(point);
145 touchEvent.time = time;
149 Integration::TouchEvent GenerateSingleMouse(PointState::Type state, const Vector2& screenPosition, int source, uint32_t time)
151 Integration::TouchEvent touchEvent;
152 Integration::Point point;
153 point.SetState(state);
154 point.SetDeviceId(4);
155 point.SetScreenPosition(screenPosition);
156 point.SetDeviceClass(Device::Class::MOUSE);
157 point.SetDeviceSubclass(Device::Subclass::NONE);
158 point.SetMouseButton(static_cast<MouseButton::Type>(source));
159 touchEvent.points.push_back(point);
160 touchEvent.time = time;
166 ///////////////////////////////////////////////////////////////////////////////
168 // Positive test case for a method
169 int UtcDaliTapGestureDetectorConstructor(void)
171 TestApplication application;
173 TapGestureDetector detector;
174 DALI_TEST_CHECK(!detector);
178 int UtcDaliTapGestureDetectorCopyConstructorP(void)
180 TestApplication application;
182 TapGestureDetector detector = TapGestureDetector::New();
184 TapGestureDetector copy(detector);
185 DALI_TEST_CHECK(detector);
189 int UtcDaliTapGestureDetectorAssignmentOperatorP(void)
191 TestApplication application;
193 TapGestureDetector detector = TapGestureDetector::New();
195 TapGestureDetector assign;
197 DALI_TEST_CHECK(detector);
199 DALI_TEST_CHECK(detector == assign);
203 int UtcDaliRTapGestureDetectorMoveConstructorP(void)
205 TestApplication application;
207 TapGestureDetector detector = TapGestureDetector::New();
208 DALI_TEST_CHECK(detector);
210 TapGestureDetector moved = std::move(detector);
211 DALI_TEST_CHECK(moved);
212 DALI_TEST_CHECK(!detector);
216 int UtcDaliTapGestureDetectorMoveAssignmentOperatorP(void)
218 TestApplication application;
220 TapGestureDetector detector;
221 detector = TapGestureDetector::New();
222 DALI_TEST_CHECK(detector);
224 TapGestureDetector moved;
225 moved = std::move(detector);
226 DALI_TEST_CHECK(moved);
227 DALI_TEST_CHECK(!detector);
231 int UtcDaliTapGestureDetectorNew(void)
233 TestApplication application;
235 TapGestureDetector detector = TapGestureDetector::New();
236 DALI_TEST_CHECK(detector);
237 DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION);
238 DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION);
240 TapGestureDetector detector2 = TapGestureDetector::New(5u);
241 DALI_TEST_CHECK(detector2);
242 DALI_TEST_EQUALS(5u, detector2.GetMinimumTapsRequired(), TEST_LOCATION);
243 DALI_TEST_EQUALS(5u, detector2.GetMaximumTapsRequired(), TEST_LOCATION);
245 //Scoped test to test destructor
247 TapGestureDetector detector3 = TapGestureDetector::New();
248 DALI_TEST_CHECK(detector3);
251 // Attach an actor and emit a touch event on the actor to ensure complete line coverage
252 Actor actor = Actor::New();
253 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
254 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
255 application.GetScene().Add(actor);
258 application.SendNotification();
259 application.Render();
261 detector.Attach(actor);
263 TouchEventFunctor touchFunctor;
264 actor.TouchedSignal().Connect(&application, touchFunctor);
266 Integration::TouchEvent touchEvent(1);
267 Integration::Point point;
268 point.SetDeviceId(1);
269 point.SetState(PointState::DOWN);
270 point.SetScreenPosition(Vector2(20.0f, 20.0f));
271 touchEvent.AddPoint(point);
272 application.ProcessEvent(touchEvent);
275 application.SendNotification();
276 application.Render();
281 int UtcDaliTapGestureDetectorDownCast(void)
283 TestApplication application;
284 tet_infoline("Testing Dali::TapGestureDetector::DownCast()");
286 TapGestureDetector detector = TapGestureDetector::New();
288 BaseHandle object(detector);
290 TapGestureDetector detector2 = TapGestureDetector::DownCast(object);
291 DALI_TEST_CHECK(detector2);
293 TapGestureDetector detector3 = DownCast<TapGestureDetector>(object);
294 DALI_TEST_CHECK(detector3);
296 BaseHandle unInitializedObject;
297 TapGestureDetector detector4 = TapGestureDetector::DownCast(unInitializedObject);
298 DALI_TEST_CHECK(!detector4);
300 TapGestureDetector detector5 = DownCast<TapGestureDetector>(unInitializedObject);
301 DALI_TEST_CHECK(!detector5);
303 GestureDetector detector6 = TapGestureDetector::New();
304 TapGestureDetector detector7 = TapGestureDetector::DownCast(detector6);
305 DALI_TEST_CHECK(detector7);
309 int UtcDaliTapGestureSetTapsRequiredMinMaxCheck(void)
311 TestApplication application;
313 // Attach an actor and change the required touches
315 Actor actor = Actor::New();
316 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
317 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
318 application.GetScene().Add(actor);
321 application.SendNotification();
322 application.Render();
325 GestureReceivedFunctor functor(data);
327 // Set the minimum to be greater than the maximum, should not receive the tap event.
328 TapGestureDetector detector = TapGestureDetector::New();
329 detector.SetMinimumTapsRequired(2u);
330 detector.SetMaximumTapsRequired(1u);
331 detector.Attach(actor);
332 detector.DetectedSignal().Connect(&application, functor);
334 TestGenerateTap(application, 50.0f, 50.0f, 100);
335 // detector don't get the tap event.
336 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
339 // detector don't get the tap event.
340 TestGenerateTap(application, 50.0f, 50.0f, 120);
341 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
346 int UtcDaliTapGestureGetTapsRequired(void)
348 TestApplication application;
350 TapGestureDetector detector = TapGestureDetector::New();
351 DALI_TEST_EQUALS(1u, detector.GetMinimumTapsRequired(), TEST_LOCATION);
352 DALI_TEST_EQUALS(1u, detector.GetMaximumTapsRequired(), TEST_LOCATION);
356 int UtcDaliTapGestureSignalReceptionNegative(void)
358 TestApplication application;
360 Actor actor = Actor::New();
361 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
362 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
363 application.GetScene().Add(actor);
366 application.SendNotification();
367 application.Render();
370 GestureReceivedFunctor functor(data);
372 TapGestureDetector detector = TapGestureDetector::New();
373 detector.Attach(actor);
374 detector.DetectedSignal().Connect(&application, functor);
376 // Do a tap outside actor's area
377 TestGenerateTap(application, 112.0f, 112.0f, 100);
378 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
382 int UtcDaliTapGestureSignalReceptionPositive(void)
384 TestApplication application;
386 Actor actor = Actor::New();
387 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
388 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
389 application.GetScene().Add(actor);
392 application.SendNotification();
393 application.Render();
396 GestureReceivedFunctor functor(data);
398 TapGestureDetector detector = TapGestureDetector::New();
399 detector.Attach(actor);
400 detector.DetectedSignal().Connect(&application, functor);
402 // Do a tap inside actor's area
403 TestGenerateTap(application, 50.0f, 50.0f, 100);
404 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
405 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
406 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
407 DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
411 int UtcDaliTapGestureSignalReceptionDetach(void)
413 TestApplication application;
415 Actor actor = Actor::New();
416 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
417 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
418 application.GetScene().Add(actor);
421 application.SendNotification();
422 application.Render();
425 GestureReceivedFunctor functor(data);
427 TapGestureDetector detector = TapGestureDetector::New();
428 detector.Attach(actor);
429 detector.DetectedSignal().Connect(&application, functor);
431 // Start tap within the actor's area
432 TestGenerateTap(application, 20.0f, 20.0f, 100);
433 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
434 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
435 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
436 DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
438 // repeat the tap within the actor's area - we should still receive the signal
440 TestGenerateTap(application, 50.0f, 50.0f, 700);
441 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
442 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
443 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
444 DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
447 detector.DetachAll();
449 // Ensure we are no longer signalled
451 TestGenerateTap(application, 20.0f, 20.0f, 1300);
452 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
453 TestGenerateTap(application, 50.0f, 50.0f, 1900);
454 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
458 int UtcDaliTapGestureSignalReceptionActorDestroyedWhileTapping(void)
460 TestApplication application;
463 GestureReceivedFunctor functor(data);
465 TapGestureDetector detector = TapGestureDetector::New();
466 detector.DetectedSignal().Connect(&application, functor);
468 // Actor lifetime is scoped
470 Actor actor = Actor::New();
471 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
472 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
473 application.GetScene().Add(actor);
476 application.SendNotification();
477 application.Render();
479 detector.Attach(actor);
481 // Start tap within the actor's area
482 TestGenerateTap(application, 20.0f, 20.0f, 100);
483 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
485 // Remove the actor from stage and reset the data
486 application.GetScene().Remove(actor);
489 application.SendNotification();
490 application.Render();
493 // Actor should now have been destroyed
496 TestGenerateTap(application, 20.0f, 20.0f, 700);
497 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
501 int UtcDaliTapGestureSignalReceptionRotatedActor(void)
503 TestApplication application;
505 Actor actor = Actor::New();
506 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
507 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
508 application.GetScene().Add(actor);
511 application.SendNotification();
512 application.Render();
515 GestureReceivedFunctor functor(data);
517 TapGestureDetector detector = TapGestureDetector::New();
518 detector.Attach(actor);
519 detector.DetectedSignal().Connect(&application, functor);
521 // Do tap, only check finished value
522 TestGenerateTap(application, 5.0f, 5.0f, 100);
523 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
524 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
525 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
526 DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
528 // Rotate actor again and render
529 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS));
530 application.SendNotification();
531 application.Render();
533 // Do tap, should still receive event
535 TestGenerateTap(application, 5.0f, 5.0f, 700);
536 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
537 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
538 DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
539 DALI_TEST_EQUALS(Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
541 // Rotate actor again and render
542 actor.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS));
543 application.SendNotification();
544 application.Render();
546 // Do tap, inside the actor's area (area if it is not rotated), Should not receive the event
548 TestGenerateTap(application, 70.0f, 70.0f, 1300);
549 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
553 int UtcDaliTapGestureSignalReceptionChildHit(void)
555 TestApplication application;
557 Actor parent = Actor::New();
558 parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
559 parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
560 application.GetScene().Add(parent);
562 // Set child to completely cover parent.
563 // Change rotation of child to be different from parent so that we can check if our local coordinate
564 // conversion of the parent actor is correct.
565 Actor child = Actor::New();
566 child.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
567 child.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
568 child.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
569 child.SetProperty(Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::ZAXIS));
572 TouchEventFunctor touchFunctor;
573 child.TouchedSignal().Connect(&application, touchFunctor);
576 application.SendNotification();
577 application.Render();
580 GestureReceivedFunctor functor(data);
582 TapGestureDetector detector = TapGestureDetector::New();
583 detector.Attach(parent);
584 detector.DetectedSignal().Connect(&application, functor);
586 // Do tap - hits child area but parent should still receive it
587 TestGenerateTap(application, 50.0f, 50.0f, 100);
588 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
589 DALI_TEST_EQUALS(true, parent == data.tappedActor, TEST_LOCATION);
590 DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
592 // Attach child and generate same touch points
593 // (Also proves that you can detach and then re-attach another actor)
594 detector.Attach(child);
595 detector.Detach(parent);
597 // Do an entire tap, only check finished value
599 TestGenerateTap(application, 51.0f, 51.0f, 700);
600 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
601 DALI_TEST_EQUALS(true, child == data.tappedActor, TEST_LOCATION);
602 DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
606 int UtcDaliTapGestureSignalReceptionAttachDetachMany(void)
608 TestApplication application;
610 Actor first = Actor::New();
611 first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
612 first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
613 application.GetScene().Add(first);
615 Actor second = Actor::New();
616 second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
617 second.SetProperty(Actor::Property::POSITION_X, 100.0f);
618 second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
619 application.GetScene().Add(second);
622 application.SendNotification();
623 application.Render();
626 GestureReceivedFunctor functor(data);
628 TapGestureDetector detector = TapGestureDetector::New();
629 detector.Attach(first);
630 detector.Attach(second);
631 detector.DetectedSignal().Connect(&application, functor);
633 // Tap within second actor's area
634 TestGenerateTap(application, 120.0f, 10.0f, 100);
635 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
636 DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
638 // Tap within first actor's area
640 TestGenerateTap(application, 20.0f, 10.0f, 700);
641 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
642 DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
644 // Detach the second actor
645 detector.Detach(second);
647 // second actor shouldn't receive event
649 TestGenerateTap(application, 120.0f, 10.0f, 1300);
650 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
652 // first actor should continue receiving event
654 TestGenerateTap(application, 20.0f, 10.0f, 1900);
655 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
659 int UtcDaliTapGestureSignalReceptionActorBecomesUntouchable(void)
661 TestApplication application;
663 Actor actor = Actor::New();
664 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
665 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
666 application.GetScene().Add(actor);
669 application.SendNotification();
670 application.Render();
673 GestureReceivedFunctor functor(data);
675 TapGestureDetector detector = TapGestureDetector::New();
676 detector.Attach(actor);
677 detector.DetectedSignal().Connect(&application, functor);
679 // Tap in actor's area
680 TestGenerateTap(application, 50.0f, 10.0f, 100);
681 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
683 // Actor become invisible - actor should not receive the next pan
684 actor.SetProperty(Actor::Property::VISIBLE, false);
687 application.SendNotification();
688 application.Render();
690 // Tap in the same area, shouldn't receive event
692 TestGenerateTap(application, 50.0f, 10.0f, 700);
693 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
697 int UtcDaliTapGestureSignalReceptionMultipleGestureDetectors(void)
699 TestApplication application;
701 Actor first = Actor::New();
702 first.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
703 first.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
704 application.GetScene().Add(first);
706 Actor second = Actor::New();
707 second.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
708 second.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
709 second.SetProperty(Actor::Property::POSITION_X, 100.0f);
713 application.SendNotification();
714 application.Render();
717 GestureReceivedFunctor functor(data);
719 TapGestureDetector firstDetector = TapGestureDetector::New();
720 firstDetector.Attach(first);
721 firstDetector.DetectedSignal().Connect(&application, functor);
723 // secondDetector is scoped
725 TapGestureDetector secondDetector = TapGestureDetector::New(2);
726 secondDetector.Attach(second);
727 secondDetector.DetectedSignal().Connect(&application, functor);
729 // Tap within second actor's area
730 TestGenerateTap(application, 150.0f, 10.0f, 100);
731 TestGenerateTap(application, 150.0f, 10.0f, 200);
733 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
734 DALI_TEST_EQUALS(true, second == data.tappedActor, TEST_LOCATION);
736 // Tap continues as single touch gesture - we should not receive any gesture
738 TestGenerateTap(application, 150.0f, 10.0f, 800);
739 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
741 // Single touch tap starts - first actor should be panned
743 TestGenerateTap(application, 50.0f, 10.0f, 1400);
744 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
745 DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
747 // Tap changes to double-touch - we shouldn't receive event
750 TestGenerateTwoPointTap(application, 50.0f, 10.0f, 60.0f, 20.0f, 2000);
752 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
758 int UtcDaliTapGestureSignalReceptionMultipleDetectorsOnActor(void)
760 TestApplication application;
762 Actor actor = Actor::New();
763 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
764 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
765 application.GetScene().Add(actor);
768 application.SendNotification();
769 application.Render();
771 // Attach actor to one detector
772 SignalData firstData;
773 GestureReceivedFunctor firstFunctor(firstData);
774 TapGestureDetector firstDetector = TapGestureDetector::New();
775 firstDetector.Attach(actor);
776 firstDetector.DetectedSignal().Connect(&application, firstFunctor);
778 // Attach actor to another detector
779 SignalData secondData;
780 GestureReceivedFunctor secondFunctor(secondData);
781 TapGestureDetector secondDetector = TapGestureDetector::New();
782 secondDetector.Attach(actor);
783 secondDetector.DetectedSignal().Connect(&application, secondFunctor);
785 // Tap in actor's area - both detector's functors should be called
786 TestGenerateTap(application, 50.0f, 10.0f, 100);
787 DALI_TEST_EQUALS(true, firstData.functorCalled, TEST_LOCATION);
788 DALI_TEST_EQUALS(true, secondData.functorCalled, TEST_LOCATION);
792 int UtcDaliTapGestureSignalReceptionDifferentPossible(void)
794 TestApplication application;
796 Actor actor = Actor::New();
797 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
798 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
799 application.GetScene().Add(actor);
802 application.SendNotification();
803 application.Render();
805 // Attach actor to detector
807 GestureReceivedFunctor functor(data);
808 TapGestureDetector detector = TapGestureDetector::New();
809 detector.Attach(actor);
810 detector.DetectedSignal().Connect(&application, functor);
812 // Gesture possible in actor's area.
813 TestStartLongPress(application, 50.0f, 10.0f, 100);
814 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
816 // Move actor somewhere else
817 actor.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
820 application.SendNotification();
821 application.Render();
823 // Emit STARTED event, we should not receive the tap.
824 TestEndPan(application, Vector2(50.0f, 10.0f), 120);
825 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
827 // Tap possible in empty area.
828 TestStartLongPress(application, 50.0f, 10.0f, 700);
829 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
831 // Move actor in to the tap position.
832 actor.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
835 application.SendNotification();
836 application.Render();
838 // Emit STARTED event, we should not receive the tap.
839 TestEndPan(application, Vector2(50.0f, 10.0f), 720);
840 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
842 // Normal tap in actor's area for completeness.
843 TestGenerateTap(application, 50.0f, 10.0f, 1300);
844 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
848 int UtcDaliTapGestureActorUnstaged(void)
850 TestApplication application;
852 Actor actor = Actor::New();
853 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
854 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
855 application.GetScene().Add(actor);
858 application.SendNotification();
859 application.Render();
861 // Attach actor to detector
863 UnstageActorFunctor functor(data, application.GetScene());
864 TapGestureDetector detector = TapGestureDetector::New();
865 detector.Attach(actor);
866 detector.DetectedSignal().Connect(&application, functor);
868 TestGenerateTap(application, 50.0f, 10.0f, 100);
869 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
870 tet_result(TET_PASS); // If we get here, then the actor removal on signal handler was handled gracefully.
874 int UtcDaliTapGestureDetectorRemovedWhilePossible(void)
876 TestApplication application;
878 Actor actor = Actor::New();
879 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
880 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
881 application.GetScene().Add(actor);
884 application.SendNotification();
885 application.Render();
887 // Attach actor to detector
889 GestureReceivedFunctor functor(data);
890 TapGestureDetector detector = TapGestureDetector::New();
891 detector.Attach(actor);
892 detector.DetectedSignal().Connect(&application, functor);
894 // Emit a possible - Down press, as emitted by long press function
895 TestStartLongPress(application, 50.0f, 10.0f, 100);
897 // Detach actor and send a STARTED state, no signal.
898 detector.DetachAll();
899 TestEndPan(application, Vector2(50.0f, 10.0f), 120);
900 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
904 int UtcDaliTapGestureActorRemovedWhilePossible(void)
906 TestApplication application;
908 Actor actor = Actor::New();
909 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
910 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
911 application.GetScene().Add(actor);
914 application.SendNotification();
915 application.Render();
917 // Attach actor to detector
919 GestureReceivedFunctor functor(data);
920 TapGestureDetector detector = TapGestureDetector::New();
921 detector.Attach(actor);
922 detector.DetectedSignal().Connect(&application, functor);
924 // Emit a possible - Down press, as emitted by long press function
925 TestStartLongPress(application, 50.0f, 10.0f, 100);
927 // Remove, render and delete actor
928 application.GetScene().Remove(actor);
929 application.SendNotification();
930 application.Render();
933 // Send a STARTED state, no signal - Up motion as provided by end pan function
934 TestEndPan(application, Vector2(50.0f, 10.0f), 120);
935 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
939 int UtcDaliTapGestureLayerConsumesTouch(void)
941 TestApplication application;
943 Actor actor = Actor::New();
944 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
945 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
946 application.GetScene().Add(actor);
950 GestureReceivedFunctor functor(data);
951 TapGestureDetector detector = TapGestureDetector::New();
952 detector.Attach(actor);
953 detector.DetectedSignal().Connect(&application, functor);
955 // Add a layer to overlap the actor
956 Layer layer = Layer::New();
957 layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
958 layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
959 application.GetScene().Add(layer);
963 application.SendNotification();
964 application.Render();
966 // Emit signals, should receive
967 TestGenerateTap(application, 50.0f, 50.0f, 100);
968 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
971 // Set layer to consume all touch
972 layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
975 application.SendNotification();
976 application.Render();
978 // Emit the same signals again, should not receive
979 TestGenerateTap(application, 50.0f, 50.0f, 700);
980 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
986 int UtcDaliTapGestureDisableDetectionDuringTapN(void)
988 // Crash sometimes occurred when gesture-recognizer was deleted internally during a signal when the attached actor was detached
990 TestApplication application;
992 Actor actor = Actor::New();
993 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
994 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
995 application.GetScene().Add(actor);
998 TapGestureDetector detector = TapGestureDetector::New();
999 bool functorCalled = false;
1000 detector.Attach(actor);
1001 detector.DetectedSignal().Connect(
1003 [&detector, &functorCalled](Actor actor, const TapGesture& gesture) {
1004 detector.Detach(actor);
1005 functorCalled = true;
1008 // Render and notify
1009 application.SendNotification();
1010 application.Render();
1012 // Try the gesture, should not crash
1015 TestGenerateTap(application, 50.0f, 10.0f);
1017 DALI_TEST_CHECK(true); // No crash, test has passed
1018 DALI_TEST_EQUALS(functorCalled, true, TEST_LOCATION);
1022 DALI_TEST_CHECK(false); // If we crash, the test has failed
1028 int UtcDaliTapGestureWhenGesturePropargation(void)
1030 TestApplication application;
1032 Actor parentActor = Actor::New();
1033 parentActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1034 parentActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1036 Actor childActor = Actor::New();
1037 childActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1038 childActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1040 parentActor.Add(childActor);
1041 application.GetScene().Add(parentActor);
1043 // Render and notify
1044 application.SendNotification();
1045 application.Render();
1048 GestureReceivedFunctor pFunctor(pData);
1050 TapGestureDetector parentDetector = TapGestureDetector::New();
1051 parentDetector.Attach(parentActor);
1052 parentDetector.DetectedSignal().Connect(&application, pFunctor);
1055 GestureReceivedFunctor cFunctor(cData);
1057 TapGestureDetector childDetector = TapGestureDetector::New();
1058 childDetector.Attach(childActor);
1059 childDetector.DetectedSignal().Connect(&application, cFunctor);
1061 // Start gesture within the actor's area, we receive the gesture not parent actor but child actor.
1062 TestGenerateTap(application, 50.0f, 50.0f, 100);
1063 DALI_TEST_EQUALS(true, cData.functorCalled, TEST_LOCATION);
1064 DALI_TEST_EQUALS(false, pData.functorCalled, TEST_LOCATION);
1068 // If GesturePropargation is set, a gesture event is delivered to the parent.
1069 Dali::DevelActor::SetNeedGesturePropagation(childActor, true);
1071 // So now the parent got the gesture event.
1072 TestGenerateTap(application, 50.0f, 50.0f, 700);
1073 DALI_TEST_EQUALS(true, cData.functorCalled, TEST_LOCATION);
1074 DALI_TEST_EQUALS(true, pData.functorCalled, TEST_LOCATION);
1081 int UtcDaliTapGestureGetSourceTypeWithMouse(void)
1083 TestApplication application;
1085 Actor actor = Actor::New();
1086 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1087 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1088 application.GetScene().Add(actor);
1090 // Render and notify
1091 application.SendNotification();
1092 application.Render();
1095 GestureReceivedFunctor functor(data);
1097 TapGestureDetector detector = TapGestureDetector::New();
1098 detector.Attach(actor);
1099 detector.DetectedSignal().Connect(&application, functor);
1101 // Emit a down signal with MouseButton
1102 application.ProcessEvent(GenerateSingleMouse(PointState::DOWN, Vector2(20.0f, 20.0f), 1, 100));
1103 application.ProcessEvent(GenerateSingleMouse(PointState::UP, Vector2(20.0f, 20.0f), 1, 120));
1104 application.SendNotification();
1106 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1107 DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
1108 DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_PRIMARY, TEST_LOCATION);
1112 // Emit a down signal with MouseButton
1113 application.ProcessEvent(GenerateSingleMouse(PointState::DOWN, Vector2(20.0f, 20.0f), 3, 1300));
1114 application.ProcessEvent(GenerateSingleMouse(PointState::UP, Vector2(20.0f, 20.0f), 3, 1320));
1115 application.SendNotification();
1117 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1118 DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
1119 DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_SECONDARY, TEST_LOCATION);
1123 // Emit a down signal with MouseButton
1124 application.ProcessEvent(GenerateSingleMouse(PointState::DOWN, Vector2(20.0f, 20.0f), 2, 1900));
1125 application.ProcessEvent(GenerateSingleMouse(PointState::UP, Vector2(20.0f, 20.0f), 2, 1920));
1126 application.SendNotification();
1128 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1129 DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::MOUSE, TEST_LOCATION);
1130 DALI_TEST_EQUALS(data.receivedGesture.GetSourceData(), GestureSourceData::MOUSE_TERTIARY, TEST_LOCATION);
1135 int UtcDaliTapGestureGetSourceTypeWithTouch(void)
1137 TestApplication application;
1139 Actor actor = Actor::New();
1140 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1141 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1142 application.GetScene().Add(actor);
1144 // Render and notify
1145 application.SendNotification();
1146 application.Render();
1149 GestureReceivedFunctor functor(data);
1151 TapGestureDetector detector = TapGestureDetector::New();
1152 detector.Attach(actor);
1153 detector.DetectedSignal().Connect(&application, functor);
1155 // Emit a down signal with touch
1156 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 1, 100));
1157 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 1, 120));
1158 application.SendNotification();
1160 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1161 DALI_TEST_EQUALS(data.receivedGesture.GetSourceType(), GestureSourceType::TOUCH, TEST_LOCATION);
1168 int UtcDaliTapGestureReceiveAllTapEvents(void)
1170 TestApplication application;
1172 Actor actor = Actor::New();
1173 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1174 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1176 application.GetScene().Add(actor);
1178 // Render and notify
1179 application.SendNotification();
1180 application.Render();
1183 GestureReceivedFunctor functor(data);
1185 TapGestureDetector detector = TapGestureDetector::New();
1186 detector.SetMaximumTapsRequired(2u);
1187 detector.Attach(actor);
1188 detector.DetectedSignal().Connect(&application, functor);
1190 // Emit signals, Because MaximumTapsRequired is 2, a timer that checks whether it is a single tap or a double tap operates internally.
1191 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 100));
1192 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 120));
1193 application.SendNotification();
1195 // So detector don't get the tap event yet.
1196 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1199 // Emit signals, Send the second tab.
1200 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 130));
1201 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 150));
1202 application.SendNotification();
1203 application.GetPlatform().TriggerTimer();
1205 // It find out to be a double tap. Detector receives events.
1206 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1209 // Detector want to receive all tap events.
1210 detector.ReceiveAllTapEvents(true);
1212 // Emit signals, should receive
1213 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 500));
1214 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 520));
1215 application.SendNotification();
1217 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1220 // Emit signals, should receive
1221 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 530));
1222 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 550));
1223 application.SendNotification();
1225 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1231 int UtcDaliTapGestureDoesWantedHitTest(void)
1233 TestApplication application;
1235 Actor blue = Actor::New();
1236 blue.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1237 blue.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1239 Actor green = Actor::New();
1240 green.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1241 green.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1243 application.GetScene().Add(blue);
1244 application.GetScene().Add(green);
1246 // Render and notify
1247 application.SendNotification();
1248 application.Render();
1250 SignalData blueData;
1251 GestureReceivedFunctor blueFunctor(blueData);
1253 TapGestureDetector blueDetector = TapGestureDetector::New();
1254 blueDetector.Attach(blue);
1255 blueDetector.DetectedSignal().Connect(&application, blueFunctor);
1257 SignalData greenData;
1258 GestureReceivedFunctor greenFunctor(greenData);
1260 TapGestureDetector greenDetector = TapGestureDetector::New();
1261 greenDetector.Attach(green);
1262 greenDetector.DetectedSignal().Connect(&application, greenFunctor);
1264 // connect to its hit-test signal
1265 gHitTestTouchCallBackCalled = false;
1266 Dali::DevelActor::HitTestResultSignal(green).Connect(TestHitTestTouchCallback);
1268 // Emit a down signal
1269 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 0, 100));
1270 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 0, 120));
1271 application.SendNotification();
1273 // check hit-test events
1274 // The green actor received an event that the green actor was hit.
1275 DALI_TEST_EQUALS(true, gHitTestTouchCallBackCalled, TEST_LOCATION);
1277 // The green actor passed the hit-test. So blue was the final hit.
1278 DALI_TEST_EQUALS(false, greenData.functorCalled, TEST_LOCATION);
1279 DALI_TEST_EQUALS(true, blueData.functorCalled, TEST_LOCATION);
1287 int UtcDaliTapGestureDetectorCheck(void)
1289 TestApplication application;
1291 Actor actor = Actor::New();
1292 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1293 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1294 application.GetScene().Add(actor);
1296 Actor actor2 = Actor::New();
1297 actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1298 actor2.SetProperty(Actor::Property::POSITION, Vector2(100.0f, 100.0f));
1299 actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1300 application.GetScene().Add(actor2);
1302 // Render and notify
1303 application.SendNotification();
1304 application.Render();
1307 GestureReceivedFunctor functor(data);
1308 TapGestureDetector detector1 = TapGestureDetector::New();
1309 detector1.SetMaximumTapsRequired(1u);
1310 detector1.Attach(actor);
1311 detector1.DetectedSignal().Connect(&application, functor);
1313 TapGestureDetector detector2 = TapGestureDetector::New();
1314 detector2.SetMaximumTapsRequired(2u);
1315 detector2.Attach(actor2);
1317 // Emit signals, Send the single tab.
1318 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 100));
1319 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 120));
1320 application.SendNotification();
1322 // The detector1 get the tap event.
1323 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1326 // Emit signals, Send the second tab.
1327 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 0, 130));
1328 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 0, 150));
1329 application.SendNotification();
1331 // The detector1 must get the tap event. SetMaximumTapsRequired(2u) of detector2 should not affect detector1.
1332 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1338 int UtcDaliTapGestureFeedTouch(void)
1340 TestApplication application;
1341 Integration::Scene scene = application.GetScene();
1342 RenderTaskList taskList = scene.GetRenderTaskList();
1343 Dali::RenderTask task = taskList.GetTask(0);
1345 Actor parentActor = Actor::New();
1346 parentActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1347 parentActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1349 Actor childActor = Actor::New();
1350 childActor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1351 childActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1353 parentActor.Add(childActor);
1354 application.GetScene().Add(parentActor);
1356 // Render and notify
1357 application.SendNotification();
1358 application.Render();
1361 GestureReceivedFunctor pFunctor(pData);
1363 TapGestureDetector parentDetector = TapGestureDetector::New();
1364 parentDetector.DetectedSignal().Connect(&application, pFunctor);
1366 Integration::TouchEvent tp = GenerateSingleTouch(PointState::DOWN, Vector2(50.0f, 50.0f), 1, 100);
1367 Internal::TouchEventPtr touchEventImpl(new Internal::TouchEvent(100));
1368 touchEventImpl->AddPoint(tp.GetPoint(0));
1369 touchEventImpl->SetRenderTask(task);
1370 Dali::TouchEvent touchEventHandle(touchEventImpl.Get());
1371 parentDetector.FeedTouch(parentActor, touchEventHandle);
1373 tp = GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 1, 150);
1374 touchEventImpl = new Internal::TouchEvent(150);
1375 touchEventImpl->AddPoint(tp.GetPoint(0));
1376 touchEventImpl->SetRenderTask(task);
1377 touchEventHandle = Dali::TouchEvent(touchEventImpl.Get());
1378 parentDetector.FeedTouch(parentActor, touchEventHandle);
1380 DALI_TEST_EQUALS(true, pData.functorCalled, TEST_LOCATION);