summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-20 13:48:14 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-03-03 10:54:38 +0100
commit6d9f8416e7237134d0092ce740135de6c3df4ed6 (patch)
treefe6a3653d909396471fd12474f5a5fa702597f15
parent6aa9299cc9a55d3cfdb7a9b4dd0caf0739c32923 (diff)
tests/gesture: add a couple rotate gesture tests
these end up triggering a lot of corner cases in other recognizers too, but the tests themselves are fairly minimal Differential Revision: https://phab.enlightenment.org/D11391
-rw-r--r--src/tests/elementary/efl_ui_test_gesture.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/tests/elementary/efl_ui_test_gesture.c b/src/tests/elementary/efl_ui_test_gesture.c
index 4d96297c9e..fccbdd62fb 100644
--- a/src/tests/elementary/efl_ui_test_gesture.c
+++ b/src/tests/elementary/efl_ui_test_gesture.c
@@ -559,6 +559,71 @@ EFL_START_TEST(test_efl_ui_gesture_zoom)
559} 559}
560EFL_END_TEST 560EFL_END_TEST
561 561
562EFL_START_TEST(test_efl_ui_gesture_rotate)
563{
564 Eo *rect = setup();
565 int moves, momentum_moves;
566
567 multi_press_object(rect, 1);
568 CHECK_ALL(TAP, 1, 0, 0, 0);
569 CHECK_ALL(LONG_PRESS, 1, 0, 0, 0);
570 CHECK_ALL(DOUBLE_TAP, 1, 0, 0, 0);
571 CHECK_ALL(TRIPLE_TAP, 1, 0, 0, 0);
572
573 CHECK_ZERO(MOMENTUM);
574 CHECK_ZERO(FLICK);
575 CHECK_ZERO(ROTATE);
576 CHECK_ZERO(ZOOM);
577
578 RESET;
579
580
581 moves = multi_drag_object_around(rect, 1, 500, 500, 250, 180);
582 CHECK_ALL(TAP, 0, 0, 0, 1);
583 CHECK_ALL(LONG_PRESS, 0, 0, 0, 1);
584 CHECK_ALL(DOUBLE_TAP, 0, 0, 0, 1);
585 CHECK_ALL(TRIPLE_TAP, 0, 0, 0, 1);
586
587 CHECK_START(MOMENTUM, 1);
588 momentum_moves = count[MOMENTUM][EFL_GESTURE_STATE_UPDATED - 1];
589 ck_assert_int_ge(count[MOMENTUM][EFL_GESTURE_STATE_UPDATED - 1], moves - 5);
590 CHECK_FINISH(MOMENTUM, 1);
591 CHECK_CANCEL(MOMENTUM, 0);
592
593 /* flick is just going to do flick stuff here, so don't even bother checking much */
594 CHECK_FINISH(FLICK, 0);
595
596 CHECK_ALL(ROTATE, 1, moves - 1, 1, 0);
597 CHECK_ALL(ZOOM, 1, 0, 0, 1);
598
599 RESET;
600
601 /* verify identical motion in reverse */
602 moves = multi_drag_object_around(rect, 1, 500, 500, 250, -180);
603 /* already occurred, first finger still down */
604 CHECK_ZERO(TAP);
605 /* already canceled, first finger still down */
606 CHECK_ZERO(LONG_PRESS);
607 CHECK_ZERO(DOUBLE_TAP);
608 CHECK_ZERO(TRIPLE_TAP);
609
610 /* continuing gesture, counts as already started */
611 CHECK_START(MOMENTUM, 0);
612 /* should be exactly 1 more than previous time */
613 CHECK_UPDATE(MOMENTUM, momentum_moves + 1);
614 CHECK_FINISH(MOMENTUM, 1);
615 CHECK_CANCEL(MOMENTUM, 0);
616
617 /* flick is just going to do flick stuff here, so don't even bother checking much */
618 CHECK_FINISH(FLICK, 0);
619
620 /* continuing gesture, counts as already started, increment update counter */
621 CHECK_ALL(ROTATE, 0, (moves - 1) + 1, 1, 0);
622 CHECK_ALL(ZOOM, 0, 1, 0, 1);
623
624}
625EFL_END_TEST
626
562static void 627static void
563custom_cb(void *data EINA_UNUSED , const Efl_Event *ev) 628custom_cb(void *data EINA_UNUSED , const Efl_Event *ev)
564{ 629{
@@ -658,5 +723,6 @@ void efl_ui_test_gesture(TCase *tc)
658 tcase_add_test(tc, test_efl_ui_gesture_long_press); 723 tcase_add_test(tc, test_efl_ui_gesture_long_press);
659 tcase_add_test(tc, test_efl_ui_gesture_flick); 724 tcase_add_test(tc, test_efl_ui_gesture_flick);
660 tcase_add_test(tc, test_efl_ui_gesture_zoom); 725 tcase_add_test(tc, test_efl_ui_gesture_zoom);
726 tcase_add_test(tc, test_efl_ui_gesture_rotate);
661 tcase_add_test(tc, test_efl_ui_gesture_custom); 727 tcase_add_test(tc, test_efl_ui_gesture_custom);
662} 728}