2 * Copyright (c) 2014 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/events/touch-event-combiner.h>
23 #include <dali/integration-api/events/touch-event-integ.h>
24 #include <dali/integration-api/events/hover-event-integ.h>
25 #include <dali-test-suite-utils.h>
28 using namespace Dali::Integration;
30 void utc_dali_touch_event_combiner_startup(void)
32 test_return_value = TET_UNDEF;
35 void utc_dali_touch_event_combiner_cleanup(void)
37 test_return_value = TET_PASS;
41 int UtcDaliTouchEventCombinerConstructors(void)
43 TouchEventCombiner combiner1;
44 DALI_TEST_EQUALS( combiner1.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(1), TEST_LOCATION );
45 DALI_TEST_EQUALS( combiner1.GetMinimumMotionDistanceThreshold(), Vector2( 1.0f, 1.0f ), TEST_LOCATION );
47 TouchEventCombiner combiner2( 10, 20.0f, 31.0f );
48 DALI_TEST_EQUALS( combiner2.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
49 DALI_TEST_EQUALS( combiner2.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
51 TouchEventCombiner combiner3( 10, Vector2( 20.0f, 31.0f ) );
52 DALI_TEST_EQUALS( combiner3.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
53 DALI_TEST_EQUALS( combiner3.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
57 TouchEventCombiner combiner4( 10, 0.0f, 0.0f );
58 DALI_TEST_EQUALS( combiner4.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
60 TouchEventCombiner combiner5( 10, Vector2( 0.0f, 0.0f ) );
61 DALI_TEST_EQUALS( combiner5.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
65 int UtcDaliTouchEventCombinerConstructorsNegative(void)
69 TouchEventCombiner combiner( 10, -20.0f, 31.0f );
70 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
71 tet_result( TET_FAIL );
73 catch ( Dali::DaliException& e )
75 tet_result( TET_PASS );
80 TouchEventCombiner combiner( 10, 20.0f, -31.0f );
81 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
82 tet_result( TET_FAIL );
84 catch ( Dali::DaliException& e )
86 tet_result( TET_PASS );
91 TouchEventCombiner combiner( 10, Vector2( -20.0f, 31.0f ) );
92 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
93 tet_result( TET_FAIL );
95 catch ( Dali::DaliException& e )
97 tet_result( TET_PASS );
102 TouchEventCombiner combiner( 10, Vector2( 20.0f, -31.0f ) );
103 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
104 tet_result( TET_FAIL );
106 catch ( Dali::DaliException& e )
108 tet_result( TET_PASS );
113 int UtcDaliTouchEventCombinerSettersAndGetters(void)
115 TouchEventCombiner combiner;
116 unsigned long time( 10u );
117 Vector2 distance( 40.0f, 30.0f );
119 DALI_TEST_CHECK( combiner.GetMinimumMotionTimeThreshold() != time );
120 DALI_TEST_CHECK( combiner.GetMinimumMotionDistanceThreshold() != distance );
122 combiner.SetMinimumMotionTimeThreshold( time );
123 DALI_TEST_EQUALS( combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION );
125 combiner.SetMinimumMotionDistanceThreshold( distance.x );
126 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2( distance.x, distance.x ), TEST_LOCATION );
130 combiner.SetMinimumMotionDistanceThreshold( distance.x, distance.y );
131 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
135 combiner.SetMinimumMotionDistanceThreshold( distance );
136 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
140 combiner.SetMinimumMotionDistanceThreshold( 0.0f );
141 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
143 combiner.SetMinimumMotionDistanceThreshold( 0.0f, 0.0f );
144 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
146 combiner.SetMinimumMotionDistanceThreshold( Vector2::ZERO );
147 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
151 int UtcDaliTouchEventCombinerSettersNegative(void)
153 TouchEventCombiner combiner;
157 combiner.SetMinimumMotionDistanceThreshold( -100.0f );
158 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
159 tet_result( TET_FAIL );
161 catch ( Dali::DaliException& e )
163 tet_result( TET_PASS );
168 combiner.SetMinimumMotionDistanceThreshold( -100.0f, 20.0f );
169 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
170 tet_result( TET_FAIL );
172 catch ( Dali::DaliException& e )
174 tet_result( TET_PASS );
179 combiner.SetMinimumMotionDistanceThreshold( 100.0f, -20.0f );
180 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
181 tet_result( TET_FAIL );
183 catch ( Dali::DaliException& e )
185 tet_result( TET_PASS );
190 combiner.SetMinimumMotionDistanceThreshold( Vector2( -100.0f, 20.0f ) );
191 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
192 tet_result( TET_FAIL );
194 catch ( Dali::DaliException& e )
196 tet_result( TET_PASS );
201 combiner.SetMinimumMotionDistanceThreshold( Vector2( 100.0f, -20.0f ) );
202 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
203 tet_result( TET_FAIL );
205 catch ( Dali::DaliException& e )
207 tet_result( TET_PASS );
212 int UtcDaliTouchEventCombinerSingleTouchNormal(void)
214 TouchEventCombiner combiner;
215 unsigned long time( 0u );
219 Integration::TouchEvent touchEvent;
220 Integration::HoverEvent hoverEvent;
221 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
223 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
224 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
225 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
226 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
227 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
232 // Motion in X direction
234 Integration::TouchEvent touchEvent;
235 Integration::HoverEvent hoverEvent;
236 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
238 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
239 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
240 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
241 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
242 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
247 // Motion in Y direction
249 Integration::TouchEvent touchEvent;
250 Integration::HoverEvent hoverEvent;
251 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 101.0f );
253 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
254 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
255 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
256 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
257 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
260 // Motion event, but same time
262 Integration::TouchEvent touchEvent;
263 Integration::HoverEvent hoverEvent;
264 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
266 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
271 // Motion event, both X and Y movement
273 Integration::TouchEvent touchEvent;
274 Integration::HoverEvent hoverEvent;
275 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
277 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
278 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
279 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
280 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
281 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
286 // Motion event, no movement
288 Integration::TouchEvent touchEvent;
289 Integration::HoverEvent hoverEvent;
290 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
292 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
295 // Up event, no time diff, no movement
297 Integration::TouchEvent touchEvent;
298 Integration::HoverEvent hoverEvent;
299 TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
301 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
302 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
303 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
304 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
305 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
310 int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void)
312 TouchEventCombiner combiner;
313 unsigned long time( 0u );
317 Integration::TouchEvent touchEvent;
318 Integration::HoverEvent hoverEvent;
319 TouchPoint point( 1, TouchPoint::Motion, 100.0f, 100.0f );
321 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
322 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
323 DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
324 DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Started, TEST_LOCATION );
325 DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
332 Integration::TouchEvent touchEvent;
333 Integration::HoverEvent hoverEvent;
334 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
336 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
337 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
338 DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
339 DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
340 DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
345 int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void)
347 TouchEventCombiner combiner;
348 unsigned long time( 0u );
352 Integration::TouchEvent touchEvent;
353 Integration::HoverEvent hoverEvent;
354 TouchPoint point( 1, TouchPoint::Motion, 100.0f, 100.0f );
356 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
357 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
358 DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
359 DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Started, TEST_LOCATION );
360 DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
367 Integration::TouchEvent touchEvent;
368 Integration::HoverEvent hoverEvent;
369 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
371 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
372 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
373 DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
374 DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
375 DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
382 Integration::TouchEvent touchEvent;
383 Integration::HoverEvent hoverEvent;
384 TouchPoint point( 1, TouchPoint::Motion, 103.0f, 103.0f );
386 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
387 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
388 DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
389 DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
390 DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
397 Integration::TouchEvent touchEvent;
398 Integration::HoverEvent hoverEvent;
399 TouchPoint point( 1, TouchPoint::Down, 103.0f, 103.0f );
401 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
402 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
403 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
404 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
405 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
406 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
407 DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
408 DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Finished, TEST_LOCATION );
409 DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
414 int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void)
416 TouchEventCombiner combiner;
417 unsigned long time( 0u );
421 Integration::TouchEvent touchEvent;
422 Integration::HoverEvent hoverEvent;
423 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
425 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
426 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
427 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
428 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
429 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
434 // Another down with the same ID
436 Integration::TouchEvent touchEvent;
437 Integration::HoverEvent hoverEvent;
438 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
440 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
445 int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void)
447 TouchEventCombiner combiner;
448 unsigned long time( 0u );
452 Integration::TouchEvent touchEvent;
453 Integration::HoverEvent hoverEvent;
454 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
456 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
463 Integration::TouchEvent touchEvent;
464 Integration::HoverEvent hoverEvent;
465 TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
467 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
472 int UtcDaliTouchEventCombinerSingleTouchTwoUps(void)
474 TouchEventCombiner combiner;
475 unsigned long time( 0u );
479 Integration::TouchEvent touchEvent;
480 Integration::HoverEvent hoverEvent;
481 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
483 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
484 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
485 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
486 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
487 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
494 Integration::TouchEvent touchEvent;
495 Integration::HoverEvent hoverEvent;
496 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
498 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
499 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
500 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
501 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
502 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
509 Integration::TouchEvent touchEvent;
510 Integration::HoverEvent hoverEvent;
511 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
513 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
518 int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void)
520 TouchEventCombiner combiner;
521 unsigned long time( 0u );
525 Integration::TouchEvent touchEvent;
526 Integration::HoverEvent hoverEvent;
527 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
529 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
530 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
531 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
532 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
533 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
538 // Up event with different ID
540 Integration::TouchEvent touchEvent;
541 Integration::HoverEvent hoverEvent;
542 TouchPoint point( 2, TouchPoint::Up, 100.0f, 100.0f );
544 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
551 Integration::TouchEvent touchEvent;
552 Integration::HoverEvent hoverEvent;
553 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
555 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
556 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
557 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
558 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
559 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
564 int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void)
566 TouchEventCombiner combiner;
567 unsigned long time( 0u );
571 Integration::TouchEvent touchEvent;
572 Integration::HoverEvent hoverEvent;
573 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
575 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
576 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
577 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
578 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
579 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
584 // Motion event with different ID
586 Integration::TouchEvent touchEvent;
587 Integration::HoverEvent hoverEvent;
588 TouchPoint point( 2, TouchPoint::Motion, 100.0f, 100.0f );
590 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
591 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
592 DALI_TEST_EQUALS( hoverEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
593 DALI_TEST_EQUALS( hoverEvent.points[0].state, TouchPoint::Started, TEST_LOCATION );
594 DALI_TEST_EQUALS( hoverEvent.points[0].screen, point.screen, TEST_LOCATION );
601 Integration::TouchEvent touchEvent;
602 Integration::HoverEvent hoverEvent;
603 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
605 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
606 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
607 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
608 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
609 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
614 int UtcDaliTouchEventCombinerMultiTouchNormal(void)
616 TouchEventCombiner combiner;
617 unsigned long time( 0u );
621 Integration::TouchEvent touchEvent;
622 Integration::HoverEvent hoverEvent;
623 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
625 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
626 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
627 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
628 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
629 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
636 Integration::TouchEvent touchEvent;
637 Integration::HoverEvent hoverEvent;
638 TouchPoint point( 2, TouchPoint::Down, 200.0f, 200.0f );
640 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
641 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
642 DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
643 DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
644 DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
645 DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
652 Integration::TouchEvent touchEvent;
653 Integration::HoverEvent hoverEvent;
654 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
656 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
657 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
658 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
659 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
660 DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
661 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
664 // 2nd point motion, no time diff
666 Integration::TouchEvent touchEvent;
667 Integration::HoverEvent hoverEvent;
668 TouchPoint point( 2, TouchPoint::Motion, 200.0f, 200.0f );
670 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
677 Integration::TouchEvent touchEvent;
678 Integration::HoverEvent hoverEvent;
679 TouchPoint point( 2, TouchPoint::Motion, 201.0f, 201.0f );
681 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
682 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
683 DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
684 DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
685 DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
686 DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
693 Integration::TouchEvent touchEvent;
694 Integration::HoverEvent hoverEvent;
695 TouchPoint point( 1, TouchPoint::Up, 101.0f, 100.0f );
697 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
698 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
699 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
700 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
701 DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
702 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
709 Integration::TouchEvent touchEvent;
710 Integration::HoverEvent hoverEvent;
711 TouchPoint point( 2, TouchPoint::Motion, 202.0f, 202.0f );
713 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
714 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
715 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
716 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
717 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
724 Integration::TouchEvent touchEvent;
725 Integration::HoverEvent hoverEvent;
726 TouchPoint point( 2, TouchPoint::Up, 202.0f, 202.0f );
728 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
729 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
730 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
731 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
732 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
737 int UtcDaliTouchEventCombinerSeveralPoints(void)
739 TouchEventCombiner combiner;
740 unsigned long time( 0u );
741 unsigned int const maximum( 200u );
744 for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
746 Integration::TouchEvent touchEvent;
747 Integration::HoverEvent hoverEvent;
748 TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
750 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
751 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
755 for ( unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount )
757 Integration::TouchEvent touchEvent;
758 Integration::HoverEvent hoverEvent;
759 TouchPoint point( pointCount, TouchPoint::Up, 100.0f, 100.0f );
761 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
762 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
767 int UtcDaliTouchEventCombinerReset(void)
769 TouchEventCombiner combiner;
770 unsigned long time( 0u );
774 Integration::TouchEvent touchEvent;
775 Integration::HoverEvent hoverEvent;
776 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
778 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
779 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
780 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
781 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
782 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
787 // Reset combiner, no more events should be sent to core.
792 Integration::TouchEvent touchEvent;
793 Integration::HoverEvent hoverEvent;
794 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
796 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
801 int UtcDaliTouchEventCombinerSingleTouchInterrupted(void)
803 TouchEventCombiner combiner;
804 unsigned long time( 0u );
808 Integration::TouchEvent touchEvent;
809 Integration::HoverEvent hoverEvent;
810 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
812 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
813 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
814 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
815 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
816 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
823 Integration::TouchEvent touchEvent;
824 Integration::HoverEvent hoverEvent;
825 TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
827 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
828 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
829 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
830 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
831 DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
834 // Send up, should not be able to send as combiner has been reset.
837 Integration::TouchEvent touchEvent;
838 Integration::HoverEvent hoverEvent;
839 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
841 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
846 int UtcDaliTouchEventCombinerMultiTouchInterrupted(void)
848 TouchEventCombiner combiner;
849 unsigned long time( 0u );
850 unsigned int const maximum( 200u );
853 for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
855 Integration::TouchEvent touchEvent;
856 Integration::HoverEvent hoverEvent;
857 TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
859 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
860 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
865 Integration::TouchEvent touchEvent;
866 Integration::HoverEvent hoverEvent;
867 TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
869 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
870 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
871 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
872 DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
873 DALI_TEST_EQUALS( hoverEvent.points[0].state, point.state, TEST_LOCATION );
876 // Send up, should not be able to send as combiner has been reset.
879 Integration::TouchEvent touchEvent;
880 Integration::HoverEvent hoverEvent;
881 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
883 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
888 int UtcDaliTouchEventCombinerInvalidState(void)
890 TouchEventCombiner combiner;
891 unsigned long time( 0u );
895 Integration::TouchEvent touchEvent;
896 Integration::HoverEvent hoverEvent;
897 TouchPoint point( 1, TouchPoint::Stationary, 100.0f, 100.0f );
899 DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );