davemds pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f0293f9f0f20b3f0894ca46a1143361437141e46

commit f0293f9f0f20b3f0894ca46a1143361437141e46
Author: Dave Andreoli <[email protected]>
Date:   Tue Aug 9 11:58:23 2016 +0200

    Add a test for elm_gengrid_item_all_contents_unset()
    
    The function is good, and the test works as expected, I have written
    this because I have problems in pyefl with this function
---
 src/bin/elementary/test_gengrid.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/bin/elementary/test_gengrid.c 
b/src/bin/elementary/test_gengrid.c
index f1768e4..2c1ea55 100644
--- a/src/bin/elementary/test_gengrid.c
+++ b/src/bin/elementary/test_gengrid.c
@@ -544,6 +544,29 @@ _btn_show_clicked_cb(void *data, Evas_Object *obj 
EINA_UNUSED, void *event_info
    elm_gengrid_item_show(it, ELM_GENGRID_ITEM_SCROLLTO_IN);
 }
 
+static void
+_btn_item_contents_unset_cb(void *data, Evas_Object *obj EINA_UNUSED, void 
*event_info EINA_UNUSED)
+{
+   api_data *api = data;
+   Eina_List *l = NULL;
+   Evas_Object *o;
+   Elm_Object_Item *it;
+   
+   if (!api || !api->grid) return;
+
+   it = elm_gengrid_selected_item_get(api->grid);
+   if (!it) return;
+
+   elm_gengrid_item_all_contents_unset(it, &l);
+   EINA_LIST_FREE(l, o)
+   {
+      evas_object_move(o, 0, 0);
+      evas_object_show(o);
+   }
+   // Now all the unsetted object are orphan in the canvas,
+   // the user should do something with them
+}
+
 void
 test_gengrid(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void 
*event_info EINA_UNUSED)
 {
@@ -660,6 +683,12 @@ test_gengrid(void *data EINA_UNUSED, Evas_Object *obj 
EINA_UNUSED, void *event_i
    elm_box_pack_end(bx, bt);
    evas_object_show(bt);
 
+   bt = elm_button_add(win);
+   elm_object_text_set(bt, "Item contents unset");
+   evas_object_smart_callback_add(bt, "clicked", _btn_item_contents_unset_cb, 
api);
+   elm_box_pack_end(bx, bt);
+   evas_object_show(bt);
+
    evas_object_resize(win, 600, 600);
    evas_object_show(win);
 }

-- 


Reply via email to