A new gesture recognition method.
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-GeoTouchProcessing.cpp
1 /*
2  * Copyright (c) 2024 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
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/public-api/dali-core.h>
24 #include <stdlib.h>
25
26 #include <iostream>
27
28 using namespace Dali;
29
30 void utc_dali_geo_touch_processing_startup(void)
31 {
32   test_return_value = TET_UNDEF;
33 }
34
35 void utc_dali_geo_touch_processing_cleanup(void)
36 {
37   test_return_value = TET_PASS;
38 }
39
40 ///////////////////////////////////////////////////////////////////////////////
41
42 namespace
43 {
44 struct TestPoint
45 {
46   int32_t                deviceId{-1};
47   PointState::Type       state{PointState::FINISHED};
48   Actor                  hitActor;
49   Vector2                local;
50   Vector2                screen;
51   float                  radius{0};
52   Vector2                ellipseRadius;
53   float                  pressure{0};
54   Degree                 angle;
55   Device::Class::Type    deviceClass{Device::Class::NONE};
56   Device::Subclass::Type deviceSubclass{Device::Subclass::NONE};
57
58   TestPoint() = default;
59   static const TestPoint ZERO;
60 };
61
62 const TestPoint TestPoint::ZERO;
63
64 // Stores data that is populated in the callback and will be read by the TET cases
65 struct SignalData
66 {
67   SignalData()
68   : functorCalled(false),
69     receivedTouch(),
70     touchedActor()
71   {
72   }
73
74   struct TestTouchEvent
75   {
76     unsigned long          time;
77     std::vector<TestPoint> points;
78
79     const TestPoint& GetPoint(size_t i)
80     {
81       if(i < points.size())
82       {
83         return points[i];
84       }
85       return TestPoint::ZERO;
86     }
87     size_t GetPointCount()
88     {
89       return points.size();
90     }
91   };
92
93   void Reset()
94   {
95     functorCalled = false;
96
97     receivedTouch.time = 0u;
98     receivedTouch.points.clear();
99
100     touchedActor.Reset();
101   }
102
103   bool           functorCalled;
104   TestTouchEvent receivedTouch;
105   Actor          touchedActor;
106 };
107
108 // Functor that sets the data when called
109 struct TouchEventFunctor
110 {
111   /**
112    * Constructor.
113    * @param[in]  data         Reference to the data to store callback information.
114    * @param[in]  returnValue  What the functor should return.
115    */
116   TouchEventFunctor(SignalData& data, bool returnValue = true)
117   : signalData(data),
118     returnValue(returnValue)
119   {
120   }
121
122   bool operator()(Actor actor, const TouchEvent& touch)
123   {
124     signalData.functorCalled = true;
125     signalData.touchedActor  = actor;
126
127     signalData.receivedTouch.time = touch.GetTime();
128     signalData.receivedTouch.points.clear();
129
130     for(size_t i = 0; i < touch.GetPointCount(); ++i)
131     {
132       TestPoint p;
133       p.deviceId       = touch.GetDeviceId(i);
134       p.state          = touch.GetState(i);
135       p.hitActor       = touch.GetHitActor(i);
136       p.local          = touch.GetLocalPosition(i);
137       p.screen         = touch.GetScreenPosition(i);
138       p.radius         = touch.GetRadius(i);
139       p.ellipseRadius  = touch.GetEllipseRadius(i);
140       p.pressure       = touch.GetPressure(i);
141       p.angle          = touch.GetAngle(i);
142       p.deviceClass    = touch.GetDeviceClass(i);
143       p.deviceSubclass = touch.GetDeviceSubclass(i);
144       signalData.receivedTouch.points.push_back(p);
145     }
146
147     return returnValue;
148   }
149
150   SignalData& signalData;
151   bool        returnValue;
152 };
153
154 struct HandleData
155 {
156   bool       signalReceived;
157   TouchEvent receivedTouchHandle;
158
159   HandleData()
160   : signalReceived(false)
161   {
162   }
163 };
164
165 struct TouchEventHandleFunctor
166 {
167   /**
168    * Constructor.
169    * @param[in]  data         Reference to the data to store callback information.
170    * @param[in]  returnValue  What the functor should return.
171    */
172   TouchEventHandleFunctor(HandleData& handleData, bool returnValue = true)
173   : handleData(handleData),
174     returnValue(returnValue)
175   {
176   }
177
178   bool operator()(Actor actor, const TouchEvent& someTouchEvent)
179   {
180     handleData.signalReceived      = true;
181     handleData.receivedTouchHandle = someTouchEvent;
182     return returnValue;
183   }
184
185   HandleData& handleData;
186   bool        returnValue;
187 };
188
189 // Functor that removes the actor when called.
190 struct RemoveActorFunctor : public TouchEventFunctor
191 {
192   /**
193    * Constructor.
194    * @param[in]  data         Reference to the data to store callback information.
195    * @param[in]  returnValue  What the functor should return.
196    */
197   RemoveActorFunctor(SignalData& data, bool returnValue = true)
198   : TouchEventFunctor(data, returnValue)
199   {
200   }
201
202   bool operator()(Actor actor, const TouchEvent& touch)
203   {
204     Actor parent(actor.GetParent());
205     if(parent)
206     {
207       parent.Remove(actor);
208     }
209
210     return TouchEventFunctor::operator()(actor, touch);
211   }
212 };
213
214 struct OutOfBoundsData
215 {
216   TestPoint point;
217   bool      functorCalled;
218
219   OutOfBoundsData()
220   : functorCalled(false)
221   {
222   }
223 };
224
225 // Functor that reads out of bounds data when called
226 struct OutOfBoundsFunctor
227 {
228   /**
229    * Constructor.
230    * @param[in]  data         Reference to the data to store callback information.
231    * @param[in]  returnValue  What the functor should return.
232    */
233   OutOfBoundsFunctor(OutOfBoundsData& data, bool returnValue = true)
234   : outOfBoundsData(data),
235     returnValue(returnValue)
236   {
237   }
238
239   bool operator()(Actor actor, const TouchEvent& touch)
240   {
241     outOfBoundsData.functorCalled = true;
242     size_t count                  = touch.GetPointCount();
243
244     // Read out of bounds data
245     outOfBoundsData.point.deviceId = touch.GetDeviceId(count + 1);
246     outOfBoundsData.point.state    = touch.GetState(count + 1);
247     outOfBoundsData.point.hitActor = touch.GetHitActor(count + 1);
248     outOfBoundsData.point.local    = touch.GetLocalPosition(count + 1);
249     outOfBoundsData.point.screen   = touch.GetScreenPosition(count + 1);
250
251     return returnValue;
252   }
253
254   OutOfBoundsData& outOfBoundsData;
255   bool             returnValue;
256 };
257
258 Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition)
259 {
260   Integration::TouchEvent touchEvent;
261   Integration::Point      point;
262   point.SetState(state);
263   point.SetScreenPosition(screenPosition);
264   point.SetDeviceClass(Device::Class::TOUCH);
265   point.SetDeviceSubclass(Device::Subclass::NONE);
266   touchEvent.points.push_back(point);
267   return touchEvent;
268 }
269
270 } // namespace
271
272 ///////////////////////////////////////////////////////////////////////////////
273
274 int UtcDaliGeoTouchEventNormalProcessing01(void)
275 {
276   TestApplication application;
277
278   application.GetScene().SetGeometryHittestEnabled(true);
279
280   Actor actor = Actor::New();
281   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
282   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
283   application.GetScene().Add(actor);
284
285   // Render and notify
286   application.SendNotification();
287   application.Render();
288
289   // Connect to actor's touch signal
290   SignalData        data;
291   TouchEventFunctor functor(data);
292   actor.TouchedSignal().Connect(&application, functor);
293
294   Vector2 screenCoordinates(10.0f, 10.0f);
295   Vector2 localCoordinates;
296   actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
297
298   // Emit a down signal
299   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
300   const TestPoint* point1 = &data.receivedTouch.GetPoint(0);
301   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
302   DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
303   DALI_TEST_EQUALS(PointState::DOWN, point1->state, TEST_LOCATION);
304   DALI_TEST_EQUALS(screenCoordinates, point1->screen, TEST_LOCATION);
305   DALI_TEST_EQUALS(localCoordinates, point1->local, 0.1f, TEST_LOCATION);
306   data.Reset();
307
308   // Emit a motion signal
309   screenCoordinates.x = screenCoordinates.y = 11.0f;
310   actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
311   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
312   const TestPoint* point2 = &data.receivedTouch.GetPoint(0);
313   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
314   DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
315   DALI_TEST_EQUALS(PointState::MOTION, point2->state, TEST_LOCATION);
316   DALI_TEST_EQUALS(screenCoordinates, point2->screen, TEST_LOCATION);
317   DALI_TEST_EQUALS(localCoordinates, point2->local, 0.1f, TEST_LOCATION);
318   data.Reset();
319
320   // Emit an up signal
321   screenCoordinates.x = screenCoordinates.y = 12.0f;
322   actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
323   application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
324   const TestPoint* point3 = &data.receivedTouch.GetPoint(0);
325   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
326   DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
327   DALI_TEST_EQUALS(PointState::UP, point3->state, TEST_LOCATION);
328   DALI_TEST_EQUALS(screenCoordinates, point3->screen, TEST_LOCATION);
329   DALI_TEST_EQUALS(localCoordinates, point3->local, 0.1f, TEST_LOCATION);
330   data.Reset();
331
332   // Emit a down signal where the actor is not present
333   screenCoordinates.x = screenCoordinates.y = 200.0f;
334   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
335   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
336   END_TEST;
337 }
338
339 int UtcDaliGeoTouchEventNormalProcessing02(void)
340 {
341   TestApplication application;
342
343   application.GetScene().SetGeometryHittestEnabled(true);
344
345   Actor actor = Actor::New();
346   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
347   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
348   application.GetScene().Add(actor);
349
350   // Render and notify
351   application.SendNotification();
352   application.Render();
353
354   // Connect to actor's touched signal
355   HandleData              handleData;
356   TouchEventHandleFunctor functor(handleData);
357   actor.TouchedSignal().Connect(&application, functor);
358
359   Vector2 screenCoordinates(10.0f, 10.0f);
360   Vector2 localCoordinates;
361   actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
362
363   // Emit a down signal
364   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
365   DALI_TEST_EQUALS(true, handleData.signalReceived, TEST_LOCATION);
366   DALI_TEST_EQUALS(1u, handleData.receivedTouchHandle.GetPointCount(), TEST_LOCATION);
367   DALI_TEST_EQUALS(PointState::DOWN, handleData.receivedTouchHandle.GetState(0), TEST_LOCATION);
368   DALI_TEST_EQUALS(screenCoordinates, handleData.receivedTouchHandle.GetScreenPosition(0), TEST_LOCATION);
369   DALI_TEST_EQUALS(localCoordinates, handleData.receivedTouchHandle.GetLocalPosition(0), 0.1f, TEST_LOCATION);
370
371   END_TEST;
372 }
373
374 int UtcDaliGeoTouchEventAPINegative(void)
375 {
376   TestApplication application;
377
378   application.GetScene().SetGeometryHittestEnabled(true);
379
380   Actor actor = Actor::New();
381   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
382   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
383   application.GetScene().Add(actor);
384
385   // Render and notify
386   application.SendNotification();
387   application.Render();
388
389   // Connect to actor's touched signal
390   OutOfBoundsData    data;
391   OutOfBoundsFunctor functor(data, true);
392   actor.TouchedSignal().Connect(&application, functor);
393
394   Vector2 screenCoordinates(10.0f, 10.0f);
395   Vector2 localCoordinates;
396   actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
397
398   // Emit a down signal
399   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
400
401   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
402   DALI_TEST_EQUALS(-1, data.point.deviceId, TEST_LOCATION);
403   DALI_TEST_EQUALS(PointState::FINISHED, data.point.state, TEST_LOCATION);
404   DALI_TEST_EQUALS(Vector2::ZERO, data.point.screen, TEST_LOCATION);
405   DALI_TEST_EQUALS(Vector2::ZERO, data.point.local, 0.1f, TEST_LOCATION);
406   DALI_TEST_CHECK(!data.point.hitActor);
407
408   END_TEST;
409 }
410
411 int UtcDaliGeoTouchEventOutsideCameraNearFarPlanes(void)
412 {
413   TestApplication application;
414
415   application.GetScene().SetGeometryHittestEnabled(true);
416
417   Integration::Scene scene     = application.GetScene();
418   Vector2            sceneSize = scene.GetSize();
419
420   Actor actor = Actor::New();
421   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
422   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
423   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
424   scene.Add(actor);
425
426   // Render and notify
427   application.SendNotification();
428   application.Render();
429
430   // Get the camera's near and far planes
431   RenderTaskList   taskList  = scene.GetRenderTaskList();
432   Dali::RenderTask task      = taskList.GetTask(0);
433   CameraActor      camera    = task.GetCameraActor();
434   float            nearPlane = camera.GetNearClippingPlane();
435   float            farPlane  = camera.GetFarClippingPlane();
436
437   // Calculate the current distance of the actor from the camera
438   float tanHalfFov = tanf(camera.GetFieldOfView() * 0.5f);
439   float distance   = (sceneSize.y * 0.5f) / tanHalfFov;
440
441   // Connect to actor's touched signal
442   SignalData        data;
443   TouchEventFunctor functor(data);
444   actor.TouchedSignal().Connect(&application, functor);
445
446   Vector2 screenCoordinates(sceneSize.x * 0.5f, sceneSize.y * 0.5f);
447
448   // Emit a down signal
449   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
450   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
451   application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
452   data.Reset();
453
454   // Emit a down signal where actor is just at the camera's near plane
455   actor.SetProperty(Actor::Property::POSITION_Z, distance - nearPlane);
456
457   // Render and notify
458   application.SendNotification();
459   application.Render();
460
461   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
462   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
463   application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
464   data.Reset();
465
466   // Emit a down signal where actor is closer than the camera's near plane
467   actor.SetProperty(Actor::Property::POSITION_Z, (distance - nearPlane) + 1.0f);
468
469   // Render and notify
470   application.SendNotification();
471   application.Render();
472
473   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
474   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
475   application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
476   data.Reset();
477
478   // Emit a down signal where actor is just at the camera's far plane
479   actor.SetProperty(Actor::Property::POSITION_Z, distance - farPlane);
480
481   // Render and notify
482   application.SendNotification();
483   application.Render();
484
485   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
486   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
487   application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
488   data.Reset();
489
490   // Emit a down signal where actor is further than the camera's far plane
491   actor.SetProperty(Actor::Property::POSITION_Z, (distance - farPlane) - 1.0f);
492
493   // Render and notify
494   application.SendNotification();
495   application.Render();
496
497   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
498   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
499   application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
500   data.Reset();
501   END_TEST;
502 }
503
504 int UtcDaliGeoTouchEventEmitEmpty(void)
505 {
506   TestApplication application;
507
508   application.GetScene().SetGeometryHittestEnabled(true);
509
510   try
511   {
512     // Emit an empty TouchEvent
513     Integration::TouchEvent touchEvent;
514     application.ProcessEvent(touchEvent);
515     tet_result(TET_FAIL);
516   }
517   catch(Dali::DaliException& e)
518   {
519     DALI_TEST_ASSERT(e, "!touchEvent.points.empty()", TEST_LOCATION);
520   }
521   END_TEST;
522 }
523
524 int UtcDaliGeoTouchEventInterrupted(void)
525 {
526   TestApplication application;
527
528   application.GetScene().SetGeometryHittestEnabled(true);
529
530   Actor actor = Actor::New();
531   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
532   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
533   application.GetScene().Add(actor);
534
535   // Render and notify
536   application.SendNotification();
537   application.Render();
538
539   // Connect to actor's touched signal
540   SignalData        data;
541   TouchEventFunctor functor(data);
542   actor.TouchedSignal().Connect(&application, functor);
543
544   // Emit a down signal
545   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
546   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
547   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
548   data.Reset();
549
550   // Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not.
551   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */)));
552   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
553   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
554   data.Reset();
555
556   // Emit another interrupted signal, our signal handler should not be called.
557   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
558   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
559   END_TEST;
560 }
561
562 int UtcDaliGeoTouchEventNotConsumedInterrupted(void)
563 {
564   TestApplication application;
565
566   application.GetScene().SetGeometryHittestEnabled(true);
567
568   Actor actor = Actor::New();
569   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
570   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
571   application.GetScene().Add(actor);
572
573   // Render and notify
574   application.SendNotification();
575   application.Render();
576
577   // Connect to actor's touched signal
578   SignalData        data;
579   TouchEventFunctor functor(data, false);
580   actor.TouchedSignal().Connect(&application, functor);
581
582   // Emit a down signal
583   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
584   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
585   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
586   data.Reset();
587
588   // Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not even though we didn't consume
589   // as we still were the hit-actor in the last event.
590   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */)));
591   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
592   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
593   data.Reset();
594
595   // Emit another interrupted signal, our signal handler should not be called.
596   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
597   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
598   END_TEST;
599 }
600
601 int UtcDaliGeoTouchEventParentConsumer(void)
602 {
603   TestApplication application;
604
605   application.GetScene().SetGeometryHittestEnabled(true);
606
607   Actor rootActor(application.GetScene().GetRootLayer());
608
609   Actor actor = Actor::New();
610   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
611   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
612   application.GetScene().Add(actor);
613
614   // Render and notify
615   application.SendNotification();
616   application.Render();
617
618   // Connect to actor's touched signal
619   SignalData        data;
620   TouchEventFunctor functor(data, false);
621   actor.TouchedSignal().Connect(&application, functor);
622
623   // Connect to root actor's touched signal
624   SignalData        rootData;
625   TouchEventFunctor rootFunctor(rootData); // Consumes signal
626   rootActor.TouchedSignal().Connect(&application, rootFunctor);
627
628   Vector2 screenCoordinates(10.0f, 10.0f);
629   Vector2 actorCoordinates, rootCoordinates;
630   actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
631   rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
632
633   // Emit a down signal
634   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
635   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
636   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
637   DALI_TEST_EQUALS(1u, data.receivedTouch.GetPointCount(), TEST_LOCATION);
638   DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
639   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
640   DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
641   DALI_TEST_EQUALS(screenCoordinates, data.receivedTouch.points[0].screen, TEST_LOCATION);
642   DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
643   DALI_TEST_EQUALS(actorCoordinates, data.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
644   DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
645   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
646   DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
647   data.Reset();
648   rootData.Reset();
649
650   // Emit a motion signal
651   screenCoordinates.x = screenCoordinates.y = 11.0f;
652   actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
653   rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
654   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, screenCoordinates));
655   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
656   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
657   DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
658   DALI_TEST_EQUALS(PointState::MOTION, rootData.receivedTouch.points[0].state, TEST_LOCATION);
659   DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
660   DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
661   DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
662   data.Reset();
663   rootData.Reset();
664
665   // Emit an up signal
666   screenCoordinates.x = screenCoordinates.y = 12.0f;
667   actor.ScreenToLocal(actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y);
668   rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
669   application.ProcessEvent(GenerateSingleTouch(PointState::UP, screenCoordinates));
670   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
671   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
672   DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
673   DALI_TEST_EQUALS(PointState::UP, rootData.receivedTouch.points[0].state, TEST_LOCATION);
674   DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
675   DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
676   DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
677   data.Reset();
678   rootData.Reset();
679
680   // Emit a down signal where the actor is not present, will hit the root actor though
681   screenCoordinates.x = screenCoordinates.y = 200.0f;
682   rootActor.ScreenToLocal(rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y);
683   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
684   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
685   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
686   DALI_TEST_EQUALS(1u, rootData.receivedTouch.GetPointCount(), TEST_LOCATION);
687   DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
688   DALI_TEST_EQUALS(screenCoordinates, rootData.receivedTouch.points[0].screen, TEST_LOCATION);
689   DALI_TEST_EQUALS(rootCoordinates, rootData.receivedTouch.points[0].local, 0.1f, TEST_LOCATION);
690   DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
691   END_TEST;
692 }
693
694 int UtcDaliGeoTouchEventInterruptedParentConsumer(void)
695 {
696   TestApplication application;
697
698   application.GetScene().SetGeometryHittestEnabled(true);
699
700   Actor rootActor(application.GetScene().GetRootLayer());
701
702   Actor actor = Actor::New();
703   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
704   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
705   application.GetScene().Add(actor);
706
707   // Render and notify
708   application.SendNotification();
709   application.Render();
710
711   // Connect to actor's touched signal
712   SignalData        data;
713   TouchEventFunctor functor(data, false);
714   actor.TouchedSignal().Connect(&application, functor);
715
716   // Connect to root actor's touched signal
717   SignalData        rootData;
718   TouchEventFunctor rootFunctor(rootData); // Consumes signal
719   rootActor.TouchedSignal().Connect(&application, rootFunctor);
720
721   // Emit a down signal
722   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
723   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
724   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
725   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
726   DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
727   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
728   DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
729   data.Reset();
730   rootData.Reset();
731
732   // Emit an interrupted signal
733   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
734   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
735   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
736   DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
737   DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
738   data.Reset();
739   rootData.Reset();
740
741   // Emit another down signal
742   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
743   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
744   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
745   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
746   DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
747   data.Reset();
748   rootData.Reset();
749
750   // Remove actor from scene
751   application.GetScene().Remove(actor);
752   data.Reset();
753   rootData.Reset();
754
755   // Render and notify
756   application.SendNotification();
757   application.Render();
758
759   // Emit an interrupted signal, only root actor's signal should be called.
760   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f /* Outside actor */)));
761   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
762   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
763   DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
764   DALI_TEST_CHECK(rootActor == rootData.receivedTouch.points[0].hitActor);
765   data.Reset();
766   rootData.Reset();
767
768   // Emit another interrupted state, none of the signal's should be called.
769   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(200.0f, 200.0f)));
770   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
771   DALI_TEST_EQUALS(false, rootData.functorCalled, TEST_LOCATION);
772   END_TEST;
773 }
774
775 int UtcDaliGeoTouchEventActorBecomesInsensitive(void)
776 {
777   TestApplication application;
778
779   application.GetScene().SetGeometryHittestEnabled(true);
780
781   Actor actor = Actor::New();
782   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
783   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
784   application.GetScene().Add(actor);
785
786   // Render and notify
787   application.SendNotification();
788   application.Render();
789
790   // Connect to actor's touched signal
791   SignalData        data;
792   TouchEventFunctor functor(data);
793   actor.TouchedSignal().Connect(&application, functor);
794
795   // Emit a down signal
796   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
797   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
798   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
799   data.Reset();
800
801   // Change actor to insensitive
802   actor.SetProperty(Actor::Property::SENSITIVE, false);
803
804   // Emit a motion signal, signalled with an interrupted
805   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
806   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
807   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
808   data.Reset();
809   END_TEST;
810 }
811
812 int UtcDaliGeoTouchEventActorBecomesInsensitiveParentConsumer(void)
813 {
814   TestApplication application;
815
816   application.GetScene().SetGeometryHittestEnabled(true);
817
818   Actor rootActor(application.GetScene().GetRootLayer());
819
820   Actor actor = Actor::New();
821   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
822   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
823   application.GetScene().Add(actor);
824
825   // Render and notify
826   application.SendNotification();
827   application.Render();
828
829   // Connect to actor's touched signal
830   SignalData        data;
831   TouchEventFunctor functor(data, false);
832   actor.TouchedSignal().Connect(&application, functor);
833
834   // Connect to root actor's touched signal
835   SignalData        rootData;
836   TouchEventFunctor rootFunctor(rootData); // Consumes signal
837   rootActor.TouchedSignal().Connect(&application, rootFunctor);
838
839   // Emit a down signal
840   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
841   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
842   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
843   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
844   DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
845   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
846   DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
847   data.Reset();
848   rootData.Reset();
849
850   // Render and notify
851   application.SendNotification();
852   application.Render();
853
854   // Make root actor insensitive
855   rootActor.SetProperty(Actor::Property::SENSITIVE, false);
856
857   // Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor)
858   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
859   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
860   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
861   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
862   DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
863   END_TEST;
864 }
865
866 int UtcDaliGeoTouchEventActorBecomesUserInteractionDisabled(void)
867 {
868   TestApplication application;
869
870   application.GetScene().SetGeometryHittestEnabled(true);
871
872   Actor actor = Actor::New();
873   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
874   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
875   application.GetScene().Add(actor);
876
877   // Render and notify
878   application.SendNotification();
879   application.Render();
880
881   // Connect to actor's touched signal
882   SignalData        data;
883   TouchEventFunctor functor(data);
884   actor.TouchedSignal().Connect(&application, functor);
885
886   // Emit a down signal
887   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
888   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
889   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
890   data.Reset();
891
892   // Change actor to disable user interaction.
893   actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false);
894
895   // Emit a motion signal, signalled with an interrupted
896   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
897   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
898   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
899   data.Reset();
900   END_TEST;
901 }
902
903 int UtcDaliGeoTouchEventMultipleLayers(void)
904 {
905   TestApplication application;
906
907   application.GetScene().SetGeometryHittestEnabled(true);
908
909   Actor rootActor(application.GetScene().GetRootLayer());
910
911   // Connect to actor's touched signal
912   SignalData        data;
913   TouchEventFunctor functor(data);
914
915   Layer layer1(Layer::New());
916   layer1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
917   layer1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
918   application.GetScene().Add(layer1);
919
920   Actor actor1(Actor::New());
921   actor1.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
922   actor1.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
923   actor1.SetProperty(Actor::Property::POSITION_Z, 1.0f); // Should hit actor1 in this layer
924   layer1.Add(actor1);
925
926   // Render and notify
927   application.SendNotification();
928   application.Render();
929
930   // Connect to layer1 and actor1
931   layer1.TouchedSignal().Connect(&application, functor);
932   actor1.TouchedSignal().Connect(&application, functor);
933
934   // Hit in hittable area, actor1 should be hit
935   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
936   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
937   DALI_TEST_CHECK(data.touchedActor == actor1);
938   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
939   data.Reset();
940
941   // Make layer1 insensitive, nothing should be hit
942   layer1.SetProperty(Actor::Property::SENSITIVE, false);
943   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
944   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
945   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
946   data.Reset();
947
948   // Make layer1 sensitive again, again actor1 will be hit
949   layer1.SetProperty(Actor::Property::SENSITIVE, true);
950   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
951   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
952   DALI_TEST_CHECK(data.touchedActor == actor1);
953   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
954   data.Reset();
955
956   // Make rootActor insensitive, nothing should be hit
957   rootActor.SetProperty(Actor::Property::SENSITIVE, false);
958   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
959   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
960   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
961   data.Reset();
962
963   // Make rootActor sensitive
964   rootActor.SetProperty(Actor::Property::SENSITIVE, true);
965
966   // Add another layer
967   Layer layer2(Layer::New());
968   layer2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
969   layer2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
970   layer2.SetProperty(Actor::Property::POSITION_Z, 10.0f); // Should hit layer2 in this layer rather than actor2
971   application.GetScene().Add(layer2);
972
973   Actor actor2(Actor::New());
974   actor2.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
975   actor2.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
976   layer2.Add(actor2);
977
978   // Render and notify
979   application.SendNotification();
980   application.Render();
981
982   // Connect to layer2 and actor2
983   layer2.TouchedSignal().Connect(&application, functor);
984   actor2.TouchedSignal().Connect(&application, functor);
985
986   // Emit an event, should hit layer2
987   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
988   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
989   //DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
990   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
991   data.Reset();
992
993   // Make layer2 insensitive, should hit actor1
994   layer2.SetProperty(Actor::Property::SENSITIVE, false);
995   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
996   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
997   DALI_TEST_CHECK(data.touchedActor == actor1);
998   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
999   data.Reset();
1000
1001   // Make layer2 sensitive again, should hit layer2
1002   layer2.SetProperty(Actor::Property::SENSITIVE, true);
1003   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1004   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1005   //DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
1006   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1007   data.Reset();
1008
1009   // Make layer2 invisible, render and notify
1010   layer2.SetProperty(Actor::Property::VISIBLE, false);
1011   application.SendNotification();
1012   application.Render();
1013
1014   // Should hit actor1
1015   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1016   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1017   DALI_TEST_CHECK(data.touchedActor == actor1);
1018   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1019   data.Reset();
1020
1021   // Make rootActor invisible, render and notify
1022   rootActor.SetProperty(Actor::Property::VISIBLE, false);
1023   application.SendNotification();
1024   application.Render();
1025
1026   // Should not hit anything
1027   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1028   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1029   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1030   data.Reset();
1031   END_TEST;
1032 }
1033
1034 int UtcDaliGeoTouchEventMultipleRenderTasks(void)
1035 {
1036   TestApplication application;
1037
1038   application.GetScene().SetGeometryHittestEnabled(true);
1039
1040   Integration::Scene scene(application.GetScene());
1041   Vector2            sceneSize(scene.GetSize());
1042
1043   Actor actor = Actor::New();
1044   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1045   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1046   scene.Add(actor);
1047
1048   // Create render task
1049   Viewport   viewport(sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f);
1050   RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask());
1051   renderTask.SetViewport(viewport);
1052   renderTask.SetInputEnabled(true);
1053
1054   // Render and notify
1055   application.SendNotification();
1056   application.Render();
1057
1058   // Connect to actor's touched signal
1059   SignalData        data;
1060   TouchEventFunctor functor(data);
1061   actor.TouchedSignal().Connect(&application, functor);
1062
1063   // Emit a down signal
1064   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1065   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1066   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1067   data.Reset();
1068
1069   // Ensure renderTask actor can be hit too.
1070   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
1071   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1072   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1073   data.Reset();
1074
1075   // Disable input on renderTask, should not be hittable
1076   renderTask.SetInputEnabled(false);
1077   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
1078   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1079   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1080   data.Reset();
1081   END_TEST;
1082 }
1083
1084 int UtcDaliGeoTouchEventMultipleRenderTasksWithChildLayer(void)
1085 {
1086   TestApplication application;
1087
1088   application.GetScene().SetGeometryHittestEnabled(true);
1089
1090   Integration::Scene scene(application.GetScene());
1091   Vector2            sceneSize(scene.GetSize());
1092
1093   Actor actor = Actor::New();
1094   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1095   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1096   scene.Add(actor);
1097
1098   Layer layer = Layer::New();
1099   layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1100   layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1101   actor.Add(layer);
1102
1103   // Create render task
1104   Viewport   viewport(sceneSize.width * 0.5f, sceneSize.height * 0.5f, sceneSize.width * 0.5f, sceneSize.height * 0.5f);
1105   RenderTask renderTask(application.GetScene().GetRenderTaskList().CreateTask());
1106   renderTask.SetViewport(viewport);
1107   renderTask.SetInputEnabled(true);
1108   renderTask.SetSourceActor(actor);
1109
1110   // Render and notify
1111   application.SendNotification();
1112   application.Render();
1113
1114   // Connect to layer's touched signal
1115   SignalData        data;
1116   TouchEventFunctor functor(data);
1117   actor.TouchedSignal().Connect(&application, functor);
1118   layer.TouchedSignal().Connect(&application, functor);
1119
1120   // Emit a down signal
1121   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1122   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1123   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1124   data.Reset();
1125
1126   // Ensure renderTask actor can be hit too.
1127   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
1128   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1129   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1130   data.Reset();
1131
1132   // Disable input on renderTask, should not be hittable
1133   renderTask.SetInputEnabled(false);
1134   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(viewport.x + 5.0f, viewport.y + 5.0f)));
1135   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1136   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1137   data.Reset();
1138   END_TEST;
1139 }
1140
1141 int UtcDaliGeoTouchEventOffscreenRenderTasks(void)
1142 {
1143   TestApplication application;
1144
1145   application.GetScene().SetGeometryHittestEnabled(true);
1146
1147   Integration::Scene scene(application.GetScene());
1148   Vector2            sceneSize(scene.GetSize());
1149
1150   // FrameBufferImage for offscreen RenderTask
1151   FrameBuffer frameBuffer = FrameBuffer::New(sceneSize.width, sceneSize.height);
1152
1153   // Create a renderable actor to display the FrameBufferImage
1154   Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture());
1155   renderableActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
1156   renderableActor.SetProperty(Actor::Property::SIZE, Vector2(sceneSize.x, sceneSize.y));
1157   renderableActor.ScaleBy(Vector3(1.0f, -1.0f, 1.0f)); // FIXME
1158   scene.Add(renderableActor);
1159
1160   Actor actor = Actor::New();
1161   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1162   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1163   scene.Add(actor);
1164   application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE); // Ensure framebuffer connects
1165
1166   scene.GetRenderTaskList().GetTask(0u).SetScreenToFrameBufferFunction(RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION);
1167
1168   // Create a RenderTask
1169   RenderTask renderTask = scene.GetRenderTaskList().CreateTask();
1170   renderTask.SetSourceActor(actor);
1171   renderTask.SetFrameBuffer(frameBuffer);
1172   renderTask.SetInputEnabled(true);
1173
1174   // Create another RenderTask
1175   RenderTask renderTask2(scene.GetRenderTaskList().CreateTask());
1176   renderTask2.SetInputEnabled(true);
1177
1178   // Render and notify
1179   application.SendNotification();
1180   application.Render();
1181
1182   // Connect to actor's touched signal
1183   SignalData        data;
1184   TouchEventFunctor functor(data);
1185   actor.TouchedSignal().Connect(&application, functor);
1186
1187   // Emit a down signal
1188   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1189   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1190   data.Reset();
1191   END_TEST;
1192 }
1193
1194 int UtcDaliGeoTouchEventMultipleRenderableActors(void)
1195 {
1196   TestApplication application;
1197
1198   application.GetScene().SetGeometryHittestEnabled(true);
1199
1200   Integration::Scene scene(application.GetScene());
1201   Vector2            sceneSize(scene.GetSize());
1202
1203   Actor parent = CreateRenderableActor();
1204   parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1205   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1206   scene.Add(parent);
1207
1208   Actor actor = CreateRenderableActor();
1209   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1210   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1211   parent.Add(actor);
1212
1213   // Render and notify
1214   application.SendNotification();
1215   application.Render();
1216
1217   // Connect to layer's touched signal
1218   SignalData        data;
1219   TouchEventFunctor functor(data);
1220   parent.TouchedSignal().Connect(&application, functor);
1221   actor.TouchedSignal().Connect(&application, functor);
1222
1223   // Emit a down signal
1224   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1225   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1226   DALI_TEST_CHECK(actor == data.touchedActor);
1227   END_TEST;
1228 }
1229
1230 int UtcDaliGeoTouchEventActorRemovedInSignal(void)
1231 {
1232   TestApplication application;
1233
1234   application.GetScene().SetGeometryHittestEnabled(true);
1235
1236   Actor actor = Actor::New();
1237   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1238   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1239   application.GetScene().Add(actor);
1240
1241   // Render and notify
1242   application.SendNotification();
1243   application.Render();
1244
1245   // Connect to actor's touched signal
1246   SignalData         data;
1247   RemoveActorFunctor functor(data);
1248   actor.TouchedSignal().Connect(&application, functor);
1249
1250   // Register for leave events
1251   actor.SetProperty(Actor::Property::LEAVE_REQUIRED, true);
1252
1253   // Emit a down signal
1254   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1255   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1256   data.Reset();
1257
1258   // Re-add, render and notify
1259   application.GetScene().Add(actor);
1260   application.SendNotification();
1261   application.Render();
1262
1263   // Emit another signal outside of actor's area, should not get anything as the scene has changed.
1264   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f)));
1265   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1266   data.Reset();
1267
1268   // Emit a down signal
1269   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1270   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1271   data.Reset();
1272
1273   // Render and notify
1274   application.SendNotification();
1275   application.Render();
1276
1277   // Emit another signal outside of actor's area, should not get anything as the scene has changed.
1278   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f)));
1279   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1280   data.Reset();
1281
1282   // Re-add actor back to scene, render and notify
1283   application.GetScene().Add(actor);
1284   application.SendNotification();
1285   application.Render();
1286
1287   // Emit another down event
1288   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1289   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1290   data.Reset();
1291
1292   // Completely delete the actor
1293   actor.Reset();
1294
1295   // Emit event, should not crash and should not receive an event.
1296   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(210.0f, 210.0f)));
1297   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1298   END_TEST;
1299 }
1300
1301 int UtcDaliGeoTouchEventActorSignalNotConsumed(void)
1302 {
1303   TestApplication application;
1304
1305   application.GetScene().SetGeometryHittestEnabled(true);
1306
1307   Actor actor = Actor::New();
1308   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1309   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1310   application.GetScene().Add(actor);
1311
1312   // Render and notify
1313   application.SendNotification();
1314   application.Render();
1315
1316   // Connect to actor's touched signal
1317   SignalData        data;
1318   TouchEventFunctor functor(data, false);
1319   actor.TouchedSignal().Connect(&application, functor);
1320
1321   // Emit a down signal
1322   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1323   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1324   END_TEST;
1325 }
1326
1327 int UtcDaliGeoTouchEventActorRemovedFromScene(void)
1328 {
1329   TestApplication application;
1330
1331   application.GetScene().SetGeometryHittestEnabled(true);
1332
1333   Actor actor = Actor::New();
1334   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1335   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1336   application.GetScene().Add(actor);
1337
1338   // Render and notify
1339   application.SendNotification();
1340   application.Render();
1341
1342   // Connect to actor's touched signal
1343   SignalData        data;
1344   TouchEventFunctor functor(data);
1345   actor.TouchedSignal().Connect(&application, functor);
1346
1347   // Emit a down signal
1348   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1349   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1350   data.Reset();
1351
1352   // Remove actor from scene
1353   application.GetScene().Remove(actor);
1354   data.Reset();
1355
1356   // Render and notify
1357   application.SendNotification();
1358   application.Render();
1359
1360   // Emit a move at the same point, we should not be signalled.
1361   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f)));
1362   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1363   data.Reset();
1364   END_TEST;
1365 }
1366
1367 int UtcDaliGeoTouchEventLayerConsumesTouch(void)
1368 {
1369   TestApplication application;
1370
1371   application.GetScene().SetGeometryHittestEnabled(true);
1372
1373   Actor actor = Actor::New();
1374   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1375   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1376   application.GetScene().Add(actor);
1377
1378   // Render and notify
1379   application.SendNotification();
1380   application.Render();
1381
1382   // Connect to actor's touched signal
1383   SignalData        data;
1384   TouchEventFunctor functor(data);
1385   actor.TouchedSignal().Connect(&application, functor);
1386
1387   // Add a layer to overlap the actor
1388   Layer layer = Layer::New();
1389   layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1390   layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1391   application.GetScene().Add(layer);
1392   layer.RaiseToTop();
1393
1394   // Render and notify
1395   application.SendNotification();
1396   application.Render();
1397
1398   // Emit a few touch signals
1399   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1400   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1401   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1402   data.Reset();
1403
1404   // Set layer to consume all touch
1405   layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
1406
1407   // Render and notify
1408   application.SendNotification();
1409   application.Render();
1410
1411   // Emit the same signals again, should not receive
1412   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1413   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1414   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1415   data.Reset();
1416
1417   END_TEST;
1418 }
1419
1420 int UtcDaliGeoTouchEventClippedActor(void)
1421 {
1422   TestApplication    application;
1423   Integration::Scene scene = application.GetScene();
1424
1425   scene.SetGeometryHittestEnabled(true);
1426
1427   Actor actor = Actor::New();
1428   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1429   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1430   scene.Add(actor);
1431
1432   Actor clippingActor = Actor::New();
1433   clippingActor.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f));
1434   clippingActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1435   clippingActor.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN);
1436   scene.Add(clippingActor);
1437
1438   // Add a child to the clipped region.
1439   Actor clippingChild = Actor::New();
1440   clippingChild.SetProperty(Actor::Property::SIZE, Vector2(50.0f, 50.0f));
1441   clippingChild.SetProperty(Actor::Property::POSITION, Vector2(25.0f, 25.0f));
1442   clippingChild.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1443   clippingActor.Add(clippingChild);
1444
1445   // Render and notify.
1446   application.SendNotification();
1447   application.Render();
1448
1449   // Connect to actor's touch signal.
1450   SignalData        data;
1451   TouchEventFunctor functor(data);
1452   actor.TouchedSignal().Connect(&application, functor);
1453
1454   // Emit an event within clipped area - we should have a hit.
1455   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1456   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1457   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(10.0f, 10.0f)));
1458   data.Reset();
1459
1460   // Emit an event within clipped child area - we should still have a hit.
1461   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(40.0f, 40.0f)));
1462   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1463   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(40.0f, 40.0f)));
1464   data.Reset();
1465
1466   // Now connect to the clippingChild's touch signal
1467   SignalData        clippingChildData;
1468   TouchEventFunctor clippingChildFunctor(clippingChildData);
1469   clippingChild.TouchedSignal().Connect(&application, clippingChildFunctor);
1470
1471   // Emit an event within clipped child area - no hit on actor, but hit on clipped child.
1472   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(40.0f, 40.0f)));
1473   DALI_TEST_EQUALS(true, clippingChildData.functorCalled, TEST_LOCATION);
1474   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1475   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(40.0f, 40.0f)));
1476   data.Reset();
1477   clippingChildData.Reset();
1478
1479   // Emit an event outside the clipped area but within the actor area, we should have a hit.
1480   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(60.0f, 60.0f)));
1481   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1482   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(60.0f, 60.0f)));
1483   data.Reset();
1484   clippingChildData.Reset();
1485
1486   // Emit an event inside part of the child which is within the clipped area, we should have a hit on the clipped child but not the actor.
1487   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(30.0f, 30.0f)));
1488   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1489   DALI_TEST_EQUALS(true, clippingChildData.functorCalled, TEST_LOCATION);
1490   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(30.0f, 30.0f)));
1491   data.Reset();
1492   clippingChildData.Reset();
1493
1494   END_TEST;
1495 }
1496
1497 int UtcDaliGeoTouchEventActorUnparented(void)
1498 {
1499   TestApplication application;
1500
1501   application.GetScene().SetGeometryHittestEnabled(true);
1502
1503   Actor actor = Actor::New();
1504   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1505   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1506   application.GetScene().Add(actor);
1507
1508   // Render and notify
1509   application.SendNotification();
1510   application.Render();
1511
1512   // Connect to actor's touched signal
1513   SignalData        data;
1514   TouchEventFunctor functor(data);
1515   actor.TouchedSignal().Connect(&application, functor);
1516
1517   // Emit a down signal
1518   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1519   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1520   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
1521   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
1522   data.Reset();
1523
1524   // Render and notify
1525   application.SendNotification();
1526   application.Render();
1527
1528   // Unparent the actor
1529   actor.Unparent();
1530
1531   // Should receive an interrupted event
1532   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1533   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
1534   END_TEST;
1535 }
1536
1537 int UtcDaliGeoTouchEventParentRemovedFromScene(void)
1538 {
1539   TestApplication application;
1540
1541   application.GetScene().SetGeometryHittestEnabled(true);
1542
1543   Actor parent = Actor::New();
1544   parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1545   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1546   application.GetScene().Add(parent);
1547
1548   Actor actor = Actor::New();
1549   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1550   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1551   parent.Add(actor);
1552
1553   // Render and notify
1554   application.SendNotification();
1555   application.Render();
1556
1557   // Connect to actor's touched signal
1558   SignalData        data;
1559   TouchEventFunctor functor(data);
1560   actor.TouchedSignal().Connect(&application, functor);
1561
1562   // Emit a down signal
1563   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1564   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1565   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
1566   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
1567   data.Reset();
1568
1569   // Render and notify
1570   application.SendNotification();
1571   application.Render();
1572
1573   // Unparent the parent of the touchable actor
1574   parent.Unparent();
1575
1576   // Should receive an interrupted event
1577   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1578   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
1579   END_TEST;
1580 }
1581
1582 int UtcDaliGeoTouchEventActorRemovedFromSceneDifferentConsumer(void)
1583 {
1584   TestApplication application;
1585
1586   application.GetScene().SetGeometryHittestEnabled(true);
1587
1588   Actor parent = Actor::New();
1589   parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1590   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1591   application.GetScene().Add(parent);
1592
1593   Actor actor = Actor::New();
1594   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1595   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1596   parent.Add(actor);
1597
1598   // Render and notify
1599   application.SendNotification();
1600   application.Render();
1601
1602   // Connect to actor's touched signal
1603   SignalData        data;
1604   TouchEventFunctor functor(data, false /* Do not consume */);
1605   actor.TouchedSignal().Connect(&application, functor);
1606
1607   // Connect to parent's touched signal
1608   SignalData        parentData;
1609   TouchEventFunctor parentFunctor(parentData);
1610   parent.TouchedSignal().Connect(&application, parentFunctor);
1611
1612   // Emit a down signal
1613   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1614   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1615   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
1616   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
1617   DALI_TEST_CHECK(actor == data.touchedActor);
1618   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
1619   DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION);
1620   DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor);
1621   DALI_TEST_CHECK(parent == parentData.touchedActor);
1622   data.Reset();
1623   parentData.Reset();
1624
1625   // Render and notify
1626   application.SendNotification();
1627   application.Render();
1628
1629   // Unparent the actor
1630   actor.Unparent();
1631
1632   // Should receive an interrupted event for both actor & parent
1633   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1634   DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
1635   data.Reset();
1636   parentData.Reset();
1637
1638   // Readd actor to parent
1639   parent.Add(actor);
1640
1641   // Render and notify
1642   application.SendNotification();
1643   application.Render();
1644
1645   // Emit a motion signal
1646   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(10.0f, 10.0f)));
1647   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1648   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
1649   data.Reset();
1650   parentData.Reset();
1651
1652   // Parent is now consumer, connect again to the touched signal of the actor so that it becomes the consumer
1653   SignalData        secondData;
1654   TouchEventFunctor secondFunctor(secondData /* Consume */);
1655   actor.TouchedSignal().Connect(&application, secondFunctor);
1656
1657   // Unparent the actor
1658   actor.Unparent();
1659
1660   // Should receive an interrupted event for both actor functors & the parent as well as it was last consumer
1661   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1662   DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
1663   DALI_TEST_EQUALS(false, secondData.functorCalled, TEST_LOCATION);
1664   data.Reset();
1665   parentData.Reset();
1666   secondData.Reset();
1667
1668   END_TEST;
1669 }
1670
1671 int UtcDaliGeoTouchEventInterruptedDifferentConsumer(void)
1672 {
1673   TestApplication application;
1674
1675   application.GetScene().SetGeometryHittestEnabled(true);
1676
1677   Actor rootActor(application.GetScene().GetRootLayer());
1678
1679   Actor parent = Actor::New();
1680   parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1681   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1682   application.GetScene().Add(parent);
1683
1684   Actor actor = Actor::New();
1685   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1686   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1687   parent.Add(actor);
1688
1689   // Render and notify
1690   application.SendNotification();
1691   application.Render();
1692
1693   // Connect to actor's touched signal
1694   SignalData        data;
1695   TouchEventFunctor functor(data, false /* Do not consume */);
1696   actor.TouchedSignal().Connect(&application, functor);
1697
1698   // Connect to parent's touched signal
1699   SignalData        parentData;
1700   TouchEventFunctor parentFunctor(parentData, false /* Do not consume */);
1701   parent.TouchedSignal().Connect(&application, parentFunctor);
1702
1703   // Connect to root's touched signal and consume
1704   SignalData        rootData;
1705   TouchEventFunctor rootFunctor(rootData);
1706   rootActor.TouchedSignal().Connect(&application, rootFunctor);
1707
1708   // Emit a down signal
1709   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1710   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1711   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
1712   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
1713   DALI_TEST_CHECK(actor == data.touchedActor);
1714   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
1715   DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION);
1716   DALI_TEST_CHECK(parent == parentData.receivedTouch.points[0].hitActor);
1717   DALI_TEST_CHECK(parent == parentData.touchedActor);
1718   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
1719   DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
1720   DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
1721   DALI_TEST_CHECK(rootActor == rootData.touchedActor);
1722   data.Reset();
1723   parentData.Reset();
1724   rootData.Reset();
1725
1726   // Root is now consumer, connect to the touched signal of the parent so that it becomes the consumer
1727   SignalData        secondData;
1728   TouchEventFunctor secondFunctor(secondData /* Consume */);
1729   parent.TouchedSignal().Connect(&application, secondFunctor);
1730
1731   // Emit an interrupted signal, Since rootActor has already comsume, only rootActor gets INTERRUPTED.
1732   application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(10.0f, 10.0f)));
1733   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1734   DALI_TEST_EQUALS(false, parentData.functorCalled, TEST_LOCATION);
1735   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
1736   DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
1737   data.Reset();
1738   parentData.Reset();
1739   rootData.Reset();
1740
1741   END_TEST;
1742 }
1743
1744 int UtcDaliGeoTouchEventInterruptedDifferentConsumer02(void)
1745 {
1746   TestApplication application;
1747
1748   application.GetScene().SetGeometryHittestEnabled(true);
1749
1750   Actor rootActor(application.GetScene().GetRootLayer());
1751
1752   Actor parent = Actor::New();
1753   parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1754   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1755   application.GetScene().Add(parent);
1756
1757   Actor actor = Actor::New();
1758   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1759   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1760   parent.Add(actor);
1761
1762   // Render and notify
1763   application.SendNotification();
1764   application.Render();
1765
1766   // Connect to actor's touched signal
1767   SignalData        data;
1768   TouchEventFunctor functor(data, false /* Do not consume */);
1769   actor.TouchedSignal().Connect(&application, functor);
1770
1771   // Connect to parent's touched signal
1772   SignalData        parentData;
1773   TouchEventFunctor parentFunctor(parentData, false /* Do not consume */);
1774   parent.TouchedSignal().Connect(&application, parentFunctor);
1775
1776   // Connect to root's touched signal
1777   SignalData        rootData;
1778   TouchEventFunctor rootFunctor(rootData, false /* Do not consume */);
1779   rootActor.TouchedSignal().Connect(&application, rootFunctor);
1780
1781   // Emit a down signal
1782   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1783   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1784   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
1785   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
1786   DALI_TEST_CHECK(actor == data.touchedActor);
1787   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
1788   DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION);
1789   DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor);
1790   DALI_TEST_CHECK(parent == parentData.touchedActor);
1791   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
1792   DALI_TEST_EQUALS(PointState::DOWN, rootData.receivedTouch.points[0].state, TEST_LOCATION);
1793   DALI_TEST_CHECK(actor == rootData.receivedTouch.points[0].hitActor);
1794   DALI_TEST_CHECK(rootActor == rootData.touchedActor);
1795   data.Reset();
1796   parentData.Reset();
1797   rootData.Reset();
1798
1799   // child is now consumer, connect to the touched signal of the child so that it becomes the consumer
1800   SignalData        secondData;
1801   TouchEventFunctor secondFunctor(secondData /* Consume */);
1802   actor.TouchedSignal().Connect(&application, secondFunctor);
1803
1804   // Emit an motion signal, Since child has comsume, Actors who were previously touched will get interrupted.
1805   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 20.0f)));
1806   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1807   DALI_TEST_EQUALS(PointState::MOTION, data.receivedTouch.points[0].state, TEST_LOCATION);
1808   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
1809   DALI_TEST_EQUALS(PointState::INTERRUPTED, parentData.receivedTouch.points[0].state, TEST_LOCATION);
1810   DALI_TEST_EQUALS(true, rootData.functorCalled, TEST_LOCATION);
1811   DALI_TEST_EQUALS(PointState::INTERRUPTED, rootData.receivedTouch.points[0].state, TEST_LOCATION);
1812   data.Reset();
1813   parentData.Reset();
1814   rootData.Reset();
1815
1816   END_TEST;
1817 }
1818
1819 int UtcDaliGeoTouchEventGetRadius(void)
1820 {
1821   TestApplication application;
1822
1823   application.GetScene().SetGeometryHittestEnabled(true);
1824
1825   Actor actor = Actor::New();
1826   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1827   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1828   application.GetScene().Add(actor);
1829
1830   // Render and notify
1831   application.SendNotification();
1832   application.Render();
1833
1834   // Connect to actor's touched signal
1835   SignalData        data;
1836   TouchEventFunctor functor(data);
1837   actor.TouchedSignal().Connect(&application, functor);
1838
1839   // Emit a down signal with an angle
1840   Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
1841   touchEvent.points[0].SetRadius(100.0f);
1842   application.ProcessEvent(touchEvent);
1843   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1844   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
1845   DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION);
1846   DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION);
1847   DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION);
1848
1849   END_TEST;
1850 }
1851
1852 int UtcDaliGeoTouchEventGetEllipseRadius(void)
1853 {
1854   TestApplication application;
1855
1856   application.GetScene().SetGeometryHittestEnabled(true);
1857
1858   Actor actor = Actor::New();
1859   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1860   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1861   application.GetScene().Add(actor);
1862
1863   // Render and notify
1864   application.SendNotification();
1865   application.Render();
1866
1867   // Connect to actor's touched signal
1868   SignalData        data;
1869   TouchEventFunctor functor(data);
1870   actor.TouchedSignal().Connect(&application, functor);
1871
1872   // Emit a down signal with an angle
1873   Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
1874   touchEvent.points[0].SetRadius(100.0f, Vector2(20.0f, 10.0f));
1875   application.ProcessEvent(touchEvent);
1876   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1877   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
1878   DALI_TEST_EQUALS(100.0f, data.receivedTouch.points[0].radius, TEST_LOCATION);
1879   DALI_TEST_EQUALS(20.0f, data.receivedTouch.points[0].ellipseRadius.x, TEST_LOCATION);
1880   DALI_TEST_EQUALS(10.0f, data.receivedTouch.points[0].ellipseRadius.y, TEST_LOCATION);
1881
1882   END_TEST;
1883 }
1884
1885 int UtcDaliGeoTouchEventGetAngle(void)
1886 {
1887   TestApplication application;
1888
1889   application.GetScene().SetGeometryHittestEnabled(true);
1890
1891   Actor actor = Actor::New();
1892   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1893   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1894   application.GetScene().Add(actor);
1895
1896   // Render and notify
1897   application.SendNotification();
1898   application.Render();
1899
1900   // Connect to actor's touched signal
1901   SignalData        data;
1902   TouchEventFunctor functor(data);
1903   actor.TouchedSignal().Connect(&application, functor);
1904
1905   // Emit a down signal with an angle
1906   Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
1907   touchEvent.points[0].SetAngle(Degree(90.0f));
1908   application.ProcessEvent(touchEvent);
1909   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1910   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
1911   DALI_TEST_EQUALS(Degree(90.0f), data.receivedTouch.points[0].angle, TEST_LOCATION);
1912
1913   END_TEST;
1914 }
1915
1916 int UtcDaliGeoTouchEventGetPressure(void)
1917 {
1918   TestApplication application;
1919
1920   application.GetScene().SetGeometryHittestEnabled(true);
1921
1922   Actor actor = Actor::New();
1923   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1924   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1925   application.GetScene().Add(actor);
1926
1927   // Render and notify
1928   application.SendNotification();
1929   application.Render();
1930
1931   // Connect to actor's touched signal
1932   SignalData        data;
1933   TouchEventFunctor functor(data);
1934   actor.TouchedSignal().Connect(&application, functor);
1935
1936   // Emit a down signal with an angle
1937   Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
1938   touchEvent.points[0].SetPressure(10.0f);
1939   application.ProcessEvent(touchEvent);
1940   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1941   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
1942   DALI_TEST_EQUALS(10.0f, data.receivedTouch.points[0].pressure, TEST_LOCATION);
1943
1944   END_TEST;
1945 }
1946
1947 int UtcDaliGeoTouchEventUsage(void)
1948 {
1949   TestApplication application;
1950
1951   application.GetScene().SetGeometryHittestEnabled(true);
1952
1953   Actor actor = Actor::New();
1954   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1955   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1956   application.GetScene().Add(actor);
1957
1958   // Render and notify
1959   application.SendNotification();
1960   application.Render();
1961
1962   // Connect to actor's touched signal
1963   SignalData        data;
1964   TouchEventFunctor functor(data);
1965   actor.TouchedSignal().Connect(&application, functor);
1966
1967   // Emit a down signal with an angle
1968   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
1969   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
1970
1971   END_TEST;
1972 }
1973
1974 int UtcDaliGeoTouchEventGetDeviceAPINegative(void)
1975 {
1976   TestApplication application;
1977
1978   application.GetScene().SetGeometryHittestEnabled(true);
1979
1980   Actor actor = Actor::New();
1981   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
1982   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1983   application.GetScene().Add(actor);
1984
1985   // Render and notify
1986   application.SendNotification();
1987   application.Render();
1988
1989   // Connect to actor's touched signal
1990   HandleData              handleData;
1991   TouchEventHandleFunctor functor(handleData);
1992   actor.TouchedSignal().Connect(&application, functor);
1993
1994   Vector2 screenCoordinates(10.0f, 10.0f);
1995   Vector2 localCoordinates;
1996   actor.ScreenToLocal(localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y);
1997
1998   // Emit a down signal
1999   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, screenCoordinates));
2000
2001   TouchEvent data = handleData.receivedTouchHandle;
2002   DALI_TEST_EQUALS(data.GetDeviceClass(-1), Device::Class::NONE, TEST_LOCATION);
2003   DALI_TEST_EQUALS(data.GetDeviceSubclass(-1), Device::Subclass::NONE, TEST_LOCATION);
2004   END_TEST;
2005 }
2006
2007 int UtcDaliGeoTouchEventGetMouseButtonPositive(void)
2008 {
2009   TestApplication application;
2010
2011   application.GetScene().SetGeometryHittestEnabled(true);
2012
2013   Actor actor = Actor::New();
2014   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2015   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2016   application.GetScene().Add(actor);
2017
2018   // Render and notify
2019   application.SendNotification();
2020   application.Render();
2021
2022   // Connect to actor's touched signal
2023   HandleData              handleData;
2024   TouchEventHandleFunctor functor(handleData);
2025   actor.TouchedSignal().Connect(&application, functor);
2026
2027   // Emit a down signal with MouseButton
2028   Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
2029   touchEvent.points[0].SetMouseButton(static_cast<MouseButton::Type>(3));
2030   application.ProcessEvent(touchEvent);
2031
2032   TouchEvent data = handleData.receivedTouchHandle;
2033   DALI_TEST_EQUALS(data.GetMouseButton(0), MouseButton::SECONDARY, TEST_LOCATION);
2034
2035   END_TEST;
2036 }
2037
2038 int UtcDaliGeoTouchEventGetMouseButtonNagative(void)
2039 {
2040   TestApplication application;
2041
2042   application.GetScene().SetGeometryHittestEnabled(true);
2043
2044   Actor actor = Actor::New();
2045   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2046   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2047   application.GetScene().Add(actor);
2048
2049   // Render and notify
2050   application.SendNotification();
2051   application.Render();
2052
2053   // Connect to actor's touched signal
2054   HandleData              handleData;
2055   TouchEventHandleFunctor functor(handleData);
2056   actor.TouchedSignal().Connect(&application, functor);
2057
2058   // Emit a down signal with MouseButton
2059   Integration::TouchEvent touchEvent = GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f));
2060   touchEvent.points[0].SetMouseButton(static_cast<MouseButton::Type>(2));
2061   application.ProcessEvent(touchEvent);
2062
2063   TouchEvent data = handleData.receivedTouchHandle;
2064   DALI_TEST_EQUALS(data.GetMouseButton(0), MouseButton::TERTIARY, TEST_LOCATION);
2065   DALI_TEST_EQUALS(data.GetMouseButton(3), MouseButton::INVALID, TEST_LOCATION);
2066
2067   END_TEST;
2068 }
2069
2070 int UtcDaliGeoTouchEventCapturePropertySet(void)
2071 {
2072   TestApplication application;
2073
2074   application.GetScene().SetGeometryHittestEnabled(true);
2075
2076   Actor actor = Actor::New();
2077   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2078   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2079   application.GetScene().Add(actor);
2080
2081   // Render and notify
2082   application.SendNotification();
2083   application.Render();
2084
2085   // Connect to actor's touched signal
2086   SignalData        data;
2087   TouchEventFunctor functor(data);
2088   actor.TouchedSignal().Connect(&application, functor);
2089
2090   // Emit a down signal
2091   application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(10.0f, 10.0f)));
2092   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2093   data.Reset();
2094
2095   // Now motion outside of actor, we now SHOULD receive the event
2096   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(110.0f, 110.0f)));
2097   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2098   data.Reset();
2099
2100   // Up event, we should receive it again, but as ended rather than interrupted
2101   application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f)));
2102   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2103   DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION);
2104
2105   END_TEST;
2106 }
2107
2108 int UtcDaliGeoTouchEventIntegNewTouchEvent(void)
2109 {
2110   TestApplication application;
2111   application.GetScene().SetGeometryHittestEnabled(true);
2112   uint32_t         timestamp = 92858u;
2113   TouchPoint       tp(1, PointState::STARTED, 34.4f, 123.89f, 5.0f, 7.0f);
2114   Dali::TouchEvent touchEvent = Integration::NewTouchEvent(timestamp, tp);
2115
2116   DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
2117   DALI_TEST_EQUALS(touchEvent.GetState(0), PointState::STARTED, TEST_LOCATION);
2118   DALI_TEST_EQUALS(touchEvent.GetLocalPosition(0), Vector2(5.0f, 7.0f), TEST_LOCATION);
2119   DALI_TEST_EQUALS(touchEvent.GetScreenPosition(0), Vector2(34.4f, 123.89f), TEST_LOCATION);
2120
2121   END_TEST;
2122 }
2123
2124 int UtcDaliGeoTouchEventIntercept01(void)
2125 {
2126   TestApplication application;
2127
2128   application.GetScene().SetGeometryHittestEnabled(true);
2129
2130   Actor actor = Actor::New();
2131   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2132   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2133   application.GetScene().Add(actor);
2134
2135   // Render and notify
2136   application.SendNotification();
2137   application.Render();
2138
2139   // Connect to actor's intercept touched signal
2140   SignalData        data;
2141   TouchEventFunctor functor(data, false /* Do not consume */);
2142   Dali::DevelActor::InterceptTouchedSignal(actor).Connect(&application, functor);
2143
2144   // Emit a down signal
2145   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
2146
2147   // It should be able to receive touch events by registering only InterceptTouchEvent.
2148   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2149   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
2150   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
2151   DALI_TEST_CHECK(actor == data.touchedActor);
2152   data.Reset();
2153
2154   END_TEST;
2155 }
2156
2157 int UtcDaliGeoTouchEventIntercept02(void)
2158 {
2159   TestApplication application;
2160
2161   application.GetScene().SetGeometryHittestEnabled(true);
2162
2163   Actor parent = Actor::New();
2164   parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2165   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2166   application.GetScene().Add(parent);
2167
2168   Actor actor = Actor::New();
2169   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2170   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2171   parent.Add(actor);
2172
2173   // Render and notify
2174   application.SendNotification();
2175   application.Render();
2176
2177   // Connect to actor's touched signal
2178   SignalData        data;
2179   TouchEventFunctor functor(data, false /* Do not consume */);
2180   actor.TouchedSignal().Connect(&application, functor);
2181
2182   // Connect to parent's touched signal
2183   SignalData        parentData;
2184   TouchEventFunctor parentFunctor(parentData, false /* Do not consume */);
2185   parent.TouchedSignal().Connect(&application, parentFunctor);
2186
2187   // Emit a down signal
2188   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
2189   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2190   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
2191
2192   data.Reset();
2193   parentData.Reset();
2194
2195   // Connect to parent's intercept touched signal
2196   SignalData        interceptData;
2197   TouchEventFunctor interceptFunctor(interceptData, true /* Do intercept */);
2198   Dali::DevelActor::InterceptTouchedSignal(parent).Connect(&application, interceptFunctor);
2199
2200   // Emit a down signal
2201   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
2202
2203   // The actor gets interrupted. Because touch is intercepted by parent.
2204   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2205   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
2206   DALI_TEST_EQUALS(true, interceptData.functorCalled, TEST_LOCATION);
2207   DALI_TEST_EQUALS(PointState::DOWN, interceptData.receivedTouch.points[0].state, TEST_LOCATION);
2208   DALI_TEST_CHECK(actor == interceptData.receivedTouch.points[0].hitActor);
2209   DALI_TEST_CHECK(parent == interceptData.touchedActor);
2210   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
2211   DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION);
2212   DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor);
2213   DALI_TEST_CHECK(parent == parentData.touchedActor);
2214   data.Reset();
2215   interceptData.Reset();
2216   parentData.Reset();
2217
2218   // Render and notify
2219   application.SendNotification();
2220   application.Render();
2221
2222   // Emit a move signal
2223   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 20.0f)));
2224
2225   // Since InterceptTouchEvent is not called because it has already been intercepted by the parent, only the parent will receive the touchEvent.
2226   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2227   DALI_TEST_EQUALS(false, interceptData.functorCalled, TEST_LOCATION);
2228   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
2229   DALI_TEST_EQUALS(PointState::MOTION, parentData.receivedTouch.points[0].state, TEST_LOCATION);
2230   DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor);
2231   DALI_TEST_CHECK(parent == parentData.touchedActor);
2232   data.Reset();
2233   interceptData.Reset();
2234   parentData.Reset();
2235
2236   END_TEST;
2237 }
2238
2239 int UtcDaliGeoTouchEventIntercept03(void)
2240 {
2241   TestApplication application;
2242
2243   application.GetScene().SetGeometryHittestEnabled(true);
2244
2245   // Add a layer to overlap the actor
2246   Layer layer = Layer::New();
2247   layer.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2248   layer.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2249   application.GetScene().Add(layer);
2250   layer.RaiseToTop();
2251
2252   // Set layer to consume all touch
2253   layer.SetProperty(Layer::Property::CONSUMES_TOUCH, true);
2254
2255   // Render and notify
2256   application.SendNotification();
2257   application.Render();
2258
2259   Actor actor = Actor::New();
2260   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2261   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2262   layer.Add(actor);
2263
2264   // Render and notify
2265   application.SendNotification();
2266   application.Render();
2267
2268   Actor rootActor(application.GetScene().GetRootLayer());
2269
2270   // Connect to root actor's intercept touched signal
2271   SignalData        sceneData;
2272   TouchEventFunctor sceneFunctor(sceneData);
2273   Dali::DevelActor::InterceptTouchedSignal(rootActor).Connect(&application, sceneFunctor);
2274
2275   // Render and notify
2276   application.SendNotification();
2277   application.Render();
2278
2279   // Emit a down signal
2280   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
2281
2282   // Even if the layer is touch consumed, the root actor must be able to intercept touch.
2283   DALI_TEST_EQUALS(true, sceneData.functorCalled, TEST_LOCATION);
2284   sceneData.Reset();
2285
2286   END_TEST;
2287 }
2288
2289 int UtcDaliGeoTouchEventIntercept04(void)
2290 {
2291   TestApplication application;
2292
2293   application.GetScene().SetGeometryHittestEnabled(true);
2294
2295   Actor parent = Actor::New();
2296   parent.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2297   parent.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2298   application.GetScene().Add(parent);
2299
2300   Actor actor = Actor::New();
2301   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2302   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2303   parent.Add(actor);
2304
2305   // Render and notify
2306   application.SendNotification();
2307   application.Render();
2308
2309   // Connect to actor's touched signal
2310   SignalData        data;
2311   TouchEventFunctor functor(data); // consume
2312   actor.TouchedSignal().Connect(&application, functor);
2313
2314   // Connect to parent's touched signal
2315   SignalData        parentData;
2316   TouchEventFunctor parentFunctor(parentData); // consume
2317   parent.TouchedSignal().Connect(&application, parentFunctor);
2318
2319   // Emit a down signal
2320   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
2321   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2322   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
2323
2324   data.Reset();
2325   parentData.Reset();
2326
2327   // Connect to parent's intercept touched signal
2328   SignalData        interceptData;
2329   TouchEventFunctor interceptFunctor(interceptData, true /* Do intercept */);
2330   Dali::DevelActor::InterceptTouchedSignal(parent).Connect(&application, interceptFunctor);
2331
2332   // Emit a down signal
2333   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
2334
2335   // The actor gets interrupted. Because touch is intercepted by parent.
2336   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2337   DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
2338   DALI_TEST_EQUALS(true, interceptData.functorCalled, TEST_LOCATION);
2339   DALI_TEST_EQUALS(PointState::DOWN, interceptData.receivedTouch.points[0].state, TEST_LOCATION);
2340   DALI_TEST_CHECK(actor == interceptData.receivedTouch.points[0].hitActor);
2341   DALI_TEST_CHECK(parent == interceptData.touchedActor);
2342   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
2343   DALI_TEST_EQUALS(PointState::DOWN, parentData.receivedTouch.points[0].state, TEST_LOCATION);
2344   DALI_TEST_CHECK(actor == parentData.receivedTouch.points[0].hitActor);
2345   DALI_TEST_CHECK(parent == parentData.touchedActor);
2346   data.Reset();
2347   interceptData.Reset();
2348   parentData.Reset();
2349
2350   // Render and notify
2351   application.SendNotification();
2352   application.Render();
2353
2354   // Emit a move signal
2355   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 20.0f)));
2356
2357   // Since InterceptTouchEvent is not called because it has already been intercepted by the parent, only the parent will receive the touchEvent.
2358   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2359   DALI_TEST_EQUALS(false, interceptData.functorCalled, TEST_LOCATION);
2360   DALI_TEST_EQUALS(true, parentData.functorCalled, TEST_LOCATION);
2361   DALI_TEST_EQUALS(PointState::MOTION, parentData.receivedTouch.points[0].state, TEST_LOCATION);
2362   DALI_TEST_CHECK(parent == parentData.receivedTouch.points[0].hitActor);
2363   DALI_TEST_CHECK(parent == parentData.touchedActor);
2364   data.Reset();
2365   interceptData.Reset();
2366   parentData.Reset();
2367
2368   END_TEST;
2369 }
2370
2371 int UtcDaliGeoTouchAreaOffset(void)
2372 {
2373   TestApplication application;
2374
2375   application.GetScene().SetGeometryHittestEnabled(true);
2376
2377   Actor actor = Actor::New();
2378   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2379   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2380
2381   application.GetScene().Add(actor);
2382
2383   // Render and notify
2384   application.SendNotification();
2385   application.Render();
2386
2387   // Connect to actor's touched signal
2388   SignalData        data;
2389   TouchEventFunctor functor(data, false /* Do not consume */);
2390   actor.TouchedSignal().Connect(&application, functor);
2391
2392   // Emit a down signal
2393   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(110.0f, 110.0f)));
2394   // The actor touched signal is not called because the touch area is outside actor.
2395   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2396   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(110.0f, 110.0f)));
2397   data.Reset();
2398
2399   // set a bigger touch area
2400   actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(-70, 70, 70, -70)); // left, right, bottom, top
2401
2402   // Render and notify
2403   application.SendNotification();
2404   application.Render();
2405
2406   // Emit a down signal
2407   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(150.0f, 150.0f)));
2408   // The actor touched signal is called because the touch area is inside touchArea.
2409   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2410   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
2411   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
2412   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(150.0f, 150.0f)));
2413   data.Reset();
2414
2415   // set a offset touch area
2416   actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(50, 100, -50, 0)); // left, right, bottom, top
2417
2418   // Render and notify
2419   application.SendNotification();
2420   application.Render();
2421
2422   // Emit a down signal
2423   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(190.0f, 25.0f)));
2424   // The actor touched signal is called because the touch area is inside touchArea.
2425   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2426   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
2427   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
2428   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(190.0f, 25.0f)));
2429   data.Reset();
2430
2431   // set a smaller touch area
2432   actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(50, 0, 0, 50));
2433
2434   // Render and notify
2435   application.SendNotification();
2436   application.Render();
2437
2438   // Emit a down signal
2439   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(40.0f, 40.0f)));
2440   // The actor touched signal is not called because the touch area is outside touchArea.
2441   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2442   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(40.0f, 40.0f)));
2443   data.Reset();
2444
2445   // Emit a down signal
2446   application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(90.0f, 90.0f)));
2447   // The actor touched signal is called because the touch area is inside touchArea.
2448   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2449   DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
2450   DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor);
2451   application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(90.0f, 90.0f)));
2452   data.Reset();
2453
2454   END_TEST;
2455 }
2456
2457 int UtcDaliGeoTouchEventAllowOnlyOwnTouchPropertySet(void)
2458 {
2459   TestApplication application;
2460
2461   application.GetScene().SetGeometryHittestEnabled(true);
2462
2463   Actor actor = Actor::New();
2464   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2465   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2466   application.GetScene().Add(actor);
2467
2468   // Render and notify
2469   application.SendNotification();
2470   application.Render();
2471
2472   // Connect to actor's touched signal
2473   SignalData        data;
2474   TouchEventFunctor functor(data);
2475   actor.TouchedSignal().Connect(&application, functor);
2476
2477   // AllowOnlyOwnTouch is default. We don't turn this on/off.
2478   // Now set the only allow own touch property
2479   // actor.SetProperty(DevelActor::Property::ALLOW_ONLY_OWN_TOUCH, true);
2480
2481   // Emit a down signal outside of actor, we should not receive the event
2482   application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(110.0f, 110.0f)));
2483   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2484   data.Reset();
2485
2486   // Now motion inside of actor, we should NOT receive the event
2487   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(80.0f, 80.0f)));
2488   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2489   data.Reset();
2490
2491   // Up event, should not receive the event
2492   application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f)));
2493   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2494   data.Reset();
2495
2496   // Emit a down signal inside of actor, we should receive the event
2497   application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(10.0f, 10.0f)));
2498   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2499   data.Reset();
2500
2501   // Now motion inside of actor, we should receive the event
2502   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(80.0f, 80.0f)));
2503   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2504   data.Reset();
2505
2506   // Now motion outsize of actor, we should receive the event
2507   // CAPTURE_ALL_TOUCH_AFTER_START is now the default policy. We don't turn this on/off.
2508   // So, even though it is outside the actor, it receives the event.
2509   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(110.0f, 110.0f)));
2510   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2511   data.Reset();
2512
2513   // Up event, should receive an finished
2514   application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f)));
2515   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2516   DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION);
2517   data.Reset();
2518
2519   END_TEST;
2520 }
2521
2522 int UtcDaliGeoTouchEventDispatchTouchMotionPropertySet(void)
2523 {
2524   TestApplication application;
2525
2526   application.GetScene().SetGeometryHittestEnabled(true);
2527
2528   Actor actor = Actor::New();
2529   actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
2530   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2531   application.GetScene().Add(actor);
2532
2533   // Render and notify
2534   application.SendNotification();
2535   application.Render();
2536
2537   // Connect to actor's touched signal
2538   SignalData        data;
2539   TouchEventFunctor functor(data);
2540   actor.TouchedSignal().Connect(&application, functor);
2541
2542   // Emit a down signal actor, we should receive the event
2543   application.ProcessEvent(GenerateSingleTouch(PointState::STARTED, Vector2(10.0f, 10.0f)));
2544   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2545   DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::STARTED, TEST_LOCATION);
2546   data.Reset();
2547
2548   // Emit a motion signal actor, we should receive the event
2549   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 20.0f)));
2550   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2551   DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::MOTION, TEST_LOCATION);
2552   data.Reset();
2553
2554   // Now set the dispatch touch motion property
2555   actor.SetProperty(DevelActor::Property::DISPATCH_TOUCH_MOTION, false);
2556
2557   // Emit a motion signal actor, we should not receive the event
2558   application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(30.0f, 30.0f)));
2559   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
2560   data.Reset();
2561
2562   // Up event, should receive the event
2563   application.ProcessEvent(GenerateSingleTouch(PointState::FINISHED, Vector2(40.0f, 40.0f)));
2564   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
2565   DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION);
2566   data.Reset();
2567
2568   data.Reset();
2569
2570   END_TEST;
2571 }