summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-05 19:07:29 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-05 19:49:13 +0200
commit1bd9a8f232ec1891cc396d13d7106aa7c255d78e (patch)
tree5dd46a9b1a892eb2ceb718a3fd414dc3fd937491 /src/tests
parentfc12e7721fd2ea2b39f9a732522e744d43a66840 (diff)
introduce a new interface efl_ui_selectable
this is meant to be implemented by entities that *can* be selectabled (not to be confused with containers that can have selected contents)! ref T8057 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9503
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/efl_ui_test_collection_common.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/tests/elementary/efl_ui_test_collection_common.c b/src/tests/elementary/efl_ui_test_collection_common.c
index c41946afbe..746b86d938 100644
--- a/src/tests/elementary/efl_ui_test_collection_common.c
+++ b/src/tests/elementary/efl_ui_test_collection_common.c
@@ -55,25 +55,25 @@ EFL_START_TEST(test_multi_select)
55 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected); 55 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected);
56 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS); 56 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS);
57 57
58 efl_ui_item_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE); 58 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE);
59 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 0)); 59 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 0));
60 ck_assert_ptr_eq(unselected, NULL); 60 ck_assert_ptr_eq(unselected, NULL);
61 selected = NULL; 61 selected = NULL;
62 unselected = NULL; 62 unselected = NULL;
63 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 63 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
64 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2)); 64 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2));
65 ck_assert_ptr_eq(unselected, NULL); 65 ck_assert_ptr_eq(unselected, NULL);
66 selected = NULL; 66 selected = NULL;
67 unselected = NULL; 67 unselected = NULL;
68 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 0)), EINA_TRUE); 68 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 0)), EINA_TRUE);
69 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 2)), EINA_TRUE); 69 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 2)), EINA_TRUE);
70 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), efl_pack_content_get(item_container, 2)); 70 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), efl_pack_content_get(item_container, 2));
71 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container)); 71 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container));
72 ck_assert_int_eq(eina_array_count(arr_selected), 2); 72 ck_assert_int_eq(eina_array_count(arr_selected), 2);
73 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(item_container, 0)); 73 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(item_container, 0));
74 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(item_container, 2)); 74 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(item_container, 2));
75 75
76 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 76 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
77 ck_assert_ptr_eq(selected, NULL); 77 ck_assert_ptr_eq(selected, NULL);
78 ck_assert_ptr_eq(unselected, NULL); 78 ck_assert_ptr_eq(unselected, NULL);
79 selected = NULL; 79 selected = NULL;
@@ -93,17 +93,17 @@ EFL_START_TEST(test_multi_select_removal)
93 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected); 93 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected);
94 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS); 94 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS);
95 95
96 efl_ui_item_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE); 96 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE);
97 selected = NULL;//No need to ckeck the flag, we asserted in the tcase before 97 selected = NULL;//No need to ckeck the flag, we asserted in the tcase before
98 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 98 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
99 selected = NULL;//No need to ckeck the flag, we asserted in the tcase before 99 selected = NULL;//No need to ckeck the flag, we asserted in the tcase before
100 unselected = NULL; 100 unselected = NULL;
101 efl_ui_item_selected_set(efl_pack_content_get(item_container, 0), EINA_FALSE); 101 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 0), EINA_FALSE);
102 ck_assert_ptr_eq(selected, NULL); 102 ck_assert_ptr_eq(selected, NULL);
103 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 0)); 103 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 0));
104 selected = NULL; 104 selected = NULL;
105 unselected = NULL; 105 unselected = NULL;
106 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_FALSE); 106 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_FALSE);
107 ck_assert_ptr_eq(selected, NULL); 107 ck_assert_ptr_eq(selected, NULL);
108 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 2)); 108 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 2));
109 selected = NULL; 109 selected = NULL;
@@ -128,24 +128,24 @@ EFL_START_TEST(test_single_select)
128 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected); 128 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected);
129 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS); 129 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS);
130 130
131 efl_ui_item_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE); 131 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE);
132 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 0)); 132 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 0));
133 ck_assert_ptr_eq(unselected, NULL); 133 ck_assert_ptr_eq(unselected, NULL);
134 selected = NULL; 134 selected = NULL;
135 unselected = NULL; 135 unselected = NULL;
136 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 136 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
137 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2)); 137 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2));
138 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 0)); 138 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 0));
139 selected = NULL; 139 selected = NULL;
140 unselected = NULL; 140 unselected = NULL;
141 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 0)), EINA_FALSE); 141 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 0)), EINA_FALSE);
142 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 2)), EINA_TRUE); 142 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 2)), EINA_TRUE);
143 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), efl_pack_content_get(item_container, 2)); 143 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), efl_pack_content_get(item_container, 2));
144 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container)); 144 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container));
145 ck_assert_int_eq(eina_array_count(arr_selected), 1); 145 ck_assert_int_eq(eina_array_count(arr_selected), 1);
146 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(item_container, 2)); 146 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(item_container, 2));
147 147
148 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 148 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
149 ck_assert_ptr_eq(selected, NULL); 149 ck_assert_ptr_eq(selected, NULL);
150 ck_assert_ptr_eq(unselected, NULL); 150 ck_assert_ptr_eq(unselected, NULL);
151 selected = NULL; 151 selected = NULL;
@@ -166,23 +166,23 @@ EFL_START_TEST(test_single_select_always)
166 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected); 166 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected);
167 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS); 167 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS);
168 168
169 efl_ui_item_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE); 169 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE);
170 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 0)); 170 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 0));
171 ck_assert_ptr_eq(unselected, NULL); 171 ck_assert_ptr_eq(unselected, NULL);
172 selected = NULL; 172 selected = NULL;
173 unselected = NULL; 173 unselected = NULL;
174 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 174 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
175 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2)); 175 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2));
176 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 0)); 176 ck_assert_ptr_eq(unselected, efl_pack_content_get(item_container, 0));
177 selected = NULL; 177 selected = NULL;
178 unselected = NULL; 178 unselected = NULL;
179 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 179 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
180 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2)); 180 ck_assert_ptr_eq(selected, efl_pack_content_get(item_container, 2));
181 ck_assert_ptr_eq(unselected, NULL); 181 ck_assert_ptr_eq(unselected, NULL);
182 selected = NULL; 182 selected = NULL;
183 unselected = NULL; 183 unselected = NULL;
184 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 0)), EINA_FALSE); 184 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 0)), EINA_FALSE);
185 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 2)), EINA_TRUE); 185 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 2)), EINA_TRUE);
186 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), efl_pack_content_get(item_container, 2)); 186 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), efl_pack_content_get(item_container, 2));
187 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container)); 187 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container));
188 ck_assert_int_eq(eina_array_count(arr_selected), 1); 188 ck_assert_int_eq(eina_array_count(arr_selected), 1);
@@ -203,18 +203,18 @@ EFL_START_TEST(test_none_select)
203 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected); 203 efl_event_callback_add(item_container, EFL_UI_EVENT_ITEM_UNSELECTED, _set_pointer_quit, &unselected);
204 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS); 204 fill_items(EFL_UI_LIST_DEFAULT_ITEM_CLASS);
205 205
206 efl_ui_item_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE); 206 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 0), EINA_TRUE);
207 ck_assert_ptr_eq(selected, NULL); 207 ck_assert_ptr_eq(selected, NULL);
208 ck_assert_ptr_eq(unselected, NULL); 208 ck_assert_ptr_eq(unselected, NULL);
209 selected = NULL; 209 selected = NULL;
210 unselected = NULL; 210 unselected = NULL;
211 efl_ui_item_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE); 211 efl_ui_selectable_selected_set(efl_pack_content_get(item_container, 2), EINA_TRUE);
212 ck_assert_ptr_eq(selected, NULL); 212 ck_assert_ptr_eq(selected, NULL);
213 ck_assert_ptr_eq(unselected, NULL); 213 ck_assert_ptr_eq(unselected, NULL);
214 selected = NULL; 214 selected = NULL;
215 unselected = NULL; 215 unselected = NULL;
216 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 0)), EINA_FALSE); 216 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 0)), EINA_FALSE);
217 ck_assert_int_eq(efl_ui_item_selected_get(efl_pack_content_get(item_container, 2)), EINA_FALSE); 217 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(item_container, 2)), EINA_FALSE);
218 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), NULL); 218 ck_assert_ptr_eq(efl_ui_collection_last_selected_item_get(item_container), NULL);
219 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container)); 219 _iterator_to_array(&arr_selected, efl_ui_collection_selected_items_get(item_container));
220 ck_assert_int_eq(eina_array_count(arr_selected), 0); 220 ck_assert_int_eq(eina_array_count(arr_selected), 0);