summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongjong Lee <cleanlyj@naver.com>2019-03-08 13:18:05 +0900
committerHermet Park <hermetpark@gmail.com>2019-03-08 13:18:05 +0900
commit97416e99969897114ea8a95578d19500f9b7863f (patch)
tree3bd5a8cdd7eb577835f2eb860e064ebdb5e44cc0
parent88b4646ea7bbe003f337a0ea0536b11eccf3a3c5 (diff)
elm_gengrid: fix correct parent-child relation of item content
Summary: see 1b2401849a11c5826dead44b4839ca2acb1dbec1 that said `evas_object_smart_member_del` doesn't make sense here. I guess `_sub_object_del` should have been used when item_all_contents_unset is implemented. Item content should have widget(gengrid) as the parent. but that relationship is removed by c075b7caaac0c6cf8c1043312041afaf5. See also, `_item_content_realize` of genlist. Test Plan: make check Reviewers: Hermet, SanghyeonLee, bu5hm4n Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8238
-rw-r--r--src/lib/elementary/elm_gengrid.c3
-rw-r--r--src/tests/elementary/elm_test_gengrid.c51
-rw-r--r--src/tests/elementary/elm_test_genlist.c51
3 files changed, 104 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index c08e2f4807..d1851b184a 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -1108,6 +1108,7 @@ _item_content_realize(Elm_Gen_Item *it,
1108 _elm_widget_full_eval(content); 1108 _elm_widget_full_eval(content);
1109 } 1109 }
1110 1110
1111 elm_widget_sub_object_add(WIDGET(it), content);
1111 if (elm_wdg_item_disabled_get(EO_OBJ(it))) 1112 if (elm_wdg_item_disabled_get(EO_OBJ(it)))
1112 elm_widget_disabled_set(content, EINA_TRUE); 1113 elm_widget_disabled_set(content, EINA_TRUE);
1113 1114
@@ -1231,7 +1232,7 @@ _elm_gengrid_item_all_contents_unset(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it,
1231 1232
1232 EINA_LIST_FREE (it->contents, content) 1233 EINA_LIST_FREE (it->contents, content)
1233 { 1234 {
1234 evas_object_smart_member_del(content); 1235 _elm_widget_sub_object_redirect_to_top(WIDGET(it), content);
1235 // edje can be reused by item caching, 1236 // edje can be reused by item caching,
1236 // content should be un-swallowed from edje 1237 // content should be un-swallowed from edje
1237 edje_object_part_unswallow(VIEW(it), content); 1238 edje_object_part_unswallow(VIEW(it), content);
diff --git a/src/tests/elementary/elm_test_gengrid.c b/src/tests/elementary/elm_test_gengrid.c
index 87efc615c9..77a4eb46f7 100644
--- a/src/tests/elementary/elm_test_gengrid.c
+++ b/src/tests/elementary/elm_test_gengrid.c
@@ -153,11 +153,62 @@ EFL_START_TEST(elm_gengrid_focus)
153} 153}
154EFL_END_TEST 154EFL_END_TEST
155 155
156static void
157_gengrid_item_content_test_realize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
158{
159 ecore_main_loop_quit();
160}
161
162static Evas_Object *
163_item_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part EINA_UNUSED)
164{
165 Evas_Object *ic = elm_button_add(obj);
166 return ic;
167}
168
169EFL_START_TEST(elm_gengrid_item_content)
170{
171 Evas_Object *win, *gengrid;
172 Elm_Genlist_Item_Class *gtc;
173 Evas_Object *content, *parent;
174 Elm_Object_Item *it;
175
176 gtc = elm_gengrid_item_class_new();
177 gtc->item_style = "default";
178 gtc->func.content_get = _item_content_get;
179 gtc->func.state_get = NULL;
180 gtc->func.del = NULL;
181
182 win = win_add(NULL, "gengrid", ELM_WIN_BASIC);
183
184 gengrid = elm_gengrid_add(win);
185 evas_object_smart_callback_add(gengrid, "realized", _gengrid_item_content_test_realize, NULL);
186
187 it = elm_gengrid_item_append(gengrid, gtc, NULL, NULL, NULL);
188
189 evas_object_resize(gengrid, 100, 100);
190 evas_object_resize(win, 150, 150);
191 evas_object_show(gengrid);
192 evas_object_show(win);
193
194 ecore_main_loop_begin();
195
196 content = elm_object_item_part_content_get(it, "elm.swallow.end");
197 parent = elm_object_parent_widget_get(content);
198 ck_assert_ptr_eq(parent, gengrid);
199
200 elm_gengrid_item_all_contents_unset(it, NULL);
201 parent = elm_object_parent_widget_get(content);
202 ck_assert_ptr_eq(parent, win);
203}
204EFL_END_TEST
205
156void elm_test_gengrid(TCase *tc) 206void elm_test_gengrid(TCase *tc)
157{ 207{
158 tcase_add_test(tc, elm_gengrid_legacy_type_check); 208 tcase_add_test(tc, elm_gengrid_legacy_type_check);
159 tcase_add_test(tc, elm_atspi_role_get); 209 tcase_add_test(tc, elm_atspi_role_get);
160 tcase_add_test(tc, elm_gengrid_focus); 210 tcase_add_test(tc, elm_gengrid_focus);
211 tcase_add_test(tc, elm_gengrid_item_content);
161#if 0 212#if 0
162 tcase_add_test(tc, elm_atspi_children_parent); 213 tcase_add_test(tc, elm_atspi_children_parent);
163#endif 214#endif
diff --git a/src/tests/elementary/elm_test_genlist.c b/src/tests/elementary/elm_test_genlist.c
index d0f89aa4d7..894a6fb0f0 100644
--- a/src/tests/elementary/elm_test_genlist.c
+++ b/src/tests/elementary/elm_test_genlist.c
@@ -119,6 +119,56 @@ EFL_START_TEST(elm_genlist_test_item_iteration)
119} 119}
120EFL_END_TEST 120EFL_END_TEST
121 121
122static void
123_genlist_item_content_test_realize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
124{
125 ecore_main_loop_quit();
126}
127
128static Evas_Object *
129_item_content_get(void *data EINA_UNUSED, Evas_Object *obj, const char *part EINA_UNUSED)
130{
131 Evas_Object *ic = elm_button_add(obj);
132 return ic;
133}
134
135EFL_START_TEST(elm_genlist_test_item_content)
136{
137 Elm_Genlist_Item_Class *gtc;
138 Evas_Object *content, *parent;
139 Elm_Object_Item *it;
140
141 gtc = elm_genlist_item_class_new();
142 gtc->item_style = "default";
143 gtc->func.content_get = _item_content_get;
144 gtc->func.state_get = NULL;
145 gtc->func.del = NULL;
146
147 win = win_add(NULL, "genlist", ELM_WIN_BASIC);
148
149 genlist = elm_genlist_add(win);
150 evas_object_smart_callback_add(genlist, "realized", _genlist_item_content_test_realize, NULL);
151
152 it = elm_genlist_item_append(genlist, gtc, NULL, NULL,
153 ELM_GENLIST_ITEM_NONE, NULL, NULL);
154
155 evas_object_resize(genlist, 100, 100);
156 evas_object_resize(win, 150, 150);
157 evas_object_show(genlist);
158 evas_object_show(win);
159
160 ecore_main_loop_begin();
161
162 content = elm_object_item_part_content_get(it, "elm.swallow.end");
163 parent = elm_object_parent_widget_get(content);
164 ck_assert_ptr_eq(parent, genlist);
165
166 elm_genlist_item_all_contents_unset(it, NULL);
167 parent = elm_object_parent_widget_get(content);
168 ck_assert_ptr_eq(parent, win);
169}
170EFL_END_TEST
171
122EFL_START_TEST(elm_genlist_test_legacy_type_check) 172EFL_START_TEST(elm_genlist_test_legacy_type_check)
123{ 173{
124 const char *type; 174 const char *type;
@@ -520,6 +570,7 @@ void elm_test_genlist(TCase *tc)
520 tcase_add_test(tc, elm_genlist_test_legacy_type_check); 570 tcase_add_test(tc, elm_genlist_test_legacy_type_check);
521 tcase_add_test(tc, elm_genlist_test_item_destroy); 571 tcase_add_test(tc, elm_genlist_test_item_destroy);
522 tcase_add_test(tc, elm_genlist_test_item_iteration); 572 tcase_add_test(tc, elm_genlist_test_item_iteration);
573 tcase_add_test(tc, elm_genlist_test_item_content);
523 tcase_add_test(tc, elm_genlist_test_atspi_role_get); 574 tcase_add_test(tc, elm_genlist_test_atspi_role_get);
524 tcase_add_test(tc, elm_genlist_test_atspi_children_get1); 575 tcase_add_test(tc, elm_genlist_test_atspi_children_get1);
525 tcase_add_test(tc, elm_genlist_test_atspi_children_get2); 576 tcase_add_test(tc, elm_genlist_test_atspi_children_get2);