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.
18 #include <dali-test-suite-utils.h>
19 #include <dali/integration-api/events/hover-event-integ.h>
20 #include <dali/integration-api/events/touch-event-combiner.h>
21 #include <dali/integration-api/events/touch-event-integ.h>
22 #include <dali/public-api/dali-core.h>
28 using namespace Dali::Integration;
32 Point GeneratePoint(int deviceId, PointState::Type state, float x, float y)
35 point.SetDeviceId(deviceId);
36 point.SetState(state);
37 point.SetScreenPosition(Vector2(x, y));
42 void utc_dali_touch_event_combiner_startup(void)
44 test_return_value = TET_UNDEF;
47 void utc_dali_touch_event_combiner_cleanup(void)
49 test_return_value = TET_PASS;
52 int UtcDaliTouchEventCombinerConstructors(void)
54 TouchEventCombiner combiner1;
55 DALI_TEST_EQUALS(combiner1.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(1), TEST_LOCATION);
56 DALI_TEST_EQUALS(combiner1.GetMinimumMotionDistanceThreshold(), Vector2(1.0f, 1.0f), TEST_LOCATION);
58 TouchEventCombiner combiner2(10, 20.0f, 31.0f);
59 DALI_TEST_EQUALS(combiner2.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION);
60 DALI_TEST_EQUALS(combiner2.GetMinimumMotionDistanceThreshold(), Vector2(20.0f, 31.0f), TEST_LOCATION);
62 TouchEventCombiner combiner3(10, Vector2(20.0f, 31.0f));
63 DALI_TEST_EQUALS(combiner3.GetMinimumMotionTimeThreshold(), static_cast<long unsigned>(10), TEST_LOCATION);
64 DALI_TEST_EQUALS(combiner3.GetMinimumMotionDistanceThreshold(), Vector2(20.0f, 31.0f), TEST_LOCATION);
68 TouchEventCombiner combiner4(10, 0.0f, 0.0f);
69 DALI_TEST_EQUALS(combiner4.GetMinimumMotionDistanceThreshold(), Vector2(0.0f, 0.0f), TEST_LOCATION);
71 TouchEventCombiner combiner5(10, Vector2(0.0f, 0.0f));
72 DALI_TEST_EQUALS(combiner5.GetMinimumMotionDistanceThreshold(), Vector2(0.0f, 0.0f), TEST_LOCATION);
76 int UtcDaliTouchEventCombinerConstructorsNegative(void)
80 TouchEventCombiner combiner(10, -20.0f, 31.0f);
81 tet_printf("%s: Should have asserted\n", TEST_LOCATION);
84 catch(Dali::DaliException& e)
91 TouchEventCombiner combiner(10, 20.0f, -31.0f);
92 tet_printf("%s: Should have asserted\n", TEST_LOCATION);
95 catch(Dali::DaliException& e)
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 TouchEventCombiner combiner(10, Vector2(20.0f, -31.0f));
114 tet_printf("%s: Should have asserted\n", TEST_LOCATION);
115 tet_result(TET_FAIL);
117 catch(Dali::DaliException& e)
119 tet_result(TET_PASS);
124 int UtcDaliTouchEventCombinerSettersAndGetters(void)
126 TouchEventCombiner combiner;
127 unsigned long time(10u);
128 Vector2 distance(40.0f, 30.0f);
130 DALI_TEST_CHECK(combiner.GetMinimumMotionTimeThreshold() != time);
131 DALI_TEST_CHECK(combiner.GetMinimumMotionDistanceThreshold() != distance);
133 combiner.SetMinimumMotionTimeThreshold(time);
134 DALI_TEST_EQUALS(combiner.GetMinimumMotionTimeThreshold(), time, TEST_LOCATION);
136 combiner.SetMinimumMotionDistanceThreshold(distance.x);
137 DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2(distance.x, distance.x), TEST_LOCATION);
141 combiner.SetMinimumMotionDistanceThreshold(distance.x, distance.y);
142 DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION);
146 combiner.SetMinimumMotionDistanceThreshold(distance);
147 DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), distance, TEST_LOCATION);
151 combiner.SetMinimumMotionDistanceThreshold(0.0f);
152 DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION);
154 combiner.SetMinimumMotionDistanceThreshold(0.0f, 0.0f);
155 DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION);
157 combiner.SetMinimumMotionDistanceThreshold(Vector2::ZERO);
158 DALI_TEST_EQUALS(combiner.GetMinimumMotionDistanceThreshold(), Vector2::ZERO, TEST_LOCATION);
162 int UtcDaliTouchEventCombinerSettersNegative(void)
164 TouchEventCombiner combiner;
168 combiner.SetMinimumMotionDistanceThreshold(-100.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(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 combiner.SetMinimumMotionDistanceThreshold(Vector2(100.0f, -20.0f));
213 tet_printf("%s: Should have asserted\n", TEST_LOCATION);
214 tet_result(TET_FAIL);
216 catch(Dali::DaliException& e)
218 tet_result(TET_PASS);
223 int UtcDaliTouchEventCombinerSingleTouchNormal(void)
225 TouchEventCombiner combiner;
226 unsigned long time(0u);
230 Integration::TouchEvent touchEvent;
231 Integration::HoverEvent hoverEvent;
232 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
234 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
235 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
236 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
237 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
238 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
243 // Motion in X direction
245 Integration::TouchEvent touchEvent;
246 Integration::HoverEvent hoverEvent;
247 Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 100.0f);
249 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
250 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
251 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
252 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
253 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
258 // Motion in Y direction
260 Integration::TouchEvent touchEvent;
261 Integration::HoverEvent hoverEvent;
262 Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 101.0f);
264 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
265 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
266 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
267 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
268 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
271 // Motion event, but same time
273 Integration::TouchEvent touchEvent;
274 Integration::HoverEvent hoverEvent;
275 Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
277 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
282 // Motion event, both X and Y movement
284 Integration::TouchEvent touchEvent;
285 Integration::HoverEvent hoverEvent;
286 Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
288 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
289 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
290 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
291 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
292 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
297 // Motion event, no movement
299 Integration::TouchEvent touchEvent;
300 Integration::HoverEvent hoverEvent;
301 Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
303 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
306 // Up event, no time diff, no movement
308 Integration::TouchEvent touchEvent;
309 Integration::HoverEvent hoverEvent;
310 Integration::Point point = GeneratePoint(1, PointState::UP, 102.0f, 102.0f);
312 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
313 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
314 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
315 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
316 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
321 int UtcDaliTouchEventCombinerSingleTouchMotionWithoutDown(void)
323 TouchEventCombiner combiner;
324 unsigned long time(0u);
328 Integration::TouchEvent touchEvent;
329 Integration::HoverEvent hoverEvent;
330 Integration::Point point = GeneratePoint(1, PointState::MOTION, 100.0f, 100.0f);
332 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
333 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
334 DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
335 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION);
336 DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
343 Integration::TouchEvent touchEvent;
344 Integration::HoverEvent hoverEvent;
345 Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
347 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
348 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
349 DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
350 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
351 DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
356 int UtcDaliTouchEventCombinerSingleTouchMotionFollowedByDown(void)
358 TouchEventCombiner combiner;
359 unsigned long time(0u);
363 Integration::TouchEvent touchEvent;
364 Integration::HoverEvent hoverEvent;
365 Integration::Point point = GeneratePoint(1, PointState::MOTION, 100.0f, 100.0f);
367 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
368 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
369 DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
370 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION);
371 DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
378 Integration::TouchEvent touchEvent;
379 Integration::HoverEvent hoverEvent;
380 Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
382 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
383 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
384 DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
385 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
386 DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
393 Integration::TouchEvent touchEvent;
394 Integration::HoverEvent hoverEvent;
395 Integration::Point point = GeneratePoint(1, PointState::MOTION, 103.0f, 103.0f);
397 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
398 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
399 DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
400 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
401 DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
408 Integration::TouchEvent touchEvent;
409 Integration::HoverEvent hoverEvent;
410 Integration::Point point = GeneratePoint(1, PointState::DOWN, 103.0f, 103.0f);
412 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
413 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
414 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
415 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
416 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
417 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
418 DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
419 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::FINISHED, TEST_LOCATION);
420 DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
425 int UtcDaliTouchEventCombinerSingleTouchTwoDowns(void)
427 TouchEventCombiner combiner;
428 unsigned long time(0u);
432 Integration::TouchEvent touchEvent;
433 Integration::HoverEvent hoverEvent;
434 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
436 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
437 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
438 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
439 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
440 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
445 // Another down with the same ID
447 Integration::TouchEvent touchEvent;
448 Integration::HoverEvent hoverEvent;
449 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
451 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
456 int UtcDaliTouchEventCombinerSingleTouchUpWithoutDown(void)
458 TouchEventCombiner combiner;
459 unsigned long time(0u);
463 Integration::TouchEvent touchEvent;
464 Integration::HoverEvent hoverEvent;
465 Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
467 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
474 Integration::TouchEvent touchEvent;
475 Integration::HoverEvent hoverEvent;
476 Integration::Point point = GeneratePoint(1, PointState::UP, 102.0f, 102.0f);
478 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
483 int UtcDaliTouchEventCombinerSingleTouchTwoUps(void)
485 TouchEventCombiner combiner;
486 unsigned long time(0u);
490 Integration::TouchEvent touchEvent;
491 Integration::HoverEvent hoverEvent;
492 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
494 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
495 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
496 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
497 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
498 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
505 Integration::TouchEvent touchEvent;
506 Integration::HoverEvent hoverEvent;
507 Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
509 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
510 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
511 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
512 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
513 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
520 Integration::TouchEvent touchEvent;
521 Integration::HoverEvent hoverEvent;
522 Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
524 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
529 int UtcDaliTouchEventCombinerSingleTouchUpWithDifferentId(void)
531 TouchEventCombiner combiner;
532 unsigned long time(0u);
536 Integration::TouchEvent touchEvent;
537 Integration::HoverEvent hoverEvent;
538 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
540 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
541 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
542 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
543 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
544 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
549 // Up event with different ID
551 Integration::TouchEvent touchEvent;
552 Integration::HoverEvent hoverEvent;
553 Integration::Point point = GeneratePoint(2, PointState::UP, 100.0f, 100.0f);
555 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
562 Integration::TouchEvent touchEvent;
563 Integration::HoverEvent hoverEvent;
564 Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
566 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
567 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
568 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
569 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
570 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
575 int UtcDaliTouchEventCombinerSingleTouchMotionWithDifferentId(void)
577 TouchEventCombiner combiner;
578 unsigned long time(0u);
582 Integration::TouchEvent touchEvent;
583 Integration::HoverEvent hoverEvent;
584 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
586 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
587 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
588 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
589 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
590 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
595 // Motion event with different ID
597 Integration::TouchEvent touchEvent;
598 Integration::HoverEvent hoverEvent;
599 Integration::Point point = GeneratePoint(2, PointState::MOTION, 100.0f, 100.0f);
601 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
602 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
603 DALI_TEST_EQUALS(hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
604 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION);
605 DALI_TEST_EQUALS(hoverEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
612 Integration::TouchEvent touchEvent;
613 Integration::HoverEvent hoverEvent;
614 Integration::Point point = GeneratePoint(1, PointState::MOTION, 102.0f, 102.0f);
616 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
617 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
618 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
619 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
620 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
625 int UtcDaliTouchEventCombinerMultiTouchNormal(void)
627 TouchEventCombiner combiner;
628 unsigned long time(0u);
632 Integration::TouchEvent touchEvent;
633 Integration::HoverEvent hoverEvent;
634 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
636 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
637 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
638 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
639 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
640 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
647 Integration::TouchEvent touchEvent;
648 Integration::HoverEvent hoverEvent;
649 Integration::Point point = GeneratePoint(2, PointState::DOWN, 200.0f, 200.0f);
651 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
652 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
653 DALI_TEST_EQUALS(touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
654 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION);
655 DALI_TEST_EQUALS(touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION);
656 DALI_TEST_EQUALS(touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
663 Integration::TouchEvent touchEvent;
664 Integration::HoverEvent hoverEvent;
665 Integration::Point point = GeneratePoint(1, PointState::MOTION, 101.0f, 100.0f);
667 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
668 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
669 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
670 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
671 DALI_TEST_EQUALS(touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION);
672 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
675 // 2nd point motion, no time diff
677 Integration::TouchEvent touchEvent;
678 Integration::HoverEvent hoverEvent;
679 Integration::Point point = GeneratePoint(2, PointState::MOTION, 200.0f, 200.0f);
681 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
688 Integration::TouchEvent touchEvent;
689 Integration::HoverEvent hoverEvent;
690 Integration::Point point = GeneratePoint(2, PointState::MOTION, 201.0f, 201.0f);
692 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
693 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
694 DALI_TEST_EQUALS(touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
695 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION);
696 DALI_TEST_EQUALS(touchEvent.points[1].GetState(), point.GetState(), TEST_LOCATION);
697 DALI_TEST_EQUALS(touchEvent.points[1].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
704 Integration::TouchEvent touchEvent;
705 Integration::HoverEvent hoverEvent;
706 Integration::Point point = GeneratePoint(1, PointState::UP, 101.0f, 100.0f);
708 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
709 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 2u, TEST_LOCATION);
710 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
711 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
712 DALI_TEST_EQUALS(touchEvent.points[1].GetState(), PointState::STATIONARY, TEST_LOCATION);
713 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
720 Integration::TouchEvent touchEvent;
721 Integration::HoverEvent hoverEvent;
722 Integration::Point point = GeneratePoint(2, PointState::MOTION, 202.0f, 202.0f);
724 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
725 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
726 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
727 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
728 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
735 Integration::TouchEvent touchEvent;
736 Integration::HoverEvent hoverEvent;
737 Integration::Point point = GeneratePoint(2, PointState::UP, 202.0f, 202.0f);
739 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
740 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
741 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
742 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
743 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
748 int UtcDaliTouchEventCombinerSeveralPoints(void)
750 TouchEventCombiner combiner;
751 unsigned long time(0u);
752 unsigned int const maximum(200u);
755 for(unsigned int pointCount = 1u; pointCount < maximum; ++pointCount)
757 Integration::TouchEvent touchEvent;
758 Integration::HoverEvent hoverEvent;
759 Integration::Point point = GeneratePoint(pointCount, PointState::DOWN, 100.0f, 100.0f);
761 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time++, touchEvent, hoverEvent), TEST_LOCATION);
762 DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION);
766 for(unsigned int pointCount = maximum - 1; pointCount > 0; --pointCount)
768 Integration::TouchEvent touchEvent;
769 Integration::HoverEvent hoverEvent;
770 Integration::Point point = GeneratePoint(pointCount, PointState::UP, 100.0f, 100.0f);
772 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time++, touchEvent, hoverEvent), TEST_LOCATION);
773 DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION);
778 int UtcDaliTouchEventCombinerReset(void)
780 TouchEventCombiner combiner;
781 unsigned long time(0u);
785 Integration::TouchEvent touchEvent;
786 Integration::HoverEvent hoverEvent;
787 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
789 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
790 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
791 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
792 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
793 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
798 // Reset combiner, no more events should be sent to core.
803 Integration::TouchEvent touchEvent;
804 Integration::HoverEvent hoverEvent;
805 Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
807 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
812 int UtcDaliTouchEventCombinerSingleTouchInterrupted(void)
814 TouchEventCombiner combiner;
815 unsigned long time(0u);
819 Integration::TouchEvent touchEvent;
820 Integration::HoverEvent hoverEvent;
821 Integration::Point point = GeneratePoint(1, PointState::DOWN, 100.0f, 100.0f);
823 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
824 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
825 DALI_TEST_EQUALS(touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION);
826 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
827 DALI_TEST_EQUALS(touchEvent.points[0].GetScreenPosition(), point.GetScreenPosition(), TEST_LOCATION);
834 Integration::TouchEvent touchEvent;
835 Integration::HoverEvent hoverEvent;
836 Integration::Point point = GeneratePoint(1, PointState::INTERRUPTED, 100.0f, 100.0f);
838 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
839 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
840 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
841 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
842 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
845 // Send up, should not be able to send as combiner has been reset.
848 Integration::TouchEvent touchEvent;
849 Integration::HoverEvent hoverEvent;
850 Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
852 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
857 int UtcDaliTouchEventCombinerMultiTouchInterrupted(void)
859 TouchEventCombiner combiner;
860 unsigned long time(0u);
861 unsigned int const maximum(200u);
864 for(unsigned int pointCount = 1u; pointCount < maximum; ++pointCount)
866 Integration::TouchEvent touchEvent;
867 Integration::HoverEvent hoverEvent;
868 Integration::Point point = GeneratePoint(pointCount, PointState::DOWN, 100.0f, 100.0f);
870 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
871 DALI_TEST_EQUALS(touchEvent.GetPointCount(), pointCount, TEST_LOCATION);
876 Integration::TouchEvent touchEvent;
877 Integration::HoverEvent hoverEvent;
878 Integration::Point point = GeneratePoint(1, PointState::INTERRUPTED, 100.0f, 100.0f);
880 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
881 DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
882 DALI_TEST_EQUALS(touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
883 DALI_TEST_EQUALS(hoverEvent.GetPointCount(), 1u, TEST_LOCATION);
884 DALI_TEST_EQUALS(hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION);
887 // Send up, should not be able to send as combiner has been reset.
890 Integration::TouchEvent touchEvent;
891 Integration::HoverEvent hoverEvent;
892 Integration::Point point = GeneratePoint(1, PointState::UP, 100.0f, 100.0f);
894 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);
899 int UtcDaliTouchEventCombinerInvalidState(void)
901 TouchEventCombiner combiner;
902 unsigned long time(0u);
906 Integration::TouchEvent touchEvent;
907 Integration::HoverEvent hoverEvent;
908 Integration::Point point = GeneratePoint(1, PointState::STATIONARY, 100.0f, 100.0f);
910 DALI_TEST_EQUALS(Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent(point, time, touchEvent, hoverEvent), TEST_LOCATION);