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-test-suite-utils.h>
27 using namespace Dali::Integration;
29 void utc_dali_touch_event_combiner_startup(void)
31 test_return_value = TET_UNDEF;
34 void utc_dali_touch_event_combiner_cleanup(void)
36 test_return_value = TET_PASS;
40 int UtcDaliTouchEventCombinerConstructors(void)
42 TouchEventCombiner combiner1;
43 DALI_TEST_EQUALS( combiner1.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(1), TEST_LOCATION );
44 DALI_TEST_EQUALS( combiner1.GetMinimumMotionDistanceThreshold(), Vector2( 1.0f, 1.0f ), TEST_LOCATION );
46 TouchEventCombiner combiner2( 10, 20.0f, 31.0f );
47 DALI_TEST_EQUALS( combiner2.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
48 DALI_TEST_EQUALS( combiner2.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
50 TouchEventCombiner combiner3( 10, Vector2( 20.0f, 31.0f ) );
51 DALI_TEST_EQUALS( combiner3.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION );
52 DALI_TEST_EQUALS( combiner3.GetMinimumMotionDistanceThreshold(), Vector2( 20.0f, 31.0f ), TEST_LOCATION );
56 TouchEventCombiner combiner4( 10, 0.0f, 0.0f );
57 DALI_TEST_EQUALS( combiner4.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
59 TouchEventCombiner combiner5( 10, Vector2( 0.0f, 0.0f ) );
60 DALI_TEST_EQUALS( combiner5.GetMinimumMotionDistanceThreshold(), Vector2( 0.0f, 0.0f ), TEST_LOCATION );
64 int UtcDaliTouchEventCombinerConstructorsNegative(void)
68 TouchEventCombiner combiner( 10, -20.0f, 31.0f );
69 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
70 tet_result( TET_FAIL );
72 catch ( Dali::DaliException& e )
74 tet_result( TET_PASS );
79 TouchEventCombiner combiner( 10, 20.0f, -31.0f );
80 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
81 tet_result( TET_FAIL );
83 catch ( Dali::DaliException& e )
85 tet_result( TET_PASS );
90 TouchEventCombiner combiner( 10, Vector2( -20.0f, 31.0f ) );
91 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
92 tet_result( TET_FAIL );
94 catch ( Dali::DaliException& e )
96 tet_result( TET_PASS );
101 TouchEventCombiner combiner( 10, Vector2( 20.0f, -31.0f ) );
102 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
103 tet_result( TET_FAIL );
105 catch ( Dali::DaliException& e )
107 tet_result( TET_PASS );
112 int UtcDaliTouchEventCombinerSettersAndGetters(void)
114 TouchEventCombiner combiner;
115 unsigned long time( 10u );
116 Vector2 distance( 40.0f, 30.0f );
118 DALI_TEST_CHECK( combiner.GetMinimumMotionTimeThreshold() != time );
119 DALI_TEST_CHECK( combiner.GetMinimumMotionDistanceThreshold() != distance );
121 combiner.SetMinimumMotionTimeThreshold( time );
122 DALI_TEST_EQUALS( combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION );
124 combiner.SetMinimumMotionDistanceThreshold( distance.x );
125 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2( distance.x, distance.x ), TEST_LOCATION );
129 combiner.SetMinimumMotionDistanceThreshold( distance.x, distance.y );
130 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
134 combiner.SetMinimumMotionDistanceThreshold( distance );
135 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION );
139 combiner.SetMinimumMotionDistanceThreshold( 0.0f );
140 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
142 combiner.SetMinimumMotionDistanceThreshold( 0.0f, 0.0f );
143 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
145 combiner.SetMinimumMotionDistanceThreshold( Vector2::ZERO );
146 DALI_TEST_EQUALS( combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION );
150 int UtcDaliTouchEventCombinerSettersNegative(void)
152 TouchEventCombiner combiner;
156 combiner.SetMinimumMotionDistanceThreshold( -100.0f );
157 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
158 tet_result( TET_FAIL );
160 catch ( Dali::DaliException& e )
162 tet_result( TET_PASS );
167 combiner.SetMinimumMotionDistanceThreshold( -100.0f, 20.0f );
168 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
169 tet_result( TET_FAIL );
171 catch ( Dali::DaliException& e )
173 tet_result( TET_PASS );
178 combiner.SetMinimumMotionDistanceThreshold( 100.0f, -20.0f );
179 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
180 tet_result( TET_FAIL );
182 catch ( Dali::DaliException& e )
184 tet_result( TET_PASS );
189 combiner.SetMinimumMotionDistanceThreshold( Vector2( -100.0f, 20.0f ) );
190 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
191 tet_result( TET_FAIL );
193 catch ( Dali::DaliException& e )
195 tet_result( TET_PASS );
200 combiner.SetMinimumMotionDistanceThreshold( Vector2( 100.0f, -20.0f ) );
201 tet_printf( "%s: Should have asserted\n", TEST_LOCATION );
202 tet_result( TET_FAIL );
204 catch ( Dali::DaliException& e )
206 tet_result( TET_PASS );
211 int UtcDaliTouchEventCombinerSingleTouchNormal(void)
213 TouchEventCombiner combiner;
214 unsigned long time( 0u );
218 Integration::TouchEvent touchEvent;
219 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
221 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
222 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
223 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
224 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
225 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
230 // Motion in X direction
232 Integration::TouchEvent touchEvent;
233 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
235 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
236 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
237 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
238 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
239 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
244 // Motion in Y direction
246 Integration::TouchEvent touchEvent;
247 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 101.0f );
249 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
250 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
251 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
252 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
253 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
256 // Motion event, but same time
258 Integration::TouchEvent touchEvent;
259 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
261 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
266 // Motion event, both X and Y movement
268 Integration::TouchEvent touchEvent;
269 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
271 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
272 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
273 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
274 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
275 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
280 // Motion event, no movement
282 Integration::TouchEvent touchEvent;
283 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
285 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
288 // Up event, no time diff, no movement
290 Integration::TouchEvent touchEvent;
291 TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
293 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
294 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
295 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
296 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
297 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
302 int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void)
304 TouchEventCombiner combiner;
305 unsigned long time( 0u );
309 Integration::TouchEvent touchEvent;
310 TouchPoint point( 1, TouchPoint::Motion, 100.0f, 100.0f );
312 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
319 Integration::TouchEvent touchEvent;
320 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
322 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
327 int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void)
329 TouchEventCombiner combiner;
330 unsigned long time( 0u );
334 Integration::TouchEvent touchEvent;
335 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
337 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
338 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
339 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
340 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
341 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
346 // Another down with the same ID
348 Integration::TouchEvent touchEvent;
349 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
351 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
356 int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void)
358 TouchEventCombiner combiner;
359 unsigned long time( 0u );
363 Integration::TouchEvent touchEvent;
364 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
366 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
373 Integration::TouchEvent touchEvent;
374 TouchPoint point( 1, TouchPoint::Up, 102.0f, 102.0f );
376 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
381 int UtcDaliTouchEventCombinerSingleTouchTwoUps(void)
383 TouchEventCombiner combiner;
384 unsigned long time( 0u );
388 Integration::TouchEvent touchEvent;
389 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
391 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
392 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
393 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
394 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
395 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
402 Integration::TouchEvent touchEvent;
403 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
405 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
406 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
407 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
408 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
409 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
416 Integration::TouchEvent touchEvent;
417 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
419 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
424 int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void)
426 TouchEventCombiner combiner;
427 unsigned long time( 0u );
431 Integration::TouchEvent touchEvent;
432 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
434 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
435 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
436 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
437 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
438 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
443 // Up event with different ID
445 Integration::TouchEvent touchEvent;
446 TouchPoint point( 2, TouchPoint::Up, 100.0f, 100.0f );
448 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
455 Integration::TouchEvent touchEvent;
456 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
458 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
459 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
460 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
461 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
462 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
467 int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void)
469 TouchEventCombiner combiner;
470 unsigned long time( 0u );
474 Integration::TouchEvent touchEvent;
475 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
477 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
478 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
479 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
480 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
481 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
486 // Motion event with different ID
488 Integration::TouchEvent touchEvent;
489 TouchPoint point( 2, TouchPoint::Motion, 100.0f, 100.0f );
491 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
498 Integration::TouchEvent touchEvent;
499 TouchPoint point( 1, TouchPoint::Motion, 102.0f, 102.0f );
501 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
502 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
503 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
504 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
505 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
510 int UtcDaliTouchEventCombinerMultiTouchNormal(void)
512 TouchEventCombiner combiner;
513 unsigned long time( 0u );
517 Integration::TouchEvent touchEvent;
518 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
520 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
521 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
522 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
523 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
524 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
531 Integration::TouchEvent touchEvent;
532 TouchPoint point( 2, TouchPoint::Down, 200.0f, 200.0f );
534 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
535 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
536 DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
537 DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
538 DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
539 DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
546 Integration::TouchEvent touchEvent;
547 TouchPoint point( 1, TouchPoint::Motion, 101.0f, 100.0f );
549 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
550 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
551 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
552 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
553 DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
554 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
557 // 2nd point motion, no time diff
559 Integration::TouchEvent touchEvent;
560 TouchPoint point( 2, TouchPoint::Motion, 200.0f, 200.0f );
562 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
569 Integration::TouchEvent touchEvent;
570 TouchPoint point( 2, TouchPoint::Motion, 201.0f, 201.0f );
572 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
573 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
574 DALI_TEST_EQUALS( touchEvent.points[1].deviceId, point.deviceId, TEST_LOCATION );
575 DALI_TEST_EQUALS( touchEvent.points[0].state, TouchPoint::Stationary, TEST_LOCATION );
576 DALI_TEST_EQUALS( touchEvent.points[1].state, point.state, TEST_LOCATION );
577 DALI_TEST_EQUALS( touchEvent.points[1].screen, point.screen, TEST_LOCATION );
584 Integration::TouchEvent touchEvent;
585 TouchPoint point( 1, TouchPoint::Up, 101.0f, 100.0f );
587 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
588 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
589 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
590 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
591 DALI_TEST_EQUALS( touchEvent.points[1].state, TouchPoint::Stationary, TEST_LOCATION );
592 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
599 Integration::TouchEvent touchEvent;
600 TouchPoint point( 2, TouchPoint::Motion, 202.0f, 202.0f );
602 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
603 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
604 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
605 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
606 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
613 Integration::TouchEvent touchEvent;
614 TouchPoint point( 2, TouchPoint::Up, 202.0f, 202.0f );
616 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
617 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
618 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
619 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
620 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
625 int UtcDaliTouchEventCombinerSeveralPoints(void)
627 TouchEventCombiner combiner;
628 unsigned long time( 0u );
629 unsigned int const maximum( 200u );
632 for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
634 Integration::TouchEvent touchEvent;
635 TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
637 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time++, touchEvent ), TEST_LOCATION );
638 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
642 for ( unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount )
644 Integration::TouchEvent touchEvent;
645 TouchPoint point( pointCount, TouchPoint::Up, 100.0f, 100.0f );
647 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time++, touchEvent ), TEST_LOCATION );
648 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
653 int UtcDaliTouchEventCombinerReset(void)
655 TouchEventCombiner combiner;
656 unsigned long time( 0u );
660 Integration::TouchEvent touchEvent;
661 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
663 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
664 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
665 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
666 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
667 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
672 // Reset combiner, no more events should be sent to core.
677 Integration::TouchEvent touchEvent;
678 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
680 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
685 int UtcDaliTouchEventCombinerSingleTouchInterrupted(void)
687 TouchEventCombiner combiner;
688 unsigned long time( 0u );
692 Integration::TouchEvent touchEvent;
693 TouchPoint point( 1, TouchPoint::Down, 100.0f, 100.0f );
695 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
696 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
697 DALI_TEST_EQUALS( touchEvent.points[0].deviceId, point.deviceId, TEST_LOCATION );
698 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
699 DALI_TEST_EQUALS( touchEvent.points[0].screen, point.screen, TEST_LOCATION );
706 Integration::TouchEvent touchEvent;
707 TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
709 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
710 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
711 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
714 // Send up, should not be able to send as combiner has been reset.
717 Integration::TouchEvent touchEvent;
718 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
720 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
725 int UtcDaliTouchEventCombinerMultiTouchInterrupted(void)
727 TouchEventCombiner combiner;
728 unsigned long time( 0u );
729 unsigned int const maximum( 200u );
732 for ( unsigned int pointCount = 1u; pointCount < maximum; ++pointCount )
734 Integration::TouchEvent touchEvent;
735 TouchPoint point( pointCount, TouchPoint::Down, 100.0f, 100.0f );
737 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time++, touchEvent ), TEST_LOCATION );
738 DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
743 Integration::TouchEvent touchEvent;
744 TouchPoint point( 1, TouchPoint::Interrupted, 100.0f, 100.0f );
746 DALI_TEST_EQUALS( true, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
747 DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
748 DALI_TEST_EQUALS( touchEvent.points[0].state, point.state, TEST_LOCATION );
751 // Send up, should not be able to send as combiner has been reset.
754 Integration::TouchEvent touchEvent;
755 TouchPoint point( 1, TouchPoint::Up, 100.0f, 100.0f );
757 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );
762 int UtcDaliTouchEventCombinerInvalidState(void)
764 TouchEventCombiner combiner;
765 unsigned long time( 0u );
769 Integration::TouchEvent touchEvent;
770 TouchPoint point( 1, TouchPoint::Stationary, 100.0f, 100.0f );
772 DALI_TEST_EQUALS( false, combiner.GetNextTouchEvent( point, time, touchEvent ), TEST_LOCATION );