Remove SystemOverlay.
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-TouchProcessing.cpp
1 /*
2  * Copyright (c) 2014 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 <iostream>
19
20 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include <dali/integration-api/events/touch-event-integ.h>
23 #include <dali/integration-api/render-task-list-integ.h>
24 #include <dali-test-suite-utils.h>
25
26 using namespace Dali;
27
28 void utc_dali_touch_processing_startup(void)
29 {
30   test_return_value = TET_UNDEF;
31 }
32
33 void utc_dali_touch_processing_cleanup(void)
34 {
35   test_return_value = TET_PASS;
36 }
37
38 ///////////////////////////////////////////////////////////////////////////////
39
40 namespace
41 {
42
43 // Stores data that is populated in the callback and will be read by the TET cases
44 struct SignalData
45 {
46   SignalData()
47   : functorCalled( false ),
48     touchEvent(),
49     touchedActor()
50   {
51   }
52
53   void Reset()
54   {
55     functorCalled = false;
56
57     touchEvent.time = 0u;
58     touchEvent.points.clear();
59
60     touchedActor.Reset();
61   }
62
63   bool functorCalled;
64   TouchEvent touchEvent;
65   Actor touchedActor;
66 };
67
68 // Functor that sets the data when called
69 struct TouchEventFunctor
70 {
71   /**
72    * Constructor.
73    * @param[in]  data         Reference to the data to store callback information.
74    * @param[in]  returnValue  What the functor should return.
75    */
76   TouchEventFunctor( SignalData& data, bool returnValue = true )
77   : signalData( data ),
78     returnValue( returnValue )
79   {
80   }
81
82   bool operator()( Actor actor, const TouchEvent& touchEvent )
83   {
84     signalData.functorCalled = true;
85     signalData.touchedActor = actor;
86     signalData.touchEvent = touchEvent;
87
88     return returnValue;
89   }
90
91   SignalData& signalData;
92   bool returnValue;
93 };
94
95 // Functor that removes the actor when called.
96 struct RemoveActorFunctor : public TouchEventFunctor
97 {
98   /**
99    * Constructor.
100    * @param[in]  data         Reference to the data to store callback information.
101    * @param[in]  returnValue  What the functor should return.
102    */
103   RemoveActorFunctor( SignalData& data, bool returnValue = true )
104   : TouchEventFunctor( data, returnValue )
105   {
106   }
107
108   bool operator()( Actor actor, const TouchEvent& touchEvent )
109   {
110     Actor parent( actor.GetParent() );
111     if ( parent )
112     {
113       parent.Remove( actor );
114     }
115
116     return TouchEventFunctor::operator()( actor, touchEvent );
117   }
118 };
119
120 Integration::TouchEvent GenerateSingleTouch( TouchPoint::State state, const Vector2& screenPosition )
121 {
122   Integration::TouchEvent touchEvent;
123   Integration::Point point;
124   point.SetState( static_cast< PointState::Type >( state ) );
125   point.SetScreenPosition( screenPosition );
126   touchEvent.points.push_back( point );
127   return touchEvent;
128 }
129
130 } // anon namespace
131
132 ///////////////////////////////////////////////////////////////////////////////
133
134 int UtcDaliTouchNormalProcessing(void)
135 {
136   TestApplication application;
137
138   Actor actor = Actor::New();
139   actor.SetSize(100.0f, 100.0f);
140   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
141   Stage::GetCurrent().Add(actor);
142
143   // Render and notify
144   application.SendNotification();
145   application.Render();
146
147   // Connect to actor's touched signal
148   SignalData data;
149   TouchEventFunctor functor( data );
150   actor.TouchedSignal().Connect( &application, functor );
151
152   Vector2 screenCoordinates( 10.0f, 10.0f );
153   Vector2 localCoordinates;
154   actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
155
156   // Emit a down signal
157   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
158   const TouchPoint *point1 = &data.touchEvent.GetPoint(0);
159   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
160   DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION );
161   DALI_TEST_EQUALS( TouchPoint::Down, point1->state, TEST_LOCATION );
162   DALI_TEST_EQUALS( screenCoordinates, point1->screen, TEST_LOCATION );
163   DALI_TEST_EQUALS( localCoordinates, point1->local, 0.1f, TEST_LOCATION );
164   data.Reset();
165
166   // Emit a motion signal
167   screenCoordinates.x = screenCoordinates.y = 11.0f;
168   actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
169   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, screenCoordinates ) );
170   const TouchPoint *point2 = &data.touchEvent.GetPoint(0);
171   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
172   DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION );
173   DALI_TEST_EQUALS( TouchPoint::Motion, point2->state, TEST_LOCATION );
174   DALI_TEST_EQUALS( screenCoordinates, point2->screen, TEST_LOCATION );
175   DALI_TEST_EQUALS( localCoordinates, point2->local, 0.1f, TEST_LOCATION );
176   data.Reset();
177
178   // Emit an up signal
179   screenCoordinates.x = screenCoordinates.y = 12.0f;
180   actor.ScreenToLocal( localCoordinates.x, localCoordinates.y, screenCoordinates.x, screenCoordinates.y );
181   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, screenCoordinates ) );
182
183   const TouchPoint *point3ptr = &data.touchEvent.GetPoint(0);
184   TouchPoint point3( point3ptr->deviceId, point3ptr->state, point3ptr->screen.x, point3ptr->screen.y, point3ptr->local.x, point3ptr->local.y );
185
186   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
187   DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION );
188   DALI_TEST_EQUALS( TouchPoint::Up, point3.state, TEST_LOCATION );
189   DALI_TEST_EQUALS( screenCoordinates, point3.screen, TEST_LOCATION );
190   DALI_TEST_EQUALS( localCoordinates, point3.local, 0.1f, TEST_LOCATION );
191   data.Reset();
192
193   // Emit a down signal where the actor is not present
194   screenCoordinates.x = screenCoordinates.y = 200.0f;
195   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
196   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
197   END_TEST;
198 }
199
200 int UtcDaliTouchOutsideCameraNearFarPlanes(void)
201 {
202   TestApplication application;
203
204   Stage stage = Stage::GetCurrent();
205   Vector2 stageSize = stage.GetSize();
206
207   Actor actor = Actor::New();
208   actor.SetSize(100.0f, 100.0f);
209   actor.SetAnchorPoint(AnchorPoint::CENTER);
210   actor.SetParentOrigin(ParentOrigin::CENTER);
211   stage.Add(actor);
212
213   // Render and notify
214   application.SendNotification();
215   application.Render();
216
217   // Get the camera's near and far planes
218   RenderTaskList taskList = stage.GetRenderTaskList();
219   Dali::RenderTask task = taskList.GetTask(0);
220   CameraActor camera = task.GetCameraActor();
221   float nearPlane = camera.GetNearClippingPlane();
222   float farPlane = camera.GetFarClippingPlane();
223
224   // Calculate the current distance of the actor from the camera
225   float tanHalfFov = tanf(camera.GetFieldOfView() * 0.5f);
226   float distance = (stageSize.y * 0.5f) / tanHalfFov;
227
228   // Connect to actor's touched signal
229   SignalData data;
230   TouchEventFunctor functor( data );
231   actor.TouchedSignal().Connect( &application, functor );
232
233   Vector2 screenCoordinates( stageSize.x * 0.5f, stageSize.y * 0.5f );
234
235   // Emit a down signal
236   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
237   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
238   data.Reset();
239
240   // Emit a down signal where actor is just at the camera's near plane
241   actor.SetZ(distance - nearPlane);
242
243   // Render and notify
244   application.SendNotification();
245   application.Render();
246
247   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
248   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
249   data.Reset();
250
251   // Emit a down signal where actor is closer than the camera's near plane
252   actor.SetZ((distance - nearPlane) + 1.0f);
253
254   // Render and notify
255   application.SendNotification();
256   application.Render();
257
258   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
259   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
260   data.Reset();
261
262   // Emit a down signal where actor is just at the camera's far plane
263   actor.SetZ(distance - farPlane);
264
265   // Render and notify
266   application.SendNotification();
267   application.Render();
268
269   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
270   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
271   data.Reset();
272
273   // Emit a down signal where actor is further than the camera's far plane
274   actor.SetZ((distance - farPlane) - 1.0f);
275
276   // Render and notify
277   application.SendNotification();
278   application.Render();
279
280   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
281   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
282   data.Reset();
283   END_TEST;
284 }
285
286 int UtcDaliTouchEmitEmpty(void)
287 {
288   TestApplication application;
289
290   try
291   {
292     // Emit an empty TouchEvent
293     Integration::TouchEvent event;
294     application.ProcessEvent( event );
295     tet_result( TET_FAIL );
296   }
297   catch ( Dali::DaliException& e )
298   {
299     DALI_TEST_ASSERT( e, "!event.points.empty()", TEST_LOCATION );
300   }
301   END_TEST;
302 }
303
304 int UtcDaliTouchInterrupted(void)
305 {
306   TestApplication application;
307
308   Actor actor = Actor::New();
309   actor.SetSize(100.0f, 100.0f);
310   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
311   Stage::GetCurrent().Add(actor);
312
313   // Render and notify
314   application.SendNotification();
315   application.Render();
316
317   // Connect to actor's touched signal
318   SignalData data;
319   TouchEventFunctor functor( data );
320   actor.TouchedSignal().Connect( &application, functor );
321
322   // Emit a down signal
323   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
324   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
325   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
326   data.Reset();
327
328   // Emit an interrupted signal, we should be signalled regardless of whether there is a hit or not.
329   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
330   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
331   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
332   data.Reset();
333
334   // Emit another interrupted signal, our signal handler should not be called.
335   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
336   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
337   END_TEST;
338 }
339
340 int UtcDaliTouchParentConsumer(void)
341 {
342   TestApplication application;
343   Actor rootActor( Stage::GetCurrent().GetRootLayer() );
344
345   Actor actor = Actor::New();
346   actor.SetSize(100.0f, 100.0f);
347   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
348   Stage::GetCurrent().Add(actor);
349
350   // Render and notify
351   application.SendNotification();
352   application.Render();
353
354   // Connect to actor's touched signal
355   SignalData data;
356   TouchEventFunctor functor( data, false );
357   actor.TouchedSignal().Connect( &application, functor );
358
359   // Connect to root actor's touched signal
360   SignalData rootData;
361   TouchEventFunctor rootFunctor( rootData ); // Consumes signal
362   rootActor.TouchedSignal().Connect( &application, rootFunctor );
363
364   Vector2 screenCoordinates( 10.0f, 10.0f );
365   Vector2 actorCoordinates, rootCoordinates;
366   actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
367   rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
368
369   // Emit a down signal
370   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
371   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
372   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
373   DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION );
374   DALI_TEST_EQUALS( 1u, rootData.touchEvent.GetPointCount(), TEST_LOCATION );
375   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
376   DALI_TEST_EQUALS( TouchPoint::Down, rootData.touchEvent.points[0].state, TEST_LOCATION );
377   DALI_TEST_EQUALS( screenCoordinates, data.touchEvent.points[0].screen, TEST_LOCATION );
378   DALI_TEST_EQUALS( screenCoordinates, rootData.touchEvent.points[0].screen, TEST_LOCATION );
379   DALI_TEST_EQUALS( actorCoordinates, data.touchEvent.points[0].local, 0.1f, TEST_LOCATION );
380   DALI_TEST_EQUALS( rootCoordinates, rootData.touchEvent.points[0].local, 0.1f, TEST_LOCATION );
381   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
382   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
383   data.Reset();
384   rootData.Reset();
385
386   // Emit a motion signal
387   screenCoordinates.x = screenCoordinates.y = 11.0f;
388   actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
389   rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
390   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, screenCoordinates ) );
391   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
392   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
393   DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION );
394   DALI_TEST_EQUALS( 1u, rootData.touchEvent.GetPointCount(), TEST_LOCATION );
395   DALI_TEST_EQUALS( TouchPoint::Motion, data.touchEvent.points[0].state, TEST_LOCATION );
396   DALI_TEST_EQUALS( TouchPoint::Motion, rootData.touchEvent.points[0].state, TEST_LOCATION );
397   DALI_TEST_EQUALS( screenCoordinates, data.touchEvent.points[0].screen, TEST_LOCATION );
398   DALI_TEST_EQUALS( screenCoordinates, rootData.touchEvent.points[0].screen, TEST_LOCATION );
399   DALI_TEST_EQUALS( actorCoordinates, data.touchEvent.points[0].local, 0.1f, TEST_LOCATION );
400   DALI_TEST_EQUALS( rootCoordinates, rootData.touchEvent.points[0].local, 0.1f, TEST_LOCATION );
401   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
402   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
403   data.Reset();
404   rootData.Reset();
405
406   // Emit an up signal
407   screenCoordinates.x = screenCoordinates.y = 12.0f;
408   actor.ScreenToLocal( actorCoordinates.x, actorCoordinates.y, screenCoordinates.x, screenCoordinates.y );
409   rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
410   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, screenCoordinates ) );
411   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
412   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
413   DALI_TEST_EQUALS( 1u, data.touchEvent.GetPointCount(), TEST_LOCATION );
414   DALI_TEST_EQUALS( 1u, rootData.touchEvent.GetPointCount(), TEST_LOCATION );
415   DALI_TEST_EQUALS( TouchPoint::Up, data.touchEvent.points[0].state, TEST_LOCATION );
416   DALI_TEST_EQUALS( TouchPoint::Up, rootData.touchEvent.points[0].state, TEST_LOCATION );
417   DALI_TEST_EQUALS( screenCoordinates, data.touchEvent.points[0].screen, TEST_LOCATION );
418   DALI_TEST_EQUALS( screenCoordinates, rootData.touchEvent.points[0].screen, TEST_LOCATION );
419   DALI_TEST_EQUALS( actorCoordinates, data.touchEvent.points[0].local, 0.1f, TEST_LOCATION );
420   DALI_TEST_EQUALS( rootCoordinates, rootData.touchEvent.points[0].local, 0.1f, TEST_LOCATION );
421   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
422   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
423   data.Reset();
424   rootData.Reset();
425
426   // Emit a down signal where the actor is not present, will hit the root actor though
427   screenCoordinates.x = screenCoordinates.y = 200.0f;
428   rootActor.ScreenToLocal( rootCoordinates.x, rootCoordinates.y, screenCoordinates.x, screenCoordinates.y );
429   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, screenCoordinates ) );
430   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
431   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
432   DALI_TEST_EQUALS( 1u, rootData.touchEvent.GetPointCount(), TEST_LOCATION );
433   DALI_TEST_EQUALS( TouchPoint::Down, rootData.touchEvent.points[0].state, TEST_LOCATION );
434   DALI_TEST_EQUALS( screenCoordinates, rootData.touchEvent.points[0].screen, TEST_LOCATION );
435   DALI_TEST_EQUALS( rootCoordinates, rootData.touchEvent.points[0].local, 0.1f, TEST_LOCATION );
436   DALI_TEST_CHECK( rootActor == rootData.touchEvent.points[0].hitActor );
437   END_TEST;
438 }
439
440 int UtcDaliTouchInterruptedParentConsumer(void)
441 {
442   TestApplication application;
443   Actor rootActor( Stage::GetCurrent().GetRootLayer() );
444
445   Actor actor = Actor::New();
446   actor.SetSize(100.0f, 100.0f);
447   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
448   Stage::GetCurrent().Add(actor);
449
450   // Render and notify
451   application.SendNotification();
452   application.Render();
453
454   // Connect to actor's touched signal
455   SignalData data;
456   TouchEventFunctor functor( data, false );
457   actor.TouchedSignal().Connect( &application, functor );
458
459   // Connect to root actor's touched signal
460   SignalData rootData;
461   TouchEventFunctor rootFunctor( rootData ); // Consumes signal
462   rootActor.TouchedSignal().Connect( &application, rootFunctor );
463
464   // Emit a down signal
465   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
466   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
467   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
468   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
469   DALI_TEST_EQUALS( TouchPoint::Down, rootData.touchEvent.points[0].state, TEST_LOCATION );
470   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
471   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
472   data.Reset();
473   rootData.Reset();
474
475   // Emit an interrupted signal
476   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
477   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
478   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
479   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
480   DALI_TEST_EQUALS( TouchPoint::Interrupted, rootData.touchEvent.points[0].state, TEST_LOCATION );
481   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
482   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
483   data.Reset();
484   rootData.Reset();
485
486   // Emit another down signal
487   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
488   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
489   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
490   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
491   DALI_TEST_EQUALS( TouchPoint::Down, rootData.touchEvent.points[0].state, TEST_LOCATION );
492   data.Reset();
493   rootData.Reset();
494
495   // Remove actor from Stage
496   Stage::GetCurrent().Remove( actor );
497   data.Reset();
498   rootData.Reset();
499
500   // Render and notify
501   application.SendNotification();
502   application.Render();
503
504   // Emit an interrupted signal, only root actor's signal should be called.
505   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f /* Outside actor */ ) ) );
506   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
507   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
508   DALI_TEST_EQUALS( TouchPoint::Interrupted, rootData.touchEvent.points[0].state, TEST_LOCATION );
509   DALI_TEST_CHECK( rootActor == rootData.touchEvent.points[0].hitActor );
510   data.Reset();
511   rootData.Reset();
512
513   // Emit another interrupted state, none of the signal's should be called.
514   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 200.0f, 200.0f ) ) );
515   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
516   DALI_TEST_EQUALS( false, rootData.functorCalled, TEST_LOCATION );
517   END_TEST;
518 }
519
520 int UtcDaliTouchLeave(void)
521 {
522   TestApplication application;
523
524   Actor actor = Actor::New();
525   actor.SetSize(100.0f, 100.0f);
526   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
527   Stage::GetCurrent().Add(actor);
528
529   // Render and notify
530   application.SendNotification();
531   application.Render();
532
533   // Connect to actor's touched signal
534   SignalData data;
535   TouchEventFunctor functor( data );
536   actor.TouchedSignal().Connect( &application, functor );
537
538   // Set actor to require leave events
539   actor.SetLeaveRequired( true );
540
541   // Emit a down signal
542   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
543   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
544   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
545   data.Reset();
546
547   // Emit a motion signal outside of actor, should be signalled with a Leave
548   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
549   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
550   DALI_TEST_EQUALS( TouchPoint::Leave, data.touchEvent.points[0].state, TEST_LOCATION );
551   data.Reset();
552
553   // Another motion outside of actor, no signalling
554   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 201.0f, 201.0f )) );
555   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
556   data.Reset();
557
558   // Another motion event inside actor, signalled with motion
559   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 10.0f, 10.0f )) );
560   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
561   DALI_TEST_EQUALS( TouchPoint::Motion, data.touchEvent.points[0].state, TEST_LOCATION );
562   data.Reset();
563
564   // We do not want to listen to leave events anymore
565   actor.SetLeaveRequired( false );
566
567   // Another motion event outside of actor, no signalling
568   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
569   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
570   data.Reset();
571   END_TEST;
572 }
573
574 int UtcDaliTouchLeaveParentConsumer(void)
575 {
576   TestApplication application;
577   Actor rootActor( Stage::GetCurrent().GetRootLayer() );
578
579   Actor actor = Actor::New();
580   actor.SetSize(100.0f, 100.0f);
581   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
582   Stage::GetCurrent().Add(actor);
583
584   // Render and notify
585   application.SendNotification();
586   application.Render();
587
588   // Connect to actor's touched signal
589   SignalData data;
590   TouchEventFunctor functor( data, false );
591   actor.TouchedSignal().Connect( &application, functor );
592
593   // Connect to root actor's touched signal
594   SignalData rootData;
595   TouchEventFunctor rootFunctor( rootData ); // Consumes signal
596   rootActor.TouchedSignal().Connect( &application, rootFunctor );
597
598   // Set actor to require leave events
599   actor.SetLeaveRequired( true );
600   rootActor.SetLeaveRequired( true );
601
602   // Emit a down signal
603   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
604   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
605   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
606   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
607   DALI_TEST_EQUALS( TouchPoint::Down, rootData.touchEvent.points[0].state, TEST_LOCATION );
608   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
609   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
610   data.Reset();
611   rootData.Reset();
612
613   // Emit a motion signal outside of actor, should be signalled with a Leave
614   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
615   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
616   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
617   DALI_TEST_EQUALS( TouchPoint::Leave, data.touchEvent.points[0].state, TEST_LOCATION );
618   DALI_TEST_EQUALS( TouchPoint::Leave, rootData.touchEvent.points[0].state, TEST_LOCATION );
619   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
620   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
621   data.Reset();
622   rootData.Reset();
623
624   // Another motion outside of actor, only rootActor signalled
625   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 201.0f, 201.0f )) );
626   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
627   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
628   DALI_TEST_EQUALS( TouchPoint::Motion, rootData.touchEvent.points[0].state, TEST_LOCATION );
629   DALI_TEST_CHECK( rootActor == rootData.touchEvent.points[0].hitActor );
630   data.Reset();
631   rootData.Reset();
632
633   // Another motion event inside actor, signalled with motion
634   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 10.0f, 10.0f )) );
635   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
636   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
637   DALI_TEST_EQUALS( TouchPoint::Motion, data.touchEvent.points[0].state, TEST_LOCATION );
638   DALI_TEST_EQUALS( TouchPoint::Motion, rootData.touchEvent.points[0].state, TEST_LOCATION );
639   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
640   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
641   data.Reset();
642   rootData.Reset();
643
644   // We do not want to listen to leave events of actor anymore
645   actor.SetLeaveRequired( false );
646
647   // Another motion event outside of root actor, only root signalled
648   Vector2 stageSize( Stage::GetCurrent().GetSize() );
649   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( stageSize.width + 10.0f, stageSize.height + 10.0f )) );
650   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
651   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
652   DALI_TEST_EQUALS( TouchPoint::Leave, rootData.touchEvent.points[0].state, TEST_LOCATION );
653   END_TEST;
654 }
655
656 int UtcDaliTouchActorBecomesInsensitive(void)
657 {
658   TestApplication application;
659
660   Actor actor = Actor::New();
661   actor.SetSize(100.0f, 100.0f);
662   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
663   Stage::GetCurrent().Add(actor);
664
665   // Render and notify
666   application.SendNotification();
667   application.Render();
668
669   // Connect to actor's touched signal
670   SignalData data;
671   TouchEventFunctor functor( data );
672   actor.TouchedSignal().Connect( &application, functor );
673
674   // Emit a down signal
675   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
676   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
677   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
678   data.Reset();
679
680   // Change actor to insensitive
681   actor.SetSensitive( false );
682
683   // Emit a motion signal, signalled with an interrupted
684   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
685   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
686   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
687   data.Reset();
688   END_TEST;
689 }
690
691 int UtcDaliTouchActorBecomesInsensitiveParentConsumer(void)
692 {
693   TestApplication application;
694   Actor rootActor( Stage::GetCurrent().GetRootLayer() );
695
696   Actor actor = Actor::New();
697   actor.SetSize(100.0f, 100.0f);
698   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
699   Stage::GetCurrent().Add(actor);
700
701   // Render and notify
702   application.SendNotification();
703   application.Render();
704
705   // Connect to actor's touched signal
706   SignalData data;
707   TouchEventFunctor functor( data, false );
708   actor.TouchedSignal().Connect( &application, functor );
709
710   // Connect to root actor's touched signal
711   SignalData rootData;
712   TouchEventFunctor rootFunctor( rootData ); // Consumes signal
713   rootActor.TouchedSignal().Connect( &application, rootFunctor );
714
715   // Emit a down signal
716   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
717   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
718   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
719   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
720   DALI_TEST_EQUALS( TouchPoint::Down, rootData.touchEvent.points[0].state, TEST_LOCATION );
721   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
722   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
723   data.Reset();
724   rootData.Reset();
725
726   // Render and notify
727   application.SendNotification();
728   application.Render();
729
730   // Make root actor insensitive
731   rootActor.SetSensitive( false );
732
733   // Emit a motion signal, signalled with an interrupted (should get interrupted even if within root actor)
734   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2 ( 200.0f, 200.0f )) );
735   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
736   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
737   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
738   DALI_TEST_EQUALS( TouchPoint::Interrupted, rootData.touchEvent.points[0].state, TEST_LOCATION );
739   END_TEST;
740 }
741
742 int UtcDaliTouchMultipleLayers(void)
743 {
744   TestApplication application;
745   Actor rootActor( Stage::GetCurrent().GetRootLayer() );
746
747   // Connect to actor's touched signal
748   SignalData data;
749   TouchEventFunctor functor( data );
750
751   Layer layer1 ( Layer::New() );
752   layer1.SetSize(100.0f, 100.0f);
753   layer1.SetAnchorPoint(AnchorPoint::TOP_LEFT);
754   Stage::GetCurrent().Add( layer1 );
755
756   Actor actor1 ( Actor::New() );
757   actor1.SetSize( 100.0f, 100.0f );
758   actor1.SetAnchorPoint(AnchorPoint::TOP_LEFT);
759   actor1.SetZ( 1.0f ); // Should hit actor1 in this layer
760   layer1.Add( actor1 );
761
762   // Render and notify
763   application.SendNotification();
764   application.Render();
765
766   // Connect to layer1 and actor1
767   layer1.TouchedSignal().Connect( &application, functor );
768   actor1.TouchedSignal().Connect( &application, functor );
769
770   // Hit in hittable area, actor1 should be hit
771   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
772   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
773   DALI_TEST_CHECK( data.touchedActor == actor1 );
774   data.Reset();
775
776   // Make layer1 insensitive, nothing should be hit
777   layer1.SetSensitive( false );
778   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
779   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
780   data.Reset();
781
782   // Make layer1 sensitive again, again actor1 will be hit
783   layer1.SetSensitive( true );
784   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
785   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
786   DALI_TEST_CHECK( data.touchedActor == actor1 );
787   data.Reset();
788
789   // Make rootActor insensitive, nothing should be hit
790   rootActor.SetSensitive( false );
791   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
792   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
793   data.Reset();
794
795   // Make rootActor sensitive
796   rootActor.SetSensitive( true );
797
798   // Add another layer
799   Layer layer2 ( Layer::New() );
800   layer2.SetSize(100.0f, 100.0f );
801   layer2.SetAnchorPoint(AnchorPoint::TOP_LEFT);
802   layer2.SetZ( 10.0f ); // Should hit layer2 in this layer rather than actor2
803   Stage::GetCurrent().Add( layer2 );
804
805   Actor actor2 ( Actor::New() );
806   actor2.SetSize(100.0f, 100.0f);
807   actor2.SetAnchorPoint(AnchorPoint::TOP_LEFT);
808   layer2.Add( actor2 );
809
810   // Render and notify
811   application.SendNotification();
812   application.Render();
813
814   // Connect to layer2 and actor2
815   layer2.TouchedSignal().Connect( &application, functor );
816   actor2.TouchedSignal().Connect( &application, functor );
817
818   // Emit an event, should hit layer2
819   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
820   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
821   //DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
822   data.Reset();
823
824   // Make layer2 insensitive, should hit actor1
825   layer2.SetSensitive( false );
826   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
827   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
828   DALI_TEST_CHECK( data.touchedActor == actor1 );
829   data.Reset();
830
831   // Make layer2 sensitive again, should hit layer2
832   layer2.SetSensitive( true );
833   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
834   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
835   //DALI_TEST_CHECK( data.touchedActor == layer2 ); // TODO: Uncomment this after removing renderable hack!
836   data.Reset();
837
838   // Make layer2 invisible, render and notify
839   layer2.SetVisible( false );
840   application.SendNotification();
841   application.Render();
842
843   // Should hit actor1
844   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
845   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
846   DALI_TEST_CHECK( data.touchedActor == actor1 );
847   data.Reset();
848
849   // Make rootActor invisible, render and notify
850   rootActor.SetVisible( false );
851   application.SendNotification();
852   application.Render();
853
854   // Should not hit anything
855   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
856   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
857   data.Reset();
858   END_TEST;
859 }
860
861 int UtcDaliTouchMultipleRenderTasks(void)
862 {
863   TestApplication application;
864   Stage stage ( Stage::GetCurrent() );
865   Vector2 stageSize ( stage.GetSize() );
866
867   Actor actor = Actor::New();
868   actor.SetSize(100.0f, 100.0f);
869   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
870   stage.Add(actor);
871
872   // Create render task
873   Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f );
874   RenderTask renderTask ( Stage::GetCurrent().GetRenderTaskList().CreateTask() );
875   renderTask.SetViewport( viewport );
876   renderTask.SetInputEnabled( true );
877
878   // Render and notify
879   application.SendNotification();
880   application.Render();
881
882   // Connect to actor's touched signal
883   SignalData data;
884   TouchEventFunctor functor( data );
885   actor.TouchedSignal().Connect( &application, functor );
886
887   // Emit a down signal
888   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
889   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
890   data.Reset();
891
892   // Ensure renderTask actor can be hit too.
893   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
894   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
895   data.Reset();
896
897   // Disable input on renderTask, should not be hittable
898   renderTask.SetInputEnabled( false );
899   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
900   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
901   data.Reset();
902   END_TEST;
903 }
904
905 int UtcDaliTouchMultipleRenderTasksWithChildLayer(void)
906 {
907   TestApplication application;
908   Stage stage ( Stage::GetCurrent() );
909   Vector2 stageSize ( stage.GetSize() );
910
911   Actor actor = Actor::New();
912   actor.SetSize(100.0f, 100.0f);
913   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
914   stage.Add(actor);
915
916   Layer layer = Layer::New();
917   layer.SetSize(100.0f, 100.0f);
918   layer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
919   actor.Add(layer);
920
921   // Create render task
922   Viewport viewport( stageSize.width * 0.5f, stageSize.height * 0.5f, stageSize.width * 0.5f, stageSize.height * 0.5f );
923   RenderTask renderTask ( Stage::GetCurrent().GetRenderTaskList().CreateTask() );
924   renderTask.SetViewport( viewport );
925   renderTask.SetInputEnabled( true );
926   renderTask.SetSourceActor( actor );
927
928   // Render and notify
929   application.SendNotification();
930   application.Render();
931
932   // Connect to layer's touched signal
933   SignalData data;
934   TouchEventFunctor functor( data );
935   actor.TouchedSignal().Connect( &application, functor );
936   layer.TouchedSignal().Connect( &application, functor );
937
938   // Emit a down signal
939   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
940   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
941   data.Reset();
942
943   // Ensure renderTask actor can be hit too.
944   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
945   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
946   data.Reset();
947
948   // Disable input on renderTask, should not be hittable
949   renderTask.SetInputEnabled( false );
950   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( viewport.x + 5.0f, viewport.y + 5.0f ) ) );
951   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
952   data.Reset();
953   END_TEST;
954 }
955
956 int UtcDaliTouchOffscreenRenderTasks(void)
957 {
958   TestApplication application;
959   Stage stage ( Stage::GetCurrent() );
960   Vector2 stageSize ( stage.GetSize() );
961
962   // FrameBufferImage for offscreen RenderTask
963   FrameBufferImage frameBufferImage( FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ) );
964
965   // Create a renderable actor to display the FrameBufferImage
966   Actor renderableActor = CreateRenderableActor( frameBufferImage );
967   renderableActor.SetParentOrigin(ParentOrigin::CENTER);
968   renderableActor.SetSize( stageSize.x, stageSize.y );
969   renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME
970   stage.Add( renderableActor );
971
972   Actor actor = Actor::New();
973   actor.SetSize(100.0f, 100.0f);
974   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
975   stage.Add( actor );
976   application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE ); // Ensure framebuffer connects
977
978   stage.GetRenderTaskList().GetTask( 0u ).SetScreenToFrameBufferFunction( RenderTask::FULLSCREEN_FRAMEBUFFER_FUNCTION );
979
980   // Create a RenderTask
981   RenderTask renderTask = stage.GetRenderTaskList().CreateTask();
982   renderTask.SetSourceActor( actor );
983   renderTask.SetTargetFrameBuffer( frameBufferImage );
984   renderTask.SetInputEnabled( true );
985
986   // Create another RenderTask
987   RenderTask renderTask2( stage.GetRenderTaskList().CreateTask() );
988   renderTask2.SetInputEnabled( true );
989
990   // Render and notify
991   application.SendNotification();
992   application.Render();
993
994   // Connect to actor's touched signal
995   SignalData data;
996   TouchEventFunctor functor( data );
997   actor.TouchedSignal().Connect( &application, functor );
998
999   // Emit a down signal
1000   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1001   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1002   data.Reset();
1003   END_TEST;
1004 }
1005
1006 int UtcDaliTouchMultipleRenderableActors(void)
1007 {
1008   TestApplication application;
1009   Stage stage ( Stage::GetCurrent() );
1010   Vector2 stageSize ( stage.GetSize() );
1011
1012   Actor parent = CreateRenderableActor();
1013   parent.SetSize(100.0f, 100.0f);
1014   parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1015   stage.Add(parent);
1016
1017   Actor actor = CreateRenderableActor();
1018   actor.SetSize(100.0f, 100.0f);
1019   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1020   parent.Add(actor);
1021
1022   // Render and notify
1023   application.SendNotification();
1024   application.Render();
1025
1026   // Connect to layer's touched signal
1027   SignalData data;
1028   TouchEventFunctor functor( data );
1029   parent.TouchedSignal().Connect( &application, functor );
1030   actor.TouchedSignal().Connect( &application, functor );
1031
1032   // Emit a down signal
1033   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1034   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1035   DALI_TEST_CHECK( actor == data.touchedActor );
1036   END_TEST;
1037 }
1038
1039 int UtcDaliTouchActorRemovedInSignal(void)
1040 {
1041   TestApplication application;
1042
1043   Actor actor = Actor::New();
1044   actor.SetSize(100.0f, 100.0f);
1045   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1046   Stage::GetCurrent().Add(actor);
1047
1048   // Render and notify
1049   application.SendNotification();
1050   application.Render();
1051
1052   // Connect to actor's touched signal
1053   SignalData data;
1054   RemoveActorFunctor functor( data );
1055   actor.TouchedSignal().Connect( &application, functor );
1056
1057   // Register for leave events
1058   actor.SetLeaveRequired( true );
1059
1060   // Emit a down signal
1061   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1062   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1063   data.Reset();
1064
1065   // Re-add, render and notify
1066   Stage::GetCurrent().Add(actor);
1067   application.SendNotification();
1068   application.Render();
1069
1070   // Emit another signal outside of actor's area, should not get anything as the scene has changed.
1071   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
1072   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
1073   data.Reset();
1074
1075   // Emit a down signal
1076   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1077   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1078   data.Reset();
1079
1080   // Render and notify
1081   application.SendNotification();
1082   application.Render();
1083
1084   // Emit another signal outside of actor's area, should not get anything as the scene has changed.
1085   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
1086   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
1087   data.Reset();
1088
1089   // Re-add actor back to stage, render and notify
1090   Stage::GetCurrent().Add(actor);
1091   application.SendNotification();
1092   application.Render();
1093
1094   // Emit another down event
1095   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1096   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1097   data.Reset();
1098
1099   // Completely delete the actor
1100   actor.Reset();
1101
1102   // Emit event, should not crash and should not receive an event.
1103   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 210.0f, 210.0f ) ) );
1104   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
1105   END_TEST;
1106 }
1107
1108 int UtcDaliTouchActorSignalNotConsumed(void)
1109 {
1110   TestApplication application;
1111
1112   Actor actor = Actor::New();
1113   actor.SetSize(100.0f, 100.0f);
1114   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1115   Stage::GetCurrent().Add(actor);
1116
1117   // Render and notify
1118   application.SendNotification();
1119   application.Render();
1120
1121   // Connect to actor's touched signal
1122   SignalData data;
1123   TouchEventFunctor functor( data, false );
1124   actor.TouchedSignal().Connect( &application, functor );
1125
1126   // Emit a down signal
1127   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1128   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1129   END_TEST;
1130 }
1131
1132 int UtcDaliTouchActorUnStaged(void)
1133 {
1134   TestApplication application;
1135
1136   Actor actor = Actor::New();
1137   actor.SetSize(100.0f, 100.0f);
1138   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1139   Stage::GetCurrent().Add(actor);
1140
1141   // Render and notify
1142   application.SendNotification();
1143   application.Render();
1144
1145   // Connect to actor's touched signal
1146   SignalData data;
1147   TouchEventFunctor functor( data );
1148   actor.TouchedSignal().Connect( &application, functor );
1149
1150   // Emit a down signal
1151   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1152   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1153   data.Reset();
1154
1155   // Remove actor from stage
1156   Stage::GetCurrent().Remove( actor );
1157   data.Reset();
1158
1159   // Render and notify
1160   application.SendNotification();
1161   application.Render();
1162
1163   // Emit a move at the same point, we should not be signalled.
1164   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 10.0f, 10.0f ) ) );
1165   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
1166   data.Reset();
1167   END_TEST;
1168 }
1169
1170 int UtcDaliTouchLayerConsumesTouch(void)
1171 {
1172   TestApplication application;
1173
1174   Actor actor = Actor::New();
1175   actor.SetSize(100.0f, 100.0f);
1176   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1177   Stage::GetCurrent().Add(actor);
1178
1179   // Render and notify
1180   application.SendNotification();
1181   application.Render();
1182
1183   // Connect to actor's touched signal
1184   SignalData data;
1185   TouchEventFunctor functor( data );
1186   actor.TouchedSignal().Connect( &application, functor );
1187
1188   // Add a layer to overlap the actor
1189   Layer layer = Layer::New();
1190   layer.SetSize(100.0f, 100.0f);
1191   layer.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1192   Stage::GetCurrent().Add( layer );
1193   layer.RaiseToTop();
1194
1195   // Render and notify
1196   application.SendNotification();
1197   application.Render();
1198
1199   // Emit a few touch signals
1200   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1201   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, Vector2( 10.0f, 10.0f ) ) );
1202   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1203   data.Reset();
1204
1205   // Set layer to consume all touch
1206   layer.SetTouchConsumed( true );
1207
1208   // Render and notify
1209   application.SendNotification();
1210   application.Render();
1211
1212   // Emit the same signals again, should not receive
1213   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1214   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Up, Vector2( 10.0f, 10.0f ) ) );
1215   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
1216   data.Reset();
1217
1218   END_TEST;
1219 }
1220
1221 int UtcDaliTouchLeaveActorReadded(void)
1222 {
1223   TestApplication application;
1224   Stage stage = Stage::GetCurrent();
1225
1226   Actor actor = Actor::New();
1227   actor.SetSize(100.0f, 100.0f);
1228   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1229   stage.Add(actor);
1230
1231   // Set actor to receive touch-events
1232   actor.SetLeaveRequired( true );
1233
1234   // Render and notify
1235   application.SendNotification();
1236   application.Render();
1237
1238   // Connect to actor's touched signal
1239   SignalData data;
1240   TouchEventFunctor functor( data );
1241   actor.TouchedSignal().Connect( &application, functor );
1242
1243   // Emit a down and motion
1244   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1245   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 11.0f, 10.0f ) ) );
1246   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1247   data.Reset();
1248
1249   // Remove actor from stage and add again
1250   stage.Remove( actor );
1251   stage.Add( actor );
1252
1253   // Emit a motion within the actor's bounds
1254   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 12.0f, 10.0f ) ) );
1255   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1256   data.Reset();
1257
1258   // Emit a motion outside the actor's bounds
1259   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 200.0f, 200.0f ) ) );
1260   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1261   DALI_TEST_EQUALS( TouchPoint::Leave, data.touchEvent.points[0].state, TEST_LOCATION );
1262   data.Reset();
1263
1264   END_TEST;
1265 }
1266
1267 int UtcDaliTouchClippingActor(void)
1268 {
1269   TestApplication application;
1270   Stage stage = Stage::GetCurrent();
1271
1272   Actor actor = Actor::New();
1273   actor.SetSize( 100.0f, 100.0f );
1274   actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1275   stage.Add( actor );
1276
1277   Actor clippingActor = Actor::New();
1278   clippingActor.SetSize( 50.0f, 50.0f );
1279   clippingActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1280   clippingActor.SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
1281   stage.Add( clippingActor );
1282
1283   // Add a child to the clipped region.
1284   Actor clippingChild = Actor::New();
1285   clippingChild.SetSize( 50.0f, 50.0f );
1286   clippingChild.SetPosition( 25.0f, 25.0f );
1287   clippingChild.SetAnchorPoint( AnchorPoint::TOP_LEFT );
1288   clippingActor.Add( clippingChild );
1289
1290   // Render and notify.
1291   application.SendNotification();
1292   application.Render();
1293
1294   // Connect to actor's touched signal.
1295   SignalData data;
1296   TouchEventFunctor functor( data );
1297   actor.TouchedSignal().Connect( &application, functor );
1298
1299   // Emit an event within clipped area - no hit.
1300   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1301   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
1302   data.Reset();
1303
1304   // Emit an event outside the clipped area but within the actor area, we should have a hit.
1305   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 60.0f, 60.0f ) ) );
1306   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1307   data.Reset();
1308
1309   clippingChild.TouchedSignal().Connect( &application, functor );
1310
1311   // Emit an event inside part of the child which is within the clipped area, we should have a hit.
1312   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 30.0f, 30.0f ) ) );
1313   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1314   data.Reset();
1315
1316   END_TEST;
1317 }
1318
1319 int UtcDaliTouchActorUnstaged(void)
1320 {
1321   TestApplication application;
1322
1323   Actor actor = Actor::New();
1324   actor.SetSize(100.0f, 100.0f);
1325   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1326   Stage::GetCurrent().Add(actor);
1327
1328   // Render and notify
1329   application.SendNotification();
1330   application.Render();
1331
1332   // Connect to actor's touched signal
1333   SignalData data;
1334   TouchEventFunctor functor( data );
1335   actor.TouchedSignal().Connect( &application, functor );
1336
1337   // Emit a down signal
1338   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1339   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1340   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
1341   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
1342   data.Reset();
1343
1344   // Render and notify
1345   application.SendNotification();
1346   application.Render();
1347
1348   // Unparent the actor
1349   actor.Unparent();
1350
1351   // Should receive an interrupted event
1352   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1353   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
1354   END_TEST;
1355 }
1356
1357 int UtcDaliTouchParentUnstaged(void)
1358 {
1359   TestApplication application;
1360
1361   Actor parent = Actor::New();
1362   parent.SetSize(100.0f, 100.0f);
1363   parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1364   Stage::GetCurrent().Add(parent);
1365
1366   Actor actor = Actor::New();
1367   actor.SetSize(100.0f, 100.0f);
1368   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1369   parent.Add(actor);
1370
1371   // Render and notify
1372   application.SendNotification();
1373   application.Render();
1374
1375   // Connect to actor's touched signal
1376   SignalData data;
1377   TouchEventFunctor functor( data );
1378   actor.TouchedSignal().Connect( &application, functor );
1379
1380   // Emit a down signal
1381   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1382   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1383   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
1384   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
1385   data.Reset();
1386
1387   // Render and notify
1388   application.SendNotification();
1389   application.Render();
1390
1391   // Unparent the parent of the touchable actor
1392   parent.Unparent();
1393
1394   // Should receive an interrupted event
1395   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1396   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
1397   END_TEST;
1398 }
1399
1400 int UtcDaliTouchActorUnstagedDifferentConsumer(void)
1401 {
1402   TestApplication application;
1403
1404   Actor parent = Actor::New();
1405   parent.SetSize(100.0f, 100.0f);
1406   parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1407   Stage::GetCurrent().Add(parent);
1408
1409   Actor actor = Actor::New();
1410   actor.SetSize(100.0f, 100.0f);
1411   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1412   parent.Add(actor);
1413
1414   // Render and notify
1415   application.SendNotification();
1416   application.Render();
1417
1418   // Connect to actor's touched signal
1419   SignalData data;
1420   TouchEventFunctor functor( data, false /* Do not consume */ );
1421   actor.TouchedSignal().Connect( &application, functor );
1422
1423   // Connect to parent's touched signal
1424   SignalData parentData;
1425   TouchEventFunctor parentFunctor( parentData );
1426   parent.TouchedSignal().Connect( &application, parentFunctor );
1427
1428   // Emit a down signal
1429   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1430   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1431   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
1432   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
1433   DALI_TEST_CHECK( actor == data.touchedActor );
1434   DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
1435   DALI_TEST_EQUALS( TouchPoint::Down, parentData.touchEvent.points[0].state, TEST_LOCATION );
1436   DALI_TEST_CHECK( actor == parentData.touchEvent.points[0].hitActor );
1437   DALI_TEST_CHECK( parent == parentData.touchedActor );
1438   data.Reset();
1439   parentData.Reset();
1440
1441   // Render and notify
1442   application.SendNotification();
1443   application.Render();
1444
1445   // Unparent the actor
1446   actor.Unparent();
1447
1448   // Should receive an interrupted event for both actor & parent
1449   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1450   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
1451   DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
1452   DALI_TEST_EQUALS( TouchPoint::Interrupted, parentData.touchEvent.points[0].state, TEST_LOCATION );
1453   data.Reset();
1454   parentData.Reset();
1455
1456   // Readd actor to parent
1457   parent.Add(actor);
1458
1459   // Render and notify
1460   application.SendNotification();
1461   application.Render();
1462
1463   // Emit a motion signal
1464   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Motion, Vector2( 10.0f, 10.0f ) ) );
1465   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1466   DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
1467   data.Reset();
1468   parentData.Reset();
1469
1470   // Parent is now consumer, connect again to the touched signal of the actor so that it becomes the consumer
1471   SignalData secondData;
1472   TouchEventFunctor secondFunctor( secondData /* Consume */ );
1473   actor.TouchedSignal().Connect( &application, secondFunctor );
1474
1475   // Unparent the actor
1476   actor.Unparent();
1477
1478   // Should receive an interrupted event for both actor functors & the parent as well as it was last consumer
1479   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1480   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
1481   DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
1482   DALI_TEST_EQUALS( TouchPoint::Interrupted, parentData.touchEvent.points[0].state, TEST_LOCATION );
1483   DALI_TEST_EQUALS( true, secondData.functorCalled, TEST_LOCATION );
1484   DALI_TEST_EQUALS( TouchPoint::Interrupted, secondData.touchEvent.points[0].state, TEST_LOCATION );
1485   data.Reset();
1486   parentData.Reset();
1487   secondData.Reset();
1488
1489   END_TEST;
1490 }
1491
1492 int UtcDaliTouchInterruptedDifferentConsumer(void)
1493 {
1494   TestApplication application;
1495   Actor rootActor( Stage::GetCurrent().GetRootLayer() );
1496
1497   Actor parent = Actor::New();
1498   parent.SetSize(100.0f, 100.0f);
1499   parent.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1500   Stage::GetCurrent().Add(parent);
1501
1502   Actor actor = Actor::New();
1503   actor.SetSize(100.0f, 100.0f);
1504   actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
1505   parent.Add(actor);
1506
1507   // Render and notify
1508   application.SendNotification();
1509   application.Render();
1510
1511   // Connect to actor's touched signal
1512   SignalData data;
1513   TouchEventFunctor functor( data, false /* Do not consume */ );
1514   actor.TouchedSignal().Connect( &application, functor );
1515
1516   // Connect to parent's touched signal
1517   SignalData parentData;
1518   TouchEventFunctor parentFunctor( parentData, false /* Do not consume */ );
1519   parent.TouchedSignal().Connect( &application, parentFunctor );
1520
1521   // Connect to root's touched signal and consume
1522   SignalData rootData;
1523   TouchEventFunctor rootFunctor( rootData );
1524   rootActor.TouchedSignal().Connect( &application, rootFunctor );
1525
1526   // Emit a down signal
1527   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Down, Vector2( 10.0f, 10.0f ) ) );
1528   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1529   DALI_TEST_EQUALS( TouchPoint::Down, data.touchEvent.points[0].state, TEST_LOCATION );
1530   DALI_TEST_CHECK( actor == data.touchEvent.points[0].hitActor );
1531   DALI_TEST_CHECK( actor == data.touchedActor );
1532   DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
1533   DALI_TEST_EQUALS( TouchPoint::Down, parentData.touchEvent.points[0].state, TEST_LOCATION );
1534   DALI_TEST_CHECK( actor == parentData.touchEvent.points[0].hitActor );
1535   DALI_TEST_CHECK( parent == parentData.touchedActor );
1536   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
1537   DALI_TEST_EQUALS( TouchPoint::Down, rootData.touchEvent.points[0].state, TEST_LOCATION );
1538   DALI_TEST_CHECK( actor == rootData.touchEvent.points[0].hitActor );
1539   DALI_TEST_CHECK( rootActor == rootData.touchedActor );
1540   data.Reset();
1541   parentData.Reset();
1542   rootData.Reset();
1543
1544   // Root is now consumer, connect to the touched signal of the parent so that it becomes the consumer
1545   SignalData secondData;
1546   TouchEventFunctor secondFunctor( secondData /* Consume */ );
1547   parent.TouchedSignal().Connect( &application, secondFunctor );
1548
1549   // Emit an interrupted signal, all three should STILL be called
1550   application.ProcessEvent( GenerateSingleTouch( TouchPoint::Interrupted, Vector2( 10.0f, 10.0f ) ) );
1551   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
1552   DALI_TEST_EQUALS( TouchPoint::Interrupted, data.touchEvent.points[0].state, TEST_LOCATION );
1553   DALI_TEST_EQUALS( true, parentData.functorCalled, TEST_LOCATION );
1554   DALI_TEST_EQUALS( TouchPoint::Interrupted, parentData.touchEvent.points[0].state, TEST_LOCATION );
1555   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
1556   DALI_TEST_EQUALS( TouchPoint::Interrupted, rootData.touchEvent.points[0].state, TEST_LOCATION );
1557   data.Reset();
1558   parentData.Reset();
1559   rootData.Reset();
1560
1561   END_TEST;
1562 }