Moved Gesture::State and -::Type to gesture-enumerations.h.
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-PanGestureRecognizer.cpp
1 /*
2  * Copyright (c) 2020 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/input-options.h>
23 #include <dali/integration-api/events/touch-event-integ.h>
24 #include <dali/integration-api/render-task-list-integ.h>
25 #include <dali-test-suite-utils.h>
26
27 using namespace Dali;
28
29 ///////////////////////////////////////////////////////////////////////////////
30 namespace
31 {
32
33 struct SignalData
34 {
35   SignalData()
36   : functorCalled(false),
37     voidFunctorCalled(false),
38     receivedGesture()
39   {}
40
41   void Reset()
42   {
43     functorCalled = false;
44     voidFunctorCalled = false;
45
46     receivedGesture.Reset();
47
48     pannedActor.Reset();
49   }
50
51   bool functorCalled;
52   bool voidFunctorCalled;
53   PanGesture receivedGesture;
54   Actor pannedActor;
55 };
56
57 // Functor that sets the data when called
58 struct GestureReceivedFunctor
59 {
60   GestureReceivedFunctor(SignalData& data) : signalData(data) { }
61
62   void operator()(Actor actor, const PanGesture& pan)
63   {
64     signalData.functorCalled = true;
65     signalData.receivedGesture = pan;
66     signalData.pannedActor = actor;
67   }
68
69   void operator()()
70   {
71     signalData.voidFunctorCalled = true;
72   }
73
74   SignalData& signalData;
75 };
76
77
78 Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
79 {
80   Integration::TouchEvent touchEvent;
81   Integration::Point point;
82   point.SetState( state );
83   point.SetScreenPosition( screenPosition );
84   point.SetDeviceClass( Device::Class::TOUCH );
85   point.SetDeviceSubclass( Device::Subclass::NONE );
86   touchEvent.points.push_back( point );
87   touchEvent.time = time;
88   return touchEvent;
89 }
90
91 Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
92 {
93   Integration::TouchEvent touchEvent;
94   Integration::Point point;
95   point.SetState( stateA );
96   point.SetScreenPosition( screenPositionA );
97   point.SetDeviceClass( Device::Class::TOUCH );
98   point.SetDeviceSubclass( Device::Subclass::NONE );
99   touchEvent.points.push_back( point );
100   point.SetScreenPosition( screenPositionB );
101   point.SetState( stateB);
102   touchEvent.points.push_back( point );
103   touchEvent.time = time;
104   return touchEvent;
105 }
106
107
108 } // anon namespace
109
110 ///////////////////////////////////////////////////////////////////////////////
111
112
113 int UtcDaliPanGestureRecognizerBasicNoAction(void)
114 {
115   TestApplication application;
116
117   PanGestureDetector detector = PanGestureDetector::New();
118
119   Actor actor = Actor::New();
120   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
121   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
122   application.GetScene().Add(actor);
123
124   // Render and notify
125   application.SendNotification();
126   application.Render();
127
128   detector.Attach(actor);
129
130   SignalData data;
131   GestureReceivedFunctor functor(data);
132   detector.DetectedSignal().Connect(&application, functor);
133
134   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
135
136   application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
137
138   application.SendNotification();
139
140   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
141
142   END_TEST;
143 }
144
145 int UtcDaliPanGestureRecognizerBasic(void)
146 {
147   TestApplication application;
148
149   PanGestureDetector detector = PanGestureDetector::New();
150
151   Actor actor = Actor::New();
152   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
153   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
154   application.GetScene().Add(actor);
155
156   // Render and notify
157   application.SendNotification();
158   application.Render();
159
160   detector.Attach(actor);
161
162   SignalData data;
163   GestureReceivedFunctor functor(data);
164   detector.DetectedSignal().Connect(&application, functor);
165
166   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
167   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
168   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) );
169
170   application.SendNotification();
171
172   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
173
174   END_TEST;
175 }
176
177 int UtcDaliPanGestureRecognizerBasicInterrupted(void)
178 {
179   TestApplication application;
180
181   PanGestureDetector detector = PanGestureDetector::New();
182
183   Actor actor = Actor::New();
184   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
185   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
186   application.GetScene().Add(actor);
187
188   // Render and notify
189   application.SendNotification();
190   application.Render();
191
192   detector.Attach(actor);
193
194   SignalData data;
195   GestureReceivedFunctor functor(data);
196   detector.DetectedSignal().Connect(&application, functor);
197
198   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
199   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), 151 ) );
200   application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 30.0f ), 152 ) );
201
202   application.SendNotification();
203
204   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
205
206   END_TEST;
207 }
208
209 int UtcDaliPanGestureRecognizerBasicShortest(void)
210 {
211   TestApplication application;
212
213   PanGestureDetector detector = PanGestureDetector::New();
214
215   Actor actor = Actor::New();
216   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
217   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
218   application.GetScene().Add(actor);
219
220   // Render and notify
221   application.SendNotification();
222   application.Render();
223
224   detector.Attach(actor);
225
226   SignalData data;
227   GestureReceivedFunctor functor(data);
228   detector.DetectedSignal().Connect(&application, functor);
229
230   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
231   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
232   application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 40.0f ), 155 ) );
233
234   application.SendNotification();
235
236   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
237
238   END_TEST;
239 }
240
241 int UtcDaliPanGestureRecognizerBasicFailToStart(void)
242 {
243   TestApplication application;
244
245   PanGestureDetector detector = PanGestureDetector::New();
246
247   Actor actor = Actor::New();
248   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
249   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
250   application.GetScene().Add(actor);
251
252   // Render and notify
253   application.SendNotification();
254   application.Render();
255
256   detector.Attach(actor);
257
258   SignalData data;
259   GestureReceivedFunctor functor(data);
260   detector.DetectedSignal().Connect(&application, functor);
261
262   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
263   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
264   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 40.0f, 40.0f ), 153 ) );
265
266   application.SendNotification();
267
268   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
269
270   END_TEST;
271 }
272
273 int UtcDaliPanGestureRecognizerBasicStationary(void)
274 {
275   TestApplication application;
276
277   PanGestureDetector detector = PanGestureDetector::New();
278
279   Actor actor = Actor::New();
280   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
281   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
282   application.GetScene().Add(actor);
283
284   // Render and notify
285   application.SendNotification();
286   application.Render();
287
288   detector.Attach(actor);
289
290   SignalData data;
291   GestureReceivedFunctor functor(data);
292   detector.DetectedSignal().Connect(&application, functor);
293
294   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
295   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
296   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), 152 ) );
297   application.ProcessEvent( GenerateSingleTouch( PointState::STATIONARY, Vector2( 20.0f, 50.0f ), 153 ) );
298   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), 154 ) );
299
300   application.SendNotification();
301
302   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
303
304   END_TEST;
305 }
306
307 int UtcDaliPanGestureRecognizerNewParametersFail(void)
308 {
309   TestApplication application;
310
311   PanGestureDetector detector = PanGestureDetector::New();
312
313   detector.SetMaximumTouchesRequired(2);
314   detector.SetMinimumTouchesRequired(2);
315
316   Actor actor = Actor::New();
317   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
318   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
319   application.GetScene().Add(actor);
320
321   // Render and notify
322   application.SendNotification();
323   application.Render();
324
325   detector.Attach(actor);
326
327   SignalData data;
328   GestureReceivedFunctor functor(data);
329   detector.DetectedSignal().Connect(&application, functor);
330
331   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
332   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
333   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) );
334
335   application.SendNotification();
336
337   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
338
339   END_TEST;
340 }
341
342 int UtcDaliPanGestureRecognizerNewParametersSuccess(void)
343 {
344   TestApplication application;
345
346   PanGestureDetector detector = PanGestureDetector::New();
347
348   detector.SetMaximumTouchesRequired(2);
349   detector.SetMinimumTouchesRequired(2);
350
351   Actor actor = Actor::New();
352   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
353   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
354   application.GetScene().Add(actor);
355
356   // Render and notify
357   application.SendNotification();
358   application.Render();
359
360   detector.Attach(actor);
361
362   SignalData data;
363   GestureReceivedFunctor functor(data);
364   detector.DetectedSignal().Connect(&application, functor);
365
366   application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
367   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
368   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
369
370   application.SendNotification();
371
372   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
373
374   END_TEST;
375 }
376
377 int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches01(void)
378 {
379   TestApplication application;
380
381   PanGestureDetector detector = PanGestureDetector::New();
382
383   detector.SetMaximumTouchesRequired(2);
384   detector.SetMinimumTouchesRequired(2);
385
386   Actor actor = Actor::New();
387   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
388   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
389   application.GetScene().Add(actor);
390
391   // Render and notify
392   application.SendNotification();
393   application.Render();
394
395   detector.Attach(actor);
396
397   SignalData data;
398   GestureReceivedFunctor functor(data);
399   detector.DetectedSignal().Connect(&application, functor);
400
401   application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
402   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
403   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
404   application.ProcessEvent( GenerateSingleTouch( PointState::STATIONARY, Vector2( 50.0f, 50.0f ), 153 ) );
405
406   application.SendNotification();
407
408   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
409
410   END_TEST;
411 }
412
413 int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches02(void)
414 {
415   TestApplication application;
416
417   PanGestureDetector detector = PanGestureDetector::New();
418
419   detector.SetMaximumTouchesRequired(2);
420   detector.SetMinimumTouchesRequired(2);
421
422   Actor actor = Actor::New();
423   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
424   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
425   application.GetScene().Add(actor);
426
427   // Render and notify
428   application.SendNotification();
429   application.Render();
430
431   detector.Attach(actor);
432
433   SignalData data;
434   GestureReceivedFunctor functor(data);
435   detector.DetectedSignal().Connect(&application, functor);
436
437   application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
438   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
439   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
440   application.ProcessEvent( GenerateDoubleTouch( PointState::STATIONARY, Vector2( 50.0f, 50.0f ), PointState::UP, Vector2( 50.0f, 40.0f ), 153 ) );
441
442   application.SendNotification();
443
444   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
445
446   END_TEST;
447 }
448
449 int UtcDaliPanGestureRecognizerNewParametersNoStart(void)
450 {
451   TestApplication application;
452
453   PanGestureDetector detector = PanGestureDetector::New();
454
455   detector.SetMaximumTouchesRequired(2);
456   detector.SetMinimumTouchesRequired(2);
457
458   Actor actor = Actor::New();
459   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
460   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
461   application.GetScene().Add(actor);
462
463   // Render and notify
464   application.SendNotification();
465   application.Render();
466
467   detector.Attach(actor);
468
469   SignalData data;
470   GestureReceivedFunctor functor(data);
471   detector.DetectedSignal().Connect(&application, functor);
472
473   application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
474   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
475   application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 50.0f, 50.0f ), 153 ) );
476
477   application.SendNotification();
478
479   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
480
481   END_TEST;
482 }
483
484 int UtcDaliPanGestureRecognizerNewParametersSlowRelease(void)
485 {
486   TestApplication application;
487
488   PanGestureDetector detector = PanGestureDetector::New();
489
490   detector.SetMaximumTouchesRequired(2);
491   detector.SetMinimumTouchesRequired(2);
492
493   Actor actor = Actor::New();
494   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
495   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
496   application.GetScene().Add(actor);
497
498   // Render and notify
499   application.SendNotification();
500   application.Render();
501
502   detector.Attach(actor);
503
504   SignalData data;
505   GestureReceivedFunctor functor(data);
506   detector.DetectedSignal().Connect(&application, functor);
507
508   application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 50.0f ), PointState::DOWN, Vector2( 20.0f, 40.0f ), 150 ) );
509   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 40.0f, 50.0f ), PointState::MOTION, Vector2( 40.0f, 40.0f ), 151 ) );
510   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 50.0f, 50.0f ), PointState::MOTION, Vector2( 50.0f, 40.0f ), 152 ) );
511   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 60.0f, 50.0f ), PointState::MOTION, Vector2( 60.0f, 40.0f ), 153 ) );
512   application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 70.0f, 50.0f ), PointState::MOTION, Vector2( 70.0f, 40.0f ), 154 ) );
513   application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 70.0f, 50.0f ), 155 ) );
514
515   application.SendNotification();
516
517   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
518
519   END_TEST;
520 }
521
522 int UtcDaliPanGestureRecognizerOtherEvent(void)
523 {
524   TestApplication application;
525
526   PanGestureDetector detector = PanGestureDetector::New();
527
528   Actor actor = Actor::New();
529   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
530   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
531   application.GetScene().Add(actor);
532
533   // Render and notify
534   application.SendNotification();
535   application.Render();
536
537   detector.Attach(actor);
538
539   SignalData data;
540   GestureReceivedFunctor functor(data);
541   detector.DetectedSignal().Connect(&application, functor);
542
543   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
544   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
545   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) );
546   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 60.0f ), 153 ) );      // Exercise default case in STARTED case. Not sure if realistic
547   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 65.0f ), 154 ) );
548
549   application.SendNotification();
550
551   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
552
553   END_TEST;
554 }
555
556 int UtcDaliPanGestureRecognizerSlowMoving(void)
557 {
558   TestApplication application;
559
560   PanGestureDetector detector = PanGestureDetector::New();
561
562   Actor actor = Actor::New();
563   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
564   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
565   application.GetScene().Add(actor);
566
567   // Render and notify
568   application.SendNotification();
569   application.Render();
570
571   detector.Attach(actor);
572
573   SignalData data;
574   GestureReceivedFunctor functor(data);
575   detector.DetectedSignal().Connect(&application, functor);
576
577   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
578   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
579   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) );
580   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) );
581   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) );
582   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) );
583
584   application.SendNotification();
585
586   DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
587
588   END_TEST;
589 }
590
591 int UtcDaliPanGestureRecognizerNewParamsMinNum(void)
592 {
593   TestApplication application;
594
595   Integration::SetPanGestureMinimumPanEvents(8);
596
597
598   PanGestureDetector detector = PanGestureDetector::New();
599
600   Actor actor = Actor::New();
601   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
602   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
603   application.GetScene().Add(actor);
604
605   // Render and notify
606   application.SendNotification();
607   application.Render();
608
609   detector.Attach(actor);
610
611   SignalData data;
612   GestureReceivedFunctor functor(data);
613   detector.DetectedSignal().Connect(&application, functor);
614
615   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
616   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
617   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) );
618   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) );
619   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) );
620   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) );
621
622   application.SendNotification();
623
624   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
625
626   END_TEST;
627 }
628
629 int UtcDaliPanGestureRecognizerNewParamsMinDistance(void)
630 {
631   TestApplication application;
632
633   Integration::SetPanGestureMinimumDistance(100);
634
635   PanGestureDetector detector = PanGestureDetector::New();
636
637   Actor actor = Actor::New();
638   actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
639   actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
640   application.GetScene().Add(actor);
641
642   // Render and notify
643   application.SendNotification();
644   application.Render();
645
646   detector.Attach(actor);
647
648   SignalData data;
649   GestureReceivedFunctor functor(data);
650   detector.DetectedSignal().Connect(&application, functor);
651
652   application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
653   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 251 ) );
654   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 352 ) );
655   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 70.0f ), 453 ) );
656   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 80.0f ), 554 ) );
657   application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 90.0f ), 655 ) );
658
659   application.SendNotification();
660
661   DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
662
663   END_TEST;
664 }