diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-08-16 08:46:00 +0200 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-08-21 07:50:46 +0200 |
commit | 3ce3b3d48ca8aa34ef8100d3dadb7cb5405e6667 (patch) | |
tree | 6e3e2598b2170926fa3037806ebe6f27456602c0 /src/tests | |
parent | 2dfc69397bb159cbd55c82ac5f8683be8726c267 (diff) |
introduce group item
this brings a group item in the style of genlist / gengrid group items.
The group item theme does currently not provide the signals in the theme
that would be needed for selecting it. This is kind of intended, but we
might need API to express that.
ref T8115
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D9583
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/elementary/spec/efl_test_container.c | 15 | ||||
-rw-r--r-- | src/tests/elementary/spec/efl_test_pack.c | 6 | ||||
-rw-r--r-- | src/tests/elementary/spec/efl_test_pack_linear.c | 47 | ||||
-rw-r--r-- | src/tests/elementary/spec/efl_ui_spec_suite.h | 1 |
4 files changed, 49 insertions, 20 deletions
diff --git a/src/tests/elementary/spec/efl_test_container.c b/src/tests/elementary/spec/efl_test_container.c index ecef9b1740..a78390dc03 100644 --- a/src/tests/elementary/spec/efl_test_container.c +++ b/src/tests/elementary/spec/efl_test_container.c | |||
@@ -6,6 +6,21 @@ | |||
6 | #include "efl_ui_spec_suite.h" | 6 | #include "efl_ui_spec_suite.h" |
7 | #include "suite_helpers.h" | 7 | #include "suite_helpers.h" |
8 | 8 | ||
9 | |||
10 | Efl_Ui_Widget* | ||
11 | efl_test_parent_get(Eo *obj) | ||
12 | { | ||
13 | if (efl_isa(widget, EFL_UI_GROUP_ITEM_CLASS)) | ||
14 | { | ||
15 | return efl_ui_item_parent_get(obj); | ||
16 | } | ||
17 | else | ||
18 | { | ||
19 | return efl_ui_widget_parent_get(obj); | ||
20 | } | ||
21 | } | ||
22 | |||
23 | |||
9 | void | 24 | void |
10 | efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len) | 25 | efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len) |
11 | { | 26 | { |
diff --git a/src/tests/elementary/spec/efl_test_pack.c b/src/tests/elementary/spec/efl_test_pack.c index ab3b19615c..9ecc356610 100644 --- a/src/tests/elementary/spec/efl_test_pack.c +++ b/src/tests/elementary/spec/efl_test_pack.c | |||
@@ -137,7 +137,7 @@ EFL_START_TEST(unpack1) | |||
137 | _setup_std_pack(wid); | 137 | _setup_std_pack(wid); |
138 | 138 | ||
139 | ck_assert_int_eq(efl_pack_unpack(widget, wid[2]), EINA_TRUE); | 139 | ck_assert_int_eq(efl_pack_unpack(widget, wid[2]), EINA_TRUE); |
140 | ck_assert_ptr_ne(efl_ui_widget_parent_get(wid[2]), widget); | 140 | ck_assert_ptr_ne(efl_test_parent_get(wid[2]), widget); |
141 | ck_assert_int_eq(efl_ref_count(wid[2]), 1); | 141 | ck_assert_int_eq(efl_ref_count(wid[2]), 1); |
142 | efl_test_container_content_equal(wid, 2); | 142 | efl_test_container_content_equal(wid, 2); |
143 | } | 143 | } |
@@ -198,7 +198,7 @@ EFL_START_TEST(pack1) | |||
198 | for (i = 0; i < sizeof(wid)/sizeof(Efl_Ui_Widget*); ++i) | 198 | for (i = 0; i < sizeof(wid)/sizeof(Efl_Ui_Widget*); ++i) |
199 | { | 199 | { |
200 | ck_assert_int_eq(efl_ref_count(wid[i]), 1); | 200 | ck_assert_int_eq(efl_ref_count(wid[i]), 1); |
201 | ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget); | 201 | ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); |
202 | } | 202 | } |
203 | 203 | ||
204 | efl_test_container_content_equal(wid, 3); | 204 | efl_test_container_content_equal(wid, 3); |
@@ -292,6 +292,7 @@ EFL_END_TEST | |||
292 | void | 292 | void |
293 | efl_pack_behavior_test(TCase *tc) | 293 | efl_pack_behavior_test(TCase *tc) |
294 | { | 294 | { |
295 | tcase_add_test(tc, pack2); | ||
295 | tcase_add_test(tc, base2); | 296 | tcase_add_test(tc, base2); |
296 | tcase_add_test(tc, pack_clear1); | 297 | tcase_add_test(tc, pack_clear1); |
297 | tcase_add_test(tc, pack_clear2); | 298 | tcase_add_test(tc, pack_clear2); |
@@ -301,7 +302,6 @@ efl_pack_behavior_test(TCase *tc) | |||
301 | tcase_add_test(tc, unpack2); | 302 | tcase_add_test(tc, unpack2); |
302 | tcase_add_test(tc, unpack3); | 303 | tcase_add_test(tc, unpack3); |
303 | tcase_add_test(tc, pack1); | 304 | tcase_add_test(tc, pack1); |
304 | tcase_add_test(tc, pack2); | ||
305 | tcase_add_test(tc, pack3); | 305 | tcase_add_test(tc, pack3); |
306 | tcase_add_test(tc, evt_content_added); | 306 | tcase_add_test(tc, evt_content_added); |
307 | tcase_add_test(tc, evt_content_removed); | 307 | tcase_add_test(tc, evt_content_removed); |
diff --git a/src/tests/elementary/spec/efl_test_pack_linear.c b/src/tests/elementary/spec/efl_test_pack_linear.c index 71746eaeee..eed26e6b5f 100644 --- a/src/tests/elementary/spec/efl_test_pack_linear.c +++ b/src/tests/elementary/spec/efl_test_pack_linear.c | |||
@@ -9,10 +9,11 @@ | |||
9 | 9 | ||
10 | /* spec-meta-start | 10 | /* spec-meta-start |
11 | {"test-interface":"Efl.Pack_Linear", | 11 | {"test-interface":"Efl.Pack_Linear", |
12 | "test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Spotlight.Container", "Efl.Ui.List"], | 12 | "test-widgets": ["Efl.Ui.Box", "Efl.Ui.Grid", "Efl.Ui.Spotlight.Container", "Efl.Ui.List", "Efl.Ui.Group_Item" ], |
13 | "custom-mapping" : { | 13 | "custom-mapping" : { |
14 | "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS", | 14 | "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS", |
15 | "Efl.Ui.List" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS" | 15 | "Efl.Ui.List" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS", |
16 | "Efl.Ui.Group_Item" : "EFL_UI_LIST_DEFAULT_ITEM_CLASS" | ||
16 | } | 17 | } |
17 | } | 18 | } |
18 | spec-meta-end */ | 19 | spec-meta-end */ |
@@ -46,7 +47,7 @@ EFL_START_TEST(pack_begin1) | |||
46 | for (int i = 2; i >= 0; i--) | 47 | for (int i = 2; i >= 0; i--) |
47 | { | 48 | { |
48 | efl_pack_begin(widget, wid[i]); | 49 | efl_pack_begin(widget, wid[i]); |
49 | ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget); | 50 | ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); |
50 | } | 51 | } |
51 | _ordering_equals(wid, 3); | 52 | _ordering_equals(wid, 3); |
52 | efl_pack_begin(widget, inv); | 53 | efl_pack_begin(widget, inv); |
@@ -65,7 +66,7 @@ EFL_START_TEST(pack_begin2) | |||
65 | for (int i = 2; i >= 0; i--) | 66 | for (int i = 2; i >= 0; i--) |
66 | { | 67 | { |
67 | efl_pack_begin(widget, wid[i]); | 68 | efl_pack_begin(widget, wid[i]); |
68 | ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget); | 69 | ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); |
69 | } | 70 | } |
70 | 71 | ||
71 | EXPECT_ERROR_START; | 72 | EXPECT_ERROR_START; |
@@ -85,7 +86,7 @@ EFL_START_TEST(pack_end1) | |||
85 | for (int i = 0; i < 3; i++) | 86 | for (int i = 0; i < 3; i++) |
86 | { | 87 | { |
87 | efl_pack_end(widget, wid[i]); | 88 | efl_pack_end(widget, wid[i]); |
88 | ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget); | 89 | ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); |
89 | } | 90 | } |
90 | 91 | ||
91 | _ordering_equals(wid, 3); | 92 | _ordering_equals(wid, 3); |
@@ -105,7 +106,7 @@ EFL_START_TEST(pack_end2) | |||
105 | for (int i = 0; i < 3; i++) | 106 | for (int i = 0; i < 3; i++) |
106 | { | 107 | { |
107 | efl_pack_end(widget, wid[i]); | 108 | efl_pack_end(widget, wid[i]); |
108 | ck_assert_ptr_eq(efl_ui_widget_parent_get(wid[i]), widget); | 109 | ck_assert_ptr_eq(efl_test_parent_get(wid[i]), widget); |
109 | } | 110 | } |
110 | 111 | ||
111 | EXPECT_ERROR_START; | 112 | EXPECT_ERROR_START; |
@@ -126,13 +127,13 @@ EFL_START_TEST(pack_before1) | |||
126 | efl_pack_end(widget, wid[i]); | 127 | efl_pack_end(widget, wid[i]); |
127 | 128 | ||
128 | ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE); | 129 | ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE); |
129 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 130 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
130 | Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]}; | 131 | Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]}; |
131 | _ordering_equals(wid2, 4); | 132 | _ordering_equals(wid2, 4); |
132 | efl_pack_unpack(widget, inv); | 133 | efl_pack_unpack(widget, inv); |
133 | 134 | ||
134 | ck_assert_int_eq(efl_pack_before(widget, inv, wid[2]), EINA_TRUE); | 135 | ck_assert_int_eq(efl_pack_before(widget, inv, wid[2]), EINA_TRUE); |
135 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 136 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
136 | Efl_Ui_Widget *wid3[] = {wid[0], wid[1], inv, wid[2]}; | 137 | Efl_Ui_Widget *wid3[] = {wid[0], wid[1], inv, wid[2]}; |
137 | _ordering_equals(wid3, 4); | 138 | _ordering_equals(wid3, 4); |
138 | } | 139 | } |
@@ -149,7 +150,7 @@ EFL_START_TEST(pack_before2) | |||
149 | efl_pack_end(widget, wid[i]); | 150 | efl_pack_end(widget, wid[i]); |
150 | 151 | ||
151 | ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE); | 152 | ck_assert_int_eq(efl_pack_before(widget, inv, wid[0]), EINA_TRUE); |
152 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 153 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
153 | Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]}; | 154 | Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2]}; |
154 | _ordering_equals(wid2, 4); | 155 | _ordering_equals(wid2, 4); |
155 | 156 | ||
@@ -170,13 +171,13 @@ EFL_START_TEST(pack_after1) | |||
170 | efl_pack_end(widget, wid[i]); | 171 | efl_pack_end(widget, wid[i]); |
171 | 172 | ||
172 | ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE); | 173 | ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE); |
173 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 174 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
174 | Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]}; | 175 | Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]}; |
175 | _ordering_equals(wid2, 4); | 176 | _ordering_equals(wid2, 4); |
176 | efl_pack_unpack(widget, inv); | 177 | efl_pack_unpack(widget, inv); |
177 | 178 | ||
178 | ck_assert_int_eq(efl_pack_after(widget, inv, wid[2]), EINA_TRUE); | 179 | ck_assert_int_eq(efl_pack_after(widget, inv, wid[2]), EINA_TRUE); |
179 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 180 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
180 | Efl_Ui_Widget *wid3[] = {wid[0], wid[1], wid[2], inv}; | 181 | Efl_Ui_Widget *wid3[] = {wid[0], wid[1], wid[2], inv}; |
181 | _ordering_equals(wid3, 4); | 182 | _ordering_equals(wid3, 4); |
182 | } | 183 | } |
@@ -193,7 +194,7 @@ EFL_START_TEST(pack_after2) | |||
193 | efl_pack_end(widget, wid[i]); | 194 | efl_pack_end(widget, wid[i]); |
194 | 195 | ||
195 | ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE); | 196 | ck_assert_int_eq(efl_pack_after(widget, inv, wid[0]), EINA_TRUE); |
196 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 197 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
197 | Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]}; | 198 | Efl_Ui_Widget *wid2[] = {wid[0], inv, wid[1], wid[2]}; |
198 | _ordering_equals(wid2, 4); | 199 | _ordering_equals(wid2, 4); |
199 | 200 | ||
@@ -216,7 +217,7 @@ EFL_START_TEST(pack_at1) | |||
216 | efl_pack_end(widget, wid[i]); | 217 | efl_pack_end(widget, wid[i]); |
217 | 218 | ||
218 | efl_pack_at(widget, inv, x); | 219 | efl_pack_at(widget, inv, x); |
219 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 220 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
220 | 221 | ||
221 | for (i = 0; i < 4; ++i) | 222 | for (i = 0; i < 4; ++i) |
222 | { | 223 | { |
@@ -247,7 +248,7 @@ EFL_START_TEST(pack_at2) | |||
247 | efl_pack_end(widget, wid[i]); | 248 | efl_pack_end(widget, wid[i]); |
248 | 249 | ||
249 | ck_assert_int_eq(efl_pack_at(widget, inv, x), EINA_TRUE); | 250 | ck_assert_int_eq(efl_pack_at(widget, inv, x), EINA_TRUE); |
250 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 251 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
251 | 252 | ||
252 | EXPECT_ERROR_START; | 253 | EXPECT_ERROR_START; |
253 | ck_assert_int_eq(efl_pack_at(widget, inv, x - 1), EINA_FALSE); | 254 | ck_assert_int_eq(efl_pack_at(widget, inv, x - 1), EINA_FALSE); |
@@ -281,9 +282,9 @@ EFL_START_TEST(pack_at3) | |||
281 | efl_pack_end(widget, wid[i]); | 282 | efl_pack_end(widget, wid[i]); |
282 | 283 | ||
283 | ck_assert_int_eq(efl_pack_at(widget, inv,-100000), EINA_TRUE); | 284 | ck_assert_int_eq(efl_pack_at(widget, inv,-100000), EINA_TRUE); |
284 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv), widget); | 285 | ck_assert_ptr_eq(efl_test_parent_get(inv), widget); |
285 | ck_assert_int_eq(efl_pack_at(widget, inv2, 100000), EINA_TRUE); | 286 | ck_assert_int_eq(efl_pack_at(widget, inv2, 100000), EINA_TRUE); |
286 | ck_assert_ptr_eq(efl_ui_widget_parent_get(inv2), widget); | 287 | ck_assert_ptr_eq(efl_test_parent_get(inv2), widget); |
287 | Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2], inv2}; | 288 | Efl_Ui_Widget *wid2[] = {inv, wid[0], wid[1], wid[2], inv2}; |
288 | _ordering_equals(wid2, 5); | 289 | _ordering_equals(wid2, 5); |
289 | } | 290 | } |
@@ -377,15 +378,27 @@ EFL_START_TEST(pack_unpack_at3) | |||
377 | efl_pack_end(widget, wid[i]); | 378 | efl_pack_end(widget, wid[i]); |
378 | ck_assert_ptr_eq(efl_pack_unpack_at(widget, x), wid[(3+x)%3]); | 379 | ck_assert_ptr_eq(efl_pack_unpack_at(widget, x), wid[(3+x)%3]); |
379 | ck_assert_int_eq(efl_content_count(widget), 2); | 380 | ck_assert_int_eq(efl_content_count(widget), 2); |
380 | ck_assert_ptr_ne(efl_ui_widget_parent_get(wid[(3+x)%3]), widget); | 381 | ck_assert_ptr_ne(efl_test_parent_get(wid[(3+x)%3]), widget); |
381 | efl_pack_unpack_all(widget); | 382 | efl_pack_unpack_all(widget); |
382 | } | 383 | } |
383 | } | 384 | } |
384 | EFL_END_TEST | 385 | EFL_END_TEST |
385 | 386 | ||
386 | void | 387 | void |
388 | object_setup(void) | ||
389 | { | ||
390 | if (efl_isa(widget, EFL_UI_GROUP_ITEM_CLASS)) | ||
391 | { | ||
392 | Efl_Ui_Collection *collection = efl_add(EFL_UI_GRID_CLASS, win); | ||
393 | efl_content_set(win, collection); | ||
394 | efl_pack_end(collection, widget); | ||
395 | } | ||
396 | } | ||
397 | |||
398 | void | ||
387 | efl_pack_linear_behavior_test(TCase *tc) | 399 | efl_pack_linear_behavior_test(TCase *tc) |
388 | { | 400 | { |
401 | tcase_add_checked_fixture(tc, object_setup, NULL); | ||
389 | tcase_add_test(tc, pack_begin1); | 402 | tcase_add_test(tc, pack_begin1); |
390 | tcase_add_test(tc, pack_begin2); | 403 | tcase_add_test(tc, pack_begin2); |
391 | tcase_add_test(tc, pack_end1); | 404 | tcase_add_test(tc, pack_end1); |
diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.h b/src/tests/elementary/spec/efl_ui_spec_suite.h index a4bceeaf54..009e4e0ec5 100644 --- a/src/tests/elementary/spec/efl_ui_spec_suite.h +++ b/src/tests/elementary/spec/efl_ui_spec_suite.h | |||
@@ -25,6 +25,7 @@ void efl_ui_selectable_behavior_test(TCase *tc); | |||
25 | 25 | ||
26 | void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len); | 26 | void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len); |
27 | void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data); | 27 | void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data); |
28 | Efl_Ui_Widget* efl_test_parent_get(Eo *obj); | ||
28 | 29 | ||
29 | Eo* create_test_widget(void); | 30 | Eo* create_test_widget(void); |
30 | 31 | ||