summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-03-31 12:58:47 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-04-03 17:13:52 +0200
commit5565e904795ce32ba734a3022f01753acb1dd738 (patch)
treed6be72e4f19a22225e687aef63c8704419089c04
parent6f933e01c708341e09ad6803925dc8e04765a418 (diff)
tests/hover: add behavior tests for elm_hover
verify geometry and smart callback triggering Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11632
-rw-r--r--src/tests/elementary/elm_test_hover.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_hover.c b/src/tests/elementary/elm_test_hover.c
index de275216f2..323eb5c8d6 100644
--- a/src/tests/elementary/elm_test_hover.c
+++ b/src/tests/elementary/elm_test_hover.c
@@ -41,8 +41,56 @@ EFL_START_TEST(elm_atspi_role_get)
41} 41}
42EFL_END_TEST 42EFL_END_TEST
43 43
44EFL_START_TEST(elm_test_hover_behavior)
45{
46 Evas_Object *win, *hover, *target, *rect;
47 int count = 0;
48 int count_dismiss = 0;
49 int count_clicked = 0;
50
51 win = win_add(NULL, "hover", ELM_WIN_BASIC);
52 evas_object_resize(win, 100, 100);
53
54 hover = elm_hover_add(win);
55 evas_object_smart_callback_add(hover, "smart,changed", event_callback_that_increments_an_int_when_called, &count);
56 evas_object_smart_callback_add(hover, "dismissed", event_callback_single_call_int_data, &count_dismiss);
57 evas_object_smart_callback_add(hover, "clicked", event_callback_single_call_int_data, &count_clicked);
58
59 target = elm_box_add(win);
60
61 elm_hover_parent_set(hover, win);
62 elm_hover_target_set(hover, target);
63
64 rect = evas_object_rectangle_add(evas_object_evas_get(win));
65 evas_object_size_hint_min_set(rect, 20, 20);
66 evas_object_show(rect);
67 elm_object_part_content_set(hover, "smart", rect);
68
69 evas_object_move(target, 40, 40);
70 evas_object_show(win);
71 evas_object_show(hover);
72 get_me_to_those_events(hover);
73
74 /* 1 from setting content, 1 from moving target object */
75 ck_assert_int_eq(count, 2);
76
77 assert_object_size_eq(rect, 20, 20);
78 assert_object_size_eq(hover, 0, 0);
79 assert_object_pos_eq(hover, 40, 40);
80 /* using non-centered slot */
81 assert_object_pos_eq(rect, 40, 30);
82
83 elm_hover_dismiss(hover);
84 get_me_to_those_events(hover);
85 /* these are both triggered on dismiss */
86 ck_assert_int_eq(count_dismiss, 1);
87 ck_assert_int_eq(count_clicked, 1);
88}
89EFL_END_TEST
90
44void elm_test_hover(TCase *tc) 91void elm_test_hover(TCase *tc)
45{ 92{
46 tcase_add_test(tc, elm_hover_legacy_type_check); 93 tcase_add_test(tc, elm_hover_legacy_type_check);
47 tcase_add_test(tc, elm_atspi_role_get); 94 tcase_add_test(tc, elm_atspi_role_get);
95 tcase_add_test(tc, elm_test_hover_behavior);
48} 96}