summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-18 17:42:28 +0200
committerCedric Bail <cedric.bail@free.fr>2019-09-19 14:37:27 -0700
commit422154c0de048da021f3dd1909802b1529c98708 (patch)
tree48abd4c1debb48056cc4aabb02284e0a924e49e9 /src/tests
parent6960751c4580af9e902cd7719c1acafab4ce7bc5 (diff)
efl_test_multi_selectable: test for the correct event
EFL_UI_EVENT_ITEM_SELECTED / UNSELECTED is the wrong event here. We should check of the selection changed event. ITEM_SELECTED is the legacy event. this was not found based on the fact that we test for this event to NOT be executed. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10011
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/spec/efl_test_multi_selectable.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/tests/elementary/spec/efl_test_multi_selectable.c b/src/tests/elementary/spec/efl_test_multi_selectable.c
index 770c10e5bb..a2606a13b8 100644
--- a/src/tests/elementary/spec/efl_test_multi_selectable.c
+++ b/src/tests/elementary/spec/efl_test_multi_selectable.c
@@ -18,15 +18,6 @@
18 spec-meta-end */ 18 spec-meta-end */
19 19
20static void 20static void
21_set_pointer_quit(void *data, const Efl_Event *ev)
22{
23 Efl_Ui_Item **b = data;
24
25 ck_assert_ptr_eq(*b, NULL);
26 *b = ev->info;
27}
28
29static void
30_iterator_to_array(Eina_Array **arr, Eina_Iterator *iter) 21_iterator_to_array(Eina_Array **arr, Eina_Iterator *iter)
31{ 22{
32 Efl_Ui_Widget *widget; 23 Efl_Ui_Widget *widget;
@@ -137,31 +128,26 @@ EFL_END_TEST
137 128
138EFL_START_TEST(test_none_select) 129EFL_START_TEST(test_none_select)
139{ 130{
140 Efl_Ui_Item *selected = NULL;
141 Efl_Ui_Item *unselected = NULL;
142 Eina_Array *arr_selected; 131 Eina_Array *arr_selected;
132 int c = 0;
143 133
144 efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); 134 efl_ui_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE);
145 efl_event_callback_add(widget, EFL_UI_EVENT_ITEM_SELECTED, _set_pointer_quit, &selected); 135 efl_event_callback_add(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
146 efl_event_callback_add(widget, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected); 136 efl_event_callback_add(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
147 137
148 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE); 138 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE);
149 ck_assert_ptr_eq(selected, NULL); 139 get_me_to_those_events(widget);
150 ck_assert_ptr_eq(unselected, NULL); 140 ck_assert_int_eq(c, 0);
151 selected = NULL;
152 unselected = NULL;
153 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 2), EINA_TRUE); 141 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 2), EINA_TRUE);
154 ck_assert_ptr_eq(selected, NULL); 142 get_me_to_those_events(widget);
155 ck_assert_ptr_eq(unselected, NULL); 143 ck_assert_int_eq(c, 0);
156 selected = NULL;
157 unselected = NULL;
158 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); 144 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE);
159 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE); 145 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE);
160 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL); 146 ck_assert_ptr_eq(efl_ui_single_selectable_last_selected_get(widget), NULL);
161 _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget)); 147 _iterator_to_array(&arr_selected, efl_ui_selected_items_get(widget));
162 ck_assert_int_eq(eina_array_count(arr_selected), 0); 148 ck_assert_int_eq(eina_array_count(arr_selected), 0);
163 efl_event_callback_del(widget, EFL_UI_EVENT_ITEM_SELECTED, _set_pointer_quit, &selected); 149 efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
164 efl_event_callback_del(widget, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected); 150 efl_event_callback_del(widget, EFL_UI_SINGLE_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
165} 151}
166EFL_END_TEST 152EFL_END_TEST
167 153