2 * Copyright (c) 2019 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.
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/internal/event/events/pinch-gesture-event.h>
26 #include <dali-test-suite-utils.h>
27 #include <test-touch-utils.h>
31 ///////////////////////////////////////////////////////////////////////////////
38 : functorCalled(false),
39 voidFunctorCalled(false),
40 receivedGesture(Gesture::Started)
45 functorCalled = false;
46 voidFunctorCalled = false;
48 receivedGesture.state = Gesture::Started;
54 bool voidFunctorCalled;
55 PinchGesture receivedGesture;
59 // Functor that sets the data when called
60 struct GestureReceivedFunctor
62 GestureReceivedFunctor(SignalData& data) : signalData(data) { }
64 void operator()(Actor actor, const PinchGesture& pinch)
66 signalData.functorCalled = true;
67 signalData.receivedGesture = pinch;
68 signalData.pinchedActor = actor;
73 signalData.voidFunctorCalled = true;
76 SignalData& signalData;
80 Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
82 Integration::TouchEvent touchEvent;
83 Integration::Point point;
84 point.SetState( state );
85 point.SetScreenPosition( screenPosition );
86 point.SetDeviceClass( Device::Class::TOUCH );
87 point.SetDeviceSubclass( Device::Subclass::NONE );
88 touchEvent.points.push_back( point );
89 touchEvent.time = time;
93 Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
95 Integration::TouchEvent touchEvent;
96 Integration::Point point;
97 point.SetState( stateA );
98 point.SetScreenPosition( screenPositionA );
99 point.SetDeviceClass( Device::Class::TOUCH );
100 point.SetDeviceSubclass( Device::Subclass::NONE );
101 touchEvent.points.push_back( point );
102 point.SetScreenPosition( screenPositionB );
103 point.SetState( stateB);
104 touchEvent.points.push_back( point );
105 touchEvent.time = time;
112 ///////////////////////////////////////////////////////////////////////////////
115 int UtcDaliPinchGestureRecognizerBasicNoAction(void)
117 TestApplication application;
119 PinchGestureDetector detector = PinchGestureDetector::New();
121 Actor actor = Actor::New();
122 actor.SetSize(100.0f, 100.0f);
123 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
124 Stage::GetCurrent().Add(actor);
127 application.SendNotification();
128 application.Render();
130 detector.Attach(actor);
133 GestureReceivedFunctor functor(data);
134 detector.DetectedSignal().Connect(&application, functor);
136 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
138 application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 200 ) );
140 application.SendNotification();
142 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
147 int UtcDaliPinchGestureRecognizerBasic(void)
149 TestApplication application;
151 PinchGestureDetector detector = PinchGestureDetector::New();
153 Actor actor = Actor::New();
154 actor.SetSize(100.0f, 100.0f);
155 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
156 Stage::GetCurrent().Add(actor);
159 application.SendNotification();
160 application.Render();
162 detector.Attach(actor);
165 GestureReceivedFunctor functor(data);
166 detector.DetectedSignal().Connect(&application, functor);
168 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
169 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
170 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
171 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
172 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
174 application.SendNotification();
176 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
181 int UtcDaliPinchGestureRecognizerEndEarly01(void)
183 TestApplication application;
185 PinchGestureDetector detector = PinchGestureDetector::New();
187 Actor actor = Actor::New();
188 actor.SetSize(100.0f, 100.0f);
189 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
190 Stage::GetCurrent().Add(actor);
193 application.SendNotification();
194 application.Render();
196 detector.Attach(actor);
199 GestureReceivedFunctor functor(data);
200 detector.DetectedSignal().Connect(&application, functor);
202 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
203 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
204 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 29.0f ), 165 ) );
205 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
206 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
207 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
209 application.SendNotification();
211 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
216 int UtcDaliPinchGestureRecognizerEndEarly02(void)
218 TestApplication application;
220 PinchGestureDetector detector = PinchGestureDetector::New();
222 Actor actor = Actor::New();
223 actor.SetSize(100.0f, 100.0f);
224 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
225 Stage::GetCurrent().Add(actor);
228 application.SendNotification();
229 application.Render();
231 detector.Attach(actor);
234 GestureReceivedFunctor functor(data);
235 detector.DetectedSignal().Connect(&application, functor);
237 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
238 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
239 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 170 ) );
240 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::UP, Vector2( 20.0f, 74.0f ), 173 ) );
241 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::DOWN, Vector2( 20.0f, 74.0f ), 178 ) );
242 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 180 ) );
243 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 190 ) );
245 application.SendNotification();
247 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
252 int UtcDaliPinchGestureRecognizerRealistic01(void)
254 TestApplication application;
256 PinchGestureDetector detector = PinchGestureDetector::New();
258 Actor actor = Actor::New();
259 actor.SetSize(100.0f, 100.0f);
260 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
261 Stage::GetCurrent().Add(actor);
264 application.SendNotification();
265 application.Render();
267 detector.Attach(actor);
270 GestureReceivedFunctor functor(data);
271 detector.DetectedSignal().Connect(&application, functor);
273 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
274 application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
275 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
276 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
277 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
278 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
279 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
280 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
281 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
282 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
283 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 56.0f ), PointState::UP, Vector2( 20.0f, 60.0f ), 150 ) );
284 application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
286 application.SendNotification();
288 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
293 int UtcDaliPinchGestureRecognizerRealistic02(void)
295 TestApplication application;
297 PinchGestureDetector detector = PinchGestureDetector::New();
299 Actor actor = Actor::New();
300 actor.SetSize(100.0f, 100.0f);
301 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
302 Stage::GetCurrent().Add(actor);
305 application.SendNotification();
306 application.Render();
308 detector.Attach(actor);
311 GestureReceivedFunctor functor(data);
312 detector.DetectedSignal().Connect(&application, functor);
314 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
315 application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
316 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
317 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
318 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
319 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
320 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
321 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
322 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
323 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
324 application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
326 application.SendNotification();
328 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
333 int UtcDaliPinchGestureRecognizerRealistic03(void)
335 TestApplication application;
337 PinchGestureDetector detector = PinchGestureDetector::New();
339 Actor actor = Actor::New();
340 actor.SetSize(100.0f, 100.0f);
341 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
342 Stage::GetCurrent().Add(actor);
345 application.SendNotification();
346 application.Render();
348 detector.Attach(actor);
351 GestureReceivedFunctor functor(data);
352 detector.DetectedSignal().Connect(&application, functor);
354 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
355 application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
356 application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
357 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
358 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
359 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
360 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 77.0f ), 127 ) );
361 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
362 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 47.0f ), PointState::MOTION, Vector2( 20.0f, 73.0f ), 133 ) );
363 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
364 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 47.0f ), PointState::MOTION, Vector2( 20.0f, 67.0f ), 137 ) );
365 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
366 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 53.0f ), PointState::MOTION, Vector2( 20.0f, 63.0f ), 143 ) );
367 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
369 application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
371 application.SendNotification();
373 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
378 int UtcDaliPinchGestureRecognizerMultipleDetectors(void)
380 TestApplication application;
382 Actor actor = Actor::New();
383 actor.SetSize(100.0f, 100.0f);
384 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
385 Stage::GetCurrent().Add(actor);
387 Actor actor2 = Actor::New();
388 actor2.SetSize(100.0f, 100.0f);
389 actor2.SetAnchorPoint(AnchorPoint::TOP_LEFT);
391 Stage::GetCurrent().Add(actor2);
394 application.SendNotification();
395 application.Render();
397 PinchGestureDetector detector = PinchGestureDetector::New();
398 detector.Attach(actor);
400 PinchGestureDetector detector2 = PinchGestureDetector::New();
401 detector2.Attach(actor2);
404 GestureReceivedFunctor functor(data);
405 detector.DetectedSignal().Connect(&application, functor);
408 GestureReceivedFunctor functor2(data2);
409 detector2.DetectedSignal().Connect(&application, functor2);
411 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 120.0f, 20.0f ), PointState::DOWN, Vector2( 120.0f, 90.0f ), 150 ) );
412 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 28.0f ), PointState::MOTION, Vector2( 120.0f, 82.0f ), 160 ) );
413 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 37.0f ), PointState::MOTION, Vector2( 120.0f, 74.0f ), 170 ) );
414 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 46.0f ), PointState::MOTION, Vector2( 120.0f, 66.0f ), 180 ) );
415 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 120.0f, 55.0f ), PointState::MOTION, Vector2( 120.0f, 58.0f ), 190 ) );
416 application.ProcessEvent( GenerateDoubleTouch( PointState::UP, Vector2( 120.0f, 55.0f ), PointState::UP, Vector2( 120.0f, 58.0f ), 200 ) );
418 application.SendNotification();
420 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
421 DALI_TEST_EQUALS(true, data2.functorCalled, TEST_LOCATION);
422 DALI_TEST_EQUALS(true, actor2 == data2.pinchedActor, TEST_LOCATION);
425 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 250 ) );
426 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 260 ) );
427 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 37.0f ), PointState::MOTION, Vector2( 20.0f, 74.0f ), 270 ) );
428 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 46.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 280 ) );
429 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 58.0f ), 290 ) );
431 application.SendNotification();
433 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
434 DALI_TEST_EQUALS(true, actor == data.pinchedActor, TEST_LOCATION);
435 DALI_TEST_EQUALS(false, data2.functorCalled, TEST_LOCATION);
441 int UtcDaliPinchGestureRecognizerShortDistance01(void)
443 TestApplication application;
445 Integration::SetPinchGestureMinimumDistance(7.0f);
447 PinchGestureDetector detector = PinchGestureDetector::New();
449 Actor actor = Actor::New();
450 actor.SetSize(100.0f, 100.0f);
451 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
452 Stage::GetCurrent().Add(actor);
455 application.SendNotification();
456 application.Render();
458 detector.Attach(actor);
461 GestureReceivedFunctor functor(data);
462 detector.DetectedSignal().Connect(&application, functor);
464 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
465 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
466 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 170 ) );
467 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 32.0f ), PointState::MOTION, Vector2( 20.0f, 78.0f ), 180 ) );
468 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 34.0f ), PointState::MOTION, Vector2( 20.0f, 76.0f ), 190 ) );
470 application.SendNotification();
472 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
477 int UtcDaliPinchGestureRecognizerShortDistance02(void)
479 TestApplication application;
481 PinchGestureDetector detector = PinchGestureDetector::New();
483 Actor actor = Actor::New();
484 actor.SetSize(100.0f, 100.0f);
485 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
486 Stage::GetCurrent().Add(actor);
489 application.SendNotification();
490 application.Render();
492 detector.Attach(actor);
495 GestureReceivedFunctor functor(data);
496 detector.DetectedSignal().Connect(&application, functor);
498 Integration::SetPinchGestureMinimumDistance(7.0f);
500 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
501 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 28.0f ), PointState::MOTION, Vector2( 20.0f, 82.0f ), 160 ) );
502 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 170 ) );
503 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 32.0f ), PointState::MOTION, Vector2( 20.0f, 78.0f ), 180 ) );
504 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 34.0f ), PointState::MOTION, Vector2( 20.0f, 76.0f ), 190 ) );
506 application.SendNotification();
508 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
513 int UtcDaliPinchGestureRecognizerLongDistance01(void)
515 TestApplication application;
517 Integration::SetPinchGestureMinimumDistance(14.0f);
519 PinchGestureDetector detector = PinchGestureDetector::New();
521 Actor actor = Actor::New();
522 actor.SetSize(100.0f, 100.0f);
523 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
524 Stage::GetCurrent().Add(actor);
527 application.SendNotification();
528 application.Render();
530 detector.Attach(actor);
533 GestureReceivedFunctor functor(data);
534 detector.DetectedSignal().Connect(&application, functor);
536 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
537 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 22.0f ), PointState::MOTION, Vector2( 20.0f, 88.0f ), 160 ) );
538 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 24.0f ), PointState::MOTION, Vector2( 20.0f, 86.0f ), 170 ) );
539 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 26.0f ), PointState::MOTION, Vector2( 20.0f, 84.0f ), 180 ) );
541 application.SendNotification();
543 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
548 int UtcDaliPinchGestureRecognizerLongDistance02(void)
550 TestApplication application;
552 Integration::SetPinchGestureMinimumDistance(14.0f);
554 PinchGestureDetector detector = PinchGestureDetector::New();
556 Actor actor = Actor::New();
557 actor.SetSize(100.0f, 100.0f);
558 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
559 Stage::GetCurrent().Add(actor);
562 application.SendNotification();
563 application.Render();
565 detector.Attach(actor);
568 GestureReceivedFunctor functor(data);
569 detector.DetectedSignal().Connect(&application, functor);
571 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
572 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 38.0f ), PointState::MOTION, Vector2( 20.0f, 72.0f ), 160 ) );
573 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 170 ) );
574 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 42.0f ), PointState::MOTION, Vector2( 20.0f, 68.0f ), 180 ) );
575 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 44.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 190 ) );
577 application.SendNotification();
579 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
584 int UtcDaliPinchGestureRecognizerLongDistance03(void)
586 TestApplication application;
588 PinchGestureDetector detector = PinchGestureDetector::New();
590 Actor actor = Actor::New();
591 actor.SetSize(100.0f, 100.0f);
592 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
593 Stage::GetCurrent().Add(actor);
596 application.SendNotification();
597 application.Render();
599 detector.Attach(actor);
602 GestureReceivedFunctor functor(data);
603 detector.DetectedSignal().Connect(&application, functor);
605 Integration::SetPinchGestureMinimumDistance(14.0f);
607 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
608 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 22.0f ), PointState::MOTION, Vector2( 20.0f, 88.0f ), 160 ) );
609 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 24.0f ), PointState::MOTION, Vector2( 20.0f, 86.0f ), 170 ) );
610 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 26.0f ), PointState::MOTION, Vector2( 20.0f, 84.0f ), 180 ) );
612 application.SendNotification();
614 DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
619 int UtcDaliPinchGestureRecognizerLongDistance04(void)
621 TestApplication application;
623 PinchGestureDetector detector = PinchGestureDetector::New();
625 Actor actor = Actor::New();
626 actor.SetSize(100.0f, 100.0f);
627 actor.SetAnchorPoint(AnchorPoint::TOP_LEFT);
628 Stage::GetCurrent().Add(actor);
631 application.SendNotification();
632 application.Render();
634 detector.Attach(actor);
637 GestureReceivedFunctor functor(data);
638 detector.DetectedSignal().Connect(&application, functor);
640 Integration::SetPinchGestureMinimumDistance(14.0f);
642 application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
643 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 38.0f ), PointState::MOTION, Vector2( 20.0f, 72.0f ), 160 ) );
644 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 170 ) );
645 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 42.0f ), PointState::MOTION, Vector2( 20.0f, 68.0f ), 180 ) );
646 application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 44.0f ), PointState::MOTION, Vector2( 20.0f, 66.0f ), 190 ) );
648 application.SendNotification();
650 DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);