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