2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-test-suite-utils.h>
19 #include <dali/integration-api/events/touch-event-integ.h>
20 #include <dali/integration-api/input-options.h>
21 #include <dali/integration-api/render-task-list-integ.h>
22 #include <dali/public-api/dali-core.h>
30 ///////////////////////////////////////////////////////////////////////////////
36 : functorCalled(false),
37 voidFunctorCalled(false),
44 functorCalled = false;
45 voidFunctorCalled = false;
47 receivedGesture.Reset();
53 bool voidFunctorCalled;
54 PanGesture receivedGesture;
58 // Functor that sets the data when called
59 struct GestureReceivedFunctor
61 GestureReceivedFunctor(SignalData& data)
66 void operator()(Actor actor, const PanGesture& pan)
68 signalData.functorCalled = true;
69 signalData.receivedGesture = pan;
70 signalData.pannedActor = actor;
75 signalData.voidFunctorCalled = true;
78 SignalData& signalData;
81 Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector2& screenPosition, uint32_t time)
83 Integration::TouchEvent touchEvent;
84 Integration::Point point;
85 point.SetState(state);
86 point.SetScreenPosition(screenPosition);
87 point.SetDeviceClass(Device::Class::TOUCH);
88 point.SetDeviceSubclass(Device::Subclass::NONE);
89 touchEvent.points.push_back(point);
90 touchEvent.time = time;
94 Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time)
96 Integration::TouchEvent touchEvent;
97 Integration::Point point;
98 point.SetState(stateA);
99 point.SetScreenPosition(screenPositionA);
100 point.SetDeviceClass(Device::Class::TOUCH);
101 point.SetDeviceSubclass(Device::Subclass::NONE);
102 touchEvent.points.push_back(point);
103 point.SetScreenPosition(screenPositionB);
104 point.SetState(stateB);
105 touchEvent.points.push_back(point);
106 touchEvent.time = time;
110 uint32_t GetMilliSeconds()
112 // Get the time of a monotonic clock since its epoch.
113 auto epoch = std::chrono::steady_clock::now().time_since_epoch();
115 auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(epoch);
117 return static_cast<uint32_t>(duration.count());
121 ///////////////////////////////////////////////////////////////////////////////
123 int UtcDaliPanGestureRecognizerBasicNoAction(void)
125 TestApplication application;
127 PanGestureDetector detector = PanGestureDetector::New();
129 Actor actor = Actor::New();
130 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
131 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
132 application.GetScene().Add(actor);
135 application.SendNotification();
136 application.Render();
138 detector.Attach(actor);
141 GestureReceivedFunctor functor(data);
142 detector.DetectedSignal().Connect(&application, functor);
144 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
146 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 20.0f), 200));
148 application.SendNotification();
150 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
155 int UtcDaliPanGestureRecognizerBasic(void)
157 TestApplication application;
159 PanGestureDetector detector = PanGestureDetector::New();
161 Actor actor = Actor::New();
162 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
163 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
164 application.GetScene().Add(actor);
167 application.SendNotification();
168 application.Render();
170 detector.Attach(actor);
173 GestureReceivedFunctor functor(data);
174 detector.DetectedSignal().Connect(&application, functor);
176 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
177 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
178 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152));
180 application.SendNotification();
182 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
187 int UtcDaliPanGestureRecognizerBasicInterrupted(void)
189 TestApplication application;
191 PanGestureDetector detector = PanGestureDetector::New();
193 Actor actor = Actor::New();
194 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
195 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
196 application.GetScene().Add(actor);
199 application.SendNotification();
200 application.Render();
202 detector.Attach(actor);
205 GestureReceivedFunctor functor(data);
206 detector.DetectedSignal().Connect(&application, functor);
208 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
209 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 25.0f), 151));
210 application.ProcessEvent(GenerateSingleTouch(PointState::INTERRUPTED, Vector2(20.0f, 30.0f), 152));
212 application.SendNotification();
214 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
219 int UtcDaliPanGestureRecognizerBasicShortest(void)
221 TestApplication application;
223 PanGestureDetector detector = PanGestureDetector::New();
225 Actor actor = Actor::New();
226 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
227 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
228 application.GetScene().Add(actor);
231 application.SendNotification();
232 application.Render();
234 detector.Attach(actor);
237 GestureReceivedFunctor functor(data);
238 detector.DetectedSignal().Connect(&application, functor);
240 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
241 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
242 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(20.0f, 40.0f), 155));
244 application.SendNotification();
246 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
251 int UtcDaliPanGestureRecognizerBasicFailToStart(void)
253 TestApplication application;
255 PanGestureDetector detector = PanGestureDetector::New();
257 Actor actor = Actor::New();
258 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
259 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
260 application.GetScene().Add(actor);
263 application.SendNotification();
264 application.Render();
266 detector.Attach(actor);
269 GestureReceivedFunctor functor(data);
270 detector.DetectedSignal().Connect(&application, functor);
272 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
273 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
274 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(40.0f, 40.0f), 153));
276 application.SendNotification();
278 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
283 int UtcDaliPanGestureRecognizerBasicStationary(void)
285 TestApplication application;
287 PanGestureDetector detector = PanGestureDetector::New();
289 Actor actor = Actor::New();
290 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
291 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
292 application.GetScene().Add(actor);
295 application.SendNotification();
296 application.Render();
298 detector.Attach(actor);
301 GestureReceivedFunctor functor(data);
302 detector.DetectedSignal().Connect(&application, functor);
304 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
305 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
306 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), 152));
307 application.ProcessEvent(GenerateSingleTouch(PointState::STATIONARY, Vector2(20.0f, 50.0f), 153));
308 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 55.0f), 154));
310 application.SendNotification();
312 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
317 int UtcDaliPanGestureRecognizerNewParametersFail(void)
319 TestApplication application;
321 PanGestureDetector detector = PanGestureDetector::New();
323 detector.SetMaximumTouchesRequired(2);
324 detector.SetMinimumTouchesRequired(2);
326 Actor actor = Actor::New();
327 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
328 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
329 application.GetScene().Add(actor);
332 application.SendNotification();
333 application.Render();
335 detector.Attach(actor);
338 GestureReceivedFunctor functor(data);
339 detector.DetectedSignal().Connect(&application, functor);
341 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
342 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
343 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152));
345 application.SendNotification();
347 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
352 int UtcDaliPanGestureRecognizerNewParametersSuccess(void)
354 TestApplication application;
356 PanGestureDetector detector = PanGestureDetector::New();
358 detector.SetMaximumTouchesRequired(2);
359 detector.SetMinimumTouchesRequired(2);
361 Actor actor = Actor::New();
362 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
363 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
364 application.GetScene().Add(actor);
367 application.SendNotification();
368 application.Render();
370 detector.Attach(actor);
373 GestureReceivedFunctor functor(data);
374 detector.DetectedSignal().Connect(&application, functor);
376 application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
377 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
378 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
380 application.SendNotification();
382 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
387 int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches01(void)
389 TestApplication application;
391 PanGestureDetector detector = PanGestureDetector::New();
393 detector.SetMaximumTouchesRequired(2);
394 detector.SetMinimumTouchesRequired(2);
396 Actor actor = Actor::New();
397 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
398 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
399 application.GetScene().Add(actor);
402 application.SendNotification();
403 application.Render();
405 detector.Attach(actor);
408 GestureReceivedFunctor functor(data);
409 detector.DetectedSignal().Connect(&application, functor);
411 application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
412 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
413 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
414 application.ProcessEvent(GenerateSingleTouch(PointState::STATIONARY, Vector2(50.0f, 50.0f), 153));
416 application.SendNotification();
418 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
423 int UtcDaliPanGestureRecognizerNewParametersEndFewerTouches02(void)
425 TestApplication application;
427 PanGestureDetector detector = PanGestureDetector::New();
429 detector.SetMaximumTouchesRequired(2);
430 detector.SetMinimumTouchesRequired(2);
432 Actor actor = Actor::New();
433 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
434 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
435 application.GetScene().Add(actor);
438 application.SendNotification();
439 application.Render();
441 detector.Attach(actor);
444 GestureReceivedFunctor functor(data);
445 detector.DetectedSignal().Connect(&application, functor);
447 application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
448 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
449 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
450 application.ProcessEvent(GenerateDoubleTouch(PointState::STATIONARY, Vector2(50.0f, 50.0f), PointState::UP, Vector2(50.0f, 40.0f), 153));
452 application.SendNotification();
454 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
459 int UtcDaliPanGestureRecognizerNewParametersNoStart(void)
461 TestApplication application;
463 PanGestureDetector detector = PanGestureDetector::New();
465 detector.SetMaximumTouchesRequired(2);
466 detector.SetMinimumTouchesRequired(2);
468 Actor actor = Actor::New();
469 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
470 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
471 application.GetScene().Add(actor);
474 application.SendNotification();
475 application.Render();
477 detector.Attach(actor);
480 GestureReceivedFunctor functor(data);
481 detector.DetectedSignal().Connect(&application, functor);
483 application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
484 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
485 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(50.0f, 50.0f), 153));
487 application.SendNotification();
489 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
494 int UtcDaliPanGestureRecognizerNewParametersSlowRelease(void)
496 TestApplication application;
498 PanGestureDetector detector = PanGestureDetector::New();
500 detector.SetMaximumTouchesRequired(2);
501 detector.SetMinimumTouchesRequired(2);
503 Actor actor = Actor::New();
504 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
505 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
506 application.GetScene().Add(actor);
509 application.SendNotification();
510 application.Render();
512 detector.Attach(actor);
515 GestureReceivedFunctor functor(data);
516 detector.DetectedSignal().Connect(&application, functor);
518 application.ProcessEvent(GenerateDoubleTouch(PointState::DOWN, Vector2(20.0f, 50.0f), PointState::DOWN, Vector2(20.0f, 40.0f), 150));
519 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(40.0f, 50.0f), PointState::MOTION, Vector2(40.0f, 40.0f), 151));
520 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(50.0f, 50.0f), PointState::MOTION, Vector2(50.0f, 40.0f), 152));
521 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(60.0f, 50.0f), PointState::MOTION, Vector2(60.0f, 40.0f), 153));
522 application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(70.0f, 50.0f), PointState::MOTION, Vector2(70.0f, 40.0f), 154));
523 application.ProcessEvent(GenerateSingleTouch(PointState::UP, Vector2(70.0f, 50.0f), 155));
525 application.SendNotification();
527 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
532 int UtcDaliPanGestureRecognizerNewParamsMaxMotionEventAge(void)
534 TestApplication application;
536 PanGestureDetector detector = PanGestureDetector::New();
538 detector.SetMaximumMotionEventAge(1000);
540 Actor actor = Actor::New();
541 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
542 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
543 application.GetScene().Add(actor);
546 application.SendNotification();
547 application.Render();
549 detector.Attach(actor);
552 GestureReceivedFunctor functor(data);
553 detector.DetectedSignal().Connect(&application, functor);
555 uint32_t currentTime = GetMilliSeconds();
556 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), currentTime));
557 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), currentTime));
558 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), currentTime));
559 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), currentTime));
560 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), currentTime));
561 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), currentTime));
563 application.SendNotification();
565 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
569 // Update current time
570 currentTime = GetMilliSeconds();
572 tet_infoline("Test fast enough motion\n");
573 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), currentTime - 100));
575 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
579 // Update current time
580 currentTime = GetMilliSeconds();
582 tet_infoline("Test super heavy motion\n");
583 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), currentTime - 10000));
584 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), currentTime - 9000));
585 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), currentTime - 8000));
586 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 50.0f), currentTime - 7000));
588 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
593 int UtcDaliPanGestureRecognizerOtherEvent(void)
595 TestApplication application;
597 PanGestureDetector detector = PanGestureDetector::New();
599 Actor actor = Actor::New();
600 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
601 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
602 application.GetScene().Add(actor);
605 application.SendNotification();
606 application.Render();
608 detector.Attach(actor);
611 GestureReceivedFunctor functor(data);
612 detector.DetectedSignal().Connect(&application, functor);
614 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
615 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 151));
616 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 152));
617 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 60.0f), 153)); // Exercise default case in STARTED case. Not sure if realistic
618 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 65.0f), 154));
620 application.SendNotification();
622 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
627 int UtcDaliPanGestureRecognizerSlowMoving(void)
629 TestApplication application;
631 PanGestureDetector detector = PanGestureDetector::New();
633 Actor actor = Actor::New();
634 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
635 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
636 application.GetScene().Add(actor);
639 application.SendNotification();
640 application.Render();
642 detector.Attach(actor);
645 GestureReceivedFunctor functor(data);
646 detector.DetectedSignal().Connect(&application, functor);
648 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
649 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
650 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352));
651 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453));
652 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554));
653 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655));
655 application.SendNotification();
657 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
662 int UtcDaliPanGestureRecognizerNewParamsMinNum(void)
664 TestApplication application;
666 Integration::SetPanGestureMinimumPanEvents(8);
668 PanGestureDetector detector = PanGestureDetector::New();
670 Actor actor = Actor::New();
671 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
672 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
673 application.GetScene().Add(actor);
676 application.SendNotification();
677 application.Render();
679 detector.Attach(actor);
682 GestureReceivedFunctor functor(data);
683 detector.DetectedSignal().Connect(&application, functor);
685 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
686 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
687 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352));
688 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453));
689 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554));
690 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655));
692 application.SendNotification();
694 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
699 int UtcDaliPanGestureRecognizerNewParamsMinDistance(void)
701 TestApplication application;
703 Integration::SetPanGestureMinimumDistance(100);
705 PanGestureDetector detector = PanGestureDetector::New();
707 Actor actor = Actor::New();
708 actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
709 actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
710 application.GetScene().Add(actor);
713 application.SendNotification();
714 application.Render();
716 detector.Attach(actor);
719 GestureReceivedFunctor functor(data);
720 detector.DetectedSignal().Connect(&application, functor);
722 application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(20.0f, 20.0f), 150));
723 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 40.0f), 251));
724 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 60.0f), 352));
725 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 70.0f), 453));
726 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 80.0f), 554));
727 application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(20.0f, 90.0f), 655));
729 application.SendNotification();
731 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);