2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
20 #include <dali/dali.h>
21 #include <dali/integration-api/events/touch-event-combiner.h>
22 #include <dali/integration-api/events/touch-event-integ.h>
23 #include <dali-test-suite-utils.h>
26 using namespace Dali::Integration;
28 void utc_dali_touch_event_combiner_startup(void)
30 test_return_value = TET_UNDEF;
33 void utc_dali_touch_event_combiner_cleanup(void)
35 test_return_value = TET_PASS;
39 int UtcDaliTouchEventCombinerConstructors(void)
41 TouchEventCombiner combiner1;
42 DALI_TEST_EQUALS( combiner1.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(1), TEST_LOCATION );
43 DALI_TEST_EQUALS( combiner1.GetMinimumMotionDistanceThreshold(), Vector2( 1.0f, 1.0f ), TEST_LOCATION );
45 TouchEventCombiner combiner2( 10, 20.0f, 31.0f );
46 DALI_TEST_EQUALS( combiner2.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
47 DALI_TEST_EQUALS( combiner2.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
49 TouchEventCombiner combiner3( 10, Vector2( 20.0f, 31.0f ) );
50 DALI_TEST_EQUALS( combiner3.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
51 DALI_TEST_EQUALS( combiner3.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
55 TouchEventCombiner combiner4( 10, 0.0f, 0.0f );
56 DALI_TEST_EQUALS( combiner4.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
58 TouchEventCombiner combiner5( 10, Vector2( 0.0f, 0.0f ) );
59 DALI_TEST_EQUALS( combiner5.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
63 int UtcDaliTouchEventCombinerConstructorsNegative(void)
67 TouchEventCombiner combiner( 10, -20.0f, 31.0f );
68 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
69 tet_result( TET_FAIL );
71 catch ( Dali::DaliException& e )
73 tet_result( TET_PASS );
78 TouchEventCombiner combiner( 10, 20.0f, -31.0f );
79 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
80 tet_result( TET_FAIL );
82 catch ( Dali::DaliException& e )
84 tet_result( TET_PASS );
89 TouchEventCombiner combiner( 10, Vector2( -20.0f, 31.0f ) );
90 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
91 tet_result( TET_FAIL );
93 catch ( Dali::DaliException& e )
95 tet_result( TET_PASS );
100 TouchEventCombiner combiner( 10, Vector2( 20.0f, -31.0f ) );
101 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
102 tet_result( TET_FAIL );
104 catch ( Dali::DaliException& e )
106 tet_result( TET_PASS );
111 int UtcDaliTouchEventCombinerSettersAndGetters(void)
113 TouchEventCombiner combiner;
114 unsigned long time( 10u );
115 Vector2 distance( 40.0f, 30.0f );
117 DALI_TEST_CHECK( combiner.GetMinimumMotionTimeThreshold() != time );
118 DALI_TEST_CHECK( combiner.GetMinimumMotionDistanceThreshold() != distance );
120 combiner.SetMinimumMotionTimeThreshold( time );
121 DALI_TEST_EQUALS( combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION );
123 combiner.SetMinimumMotionDistanceThreshold( distance.x );
124 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2( distance.x, distance.x ), TEST_LOCATION );
128 combiner.SetMinimumMotionDistanceThreshold( distance.x, distance.y );
129 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
133 combiner.SetMinimumMotionDistanceThreshold( distance );
134 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
138 combiner.SetMinimumMotionDistanceThreshold( 0.0f );
139 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
141 combiner.SetMinimumMotionDistanceThreshold( 0.0f, 0.0f );
142 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
144 combiner.SetMinimumMotionDistanceThreshold( Vector2::ZERO );
145 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
149 int UtcDaliTouchEventCombinerSettersNegative(void)
151 TouchEventCombiner combiner;
155 combiner.SetMinimumMotionDistanceThreshold( -100.0f );
156 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
157 tet_result( TET_FAIL );
159 catch ( Dali::DaliException& e )
161 tet_result( TET_PASS );
166 combiner.SetMinimumMotionDistanceThreshold( -100.0f, 20.0f );
167 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
168 tet_result( TET_FAIL );
170 catch ( Dali::DaliException& e )
172 tet_result( TET_PASS );
177 combiner.SetMinimumMotionDistanceThreshold( 100.0f, -20.0f );
178 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
179 tet_result( TET_FAIL );
181 catch ( Dali::DaliException& e )
183 tet_result( TET_PASS );
188 combiner.SetMinimumMotionDistanceThreshold( Vector2( -100.0f, 20.0f ) );
189 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
190 tet_result( TET_FAIL );
192 catch ( Dali::DaliException& e )
194 tet_result( TET_PASS );
199 combiner.SetMinimumMotionDistanceThreshold( Vector2( 100.0f, -20.0f ) );
200 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
201 tet_result( TET_FAIL );
203 catch ( Dali::DaliException& e )
205 tet_result( TET_PASS );
210 int UtcDaliTouchEventCombinerSingleTouchNormal(void)
212 TouchEventCombiner combiner;
213 unsigned long time( 0u );
217 Integration::TouchEvent touchEvent;
218 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
220 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
221 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
222 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
223 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
224 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
229 // Motion in X direction
231 Integration::TouchEvent touchEvent;
232 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
234 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
235 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
236 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
237 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
238 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
243 // Motion in Y direction
245 Integration::TouchEvent touchEvent;
246 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 101.0f );
248 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
249 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
250 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
251 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
252 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
255 // Motion event, but same time
257 Integration::TouchEvent touchEvent;
258 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
260 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
265 // Motion event, both X and Y movement
267 Integration::TouchEvent touchEvent;
268 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
270 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
271 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
272 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
273 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
274 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
279 // Motion event, no movement
281 Integration::TouchEvent touchEvent;
282 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
284 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
287 // Up event, no time diff, no movement
289 Integration::TouchEvent touchEvent;
290 TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
292 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
293 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
294 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
295 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
296 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
301 int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void)
303 TouchEventCombiner combiner;
304 unsigned long time( 0u );
308 Integration::TouchEvent touchEvent;
309 TouchPoint point( 1, TouchPoint::Motion, 100.0f, 100.0f );
311 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
318 Integration::TouchEvent touchEvent;
319 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
321 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
326 int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void)
328 TouchEventCombiner combiner;
329 unsigned long time( 0u );
333 Integration::TouchEvent touchEvent;
334 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
336 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
337 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
338 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
339 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
340 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
345 // Another down with the same ID
347 Integration::TouchEvent touchEvent;
348 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
350 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
355 int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void)
357 TouchEventCombiner combiner;
358 unsigned long time( 0u );
362 Integration::TouchEvent touchEvent;
363 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
365 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
372 Integration::TouchEvent touchEvent;
373 TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
375 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
380 int UtcDaliTouchEventCombinerSingleTouchTwoUps(void)
382 TouchEventCombiner combiner;
383 unsigned long time( 0u );
387 Integration::TouchEvent touchEvent;
388 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
390 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
391 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
392 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
393 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
394 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
401 Integration::TouchEvent touchEvent;
402 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
404 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
405 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
406 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
407 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
408 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
415 Integration::TouchEvent touchEvent;
416 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
418 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
423 int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void)
425 TouchEventCombiner combiner;
426 unsigned long time( 0u );
430 Integration::TouchEvent touchEvent;
431 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
433 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
434 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
435 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
436 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
437 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
442 // Up event with different ID
444 Integration::TouchEvent touchEvent;
445 TouchPoint point( 2, TouchPoint::Up, 100.0f, 100.0f );
447 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
454 Integration::TouchEvent touchEvent;
455 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
457 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
458 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
459 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
460 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
461 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
466 int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void)
468 TouchEventCombiner combiner;
469 unsigned long time( 0u );
473 Integration::TouchEvent touchEvent;
474 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
476 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
477 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
478 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
479 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
480 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
485 // Motion event with different ID
487 Integration::TouchEvent touchEvent;
488 TouchPoint point( 2, TouchPoint::Motion, 100.0f, 100.0f );
490 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
497 Integration::TouchEvent touchEvent;
498 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
500 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
501 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
502 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
503 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
504 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
509 int UtcDaliTouchEventCombinerMultiTouchNormal(void)
511 TouchEventCombiner combiner;
512 unsigned long time( 0u );
516 Integration::TouchEvent touchEvent;
517 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
519 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
520 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
521 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
522 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
523 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
530 Integration::TouchEvent touchEvent;
531 TouchPoint point( 2, TouchPoint::Down, 200.0f, 200.0f );
533 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
534 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
535 DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
536 DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
537 DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
538 DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
545 Integration::TouchEvent touchEvent;
546 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
548 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
549 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
550 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
551 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
552 DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
553 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
556 // 2nd point motion, no time diff
558 Integration::TouchEvent touchEvent;
559 TouchPoint point( 2, TouchPoint::Motion, 200.0f, 200.0f );
561 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
568 Integration::TouchEvent touchEvent;
569 TouchPoint point( 2, TouchPoint::Motion, 201.0f, 201.0f );
571 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
572 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
573 DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
574 DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
575 DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
576 DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
583 Integration::TouchEvent touchEvent;
584 TouchPoint point( 1, TouchPoint::Up, 101.0f, 100.0f );
586 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
587 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
588 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
589 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
590 DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
591 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
598 Integration::TouchEvent touchEvent;
599 TouchPoint point( 2, TouchPoint::Motion, 202.0f, 202.0f );
601 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
602 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
603 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
604 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
605 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
612 Integration::TouchEvent touchEvent;
613 TouchPoint point( 2, TouchPoint::Up, 202.0f, 202.0f );
615 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
616 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
617 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
618 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
619 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
624 int UtcDaliTouchEventCombinerSeveralPoints(void)
626 TouchEventCombiner combiner;
627 unsigned long time( 0u );
628 unsigned int const maximum( 200u );
631 for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
633 Integration::TouchEvent touchEvent;
634 TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
636 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time++, touchEvent ), TEST_LOCATION );
637 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
641 for ( unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount )
643 Integration::TouchEvent touchEvent;
644 TouchPoint point( pointCount, TouchPoint::Up, 100.0f, 100.0f );
646 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time++, touchEvent ), TEST_LOCATION );
647 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
652 int UtcDaliTouchEventCombinerReset(void)
654 TouchEventCombiner combiner;
655 unsigned long time( 0u );
659 Integration::TouchEvent touchEvent;
660 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
662 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
663 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
664 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
665 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
666 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
671 // Reset combiner, no more events should be sent to core.
676 Integration::TouchEvent touchEvent;
677 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
679 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
684 int UtcDaliTouchEventCombinerSingleTouchInterrupted(void)
686 TouchEventCombiner combiner;
687 unsigned long time( 0u );
691 Integration::TouchEvent touchEvent;
692 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
694 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
695 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
696 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
697 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
698 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
705 Integration::TouchEvent touchEvent;
706 TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
708 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
709 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
710 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
713 // Send up, should not be able to send as combiner has been reset.
716 Integration::TouchEvent touchEvent;
717 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
719 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
724 int UtcDaliTouchEventCombinerMultiTouchInterrupted(void)
726 TouchEventCombiner combiner;
727 unsigned long time( 0u );
728 unsigned int const maximum( 200u );
731 for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
733 Integration::TouchEvent touchEvent;
734 TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
736 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time++, touchEvent ), TEST_LOCATION );
737 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
742 Integration::TouchEvent touchEvent;
743 TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
745 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
746 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
747 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
750 // Send up, should not be able to send as combiner has been reset.
753 Integration::TouchEvent touchEvent;
754 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
756 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
761 int UtcDaliTouchEventCombinerInvalidState(void)
763 TouchEventCombiner combiner;
764 unsigned long time( 0u );
768 Integration::TouchEvent touchEvent;
769 TouchPoint point( 1, TouchPoint::Stationary, 100.0f, 100.0f );
771 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );