cedric pushed a commit to branch master.

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

commit 101f17d1c52d1ba24e5dac79eb6f299f523e4044
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Tue Mar 13 15:11:50 2018 -0400

    tests: add genlist test to verify group item api behaviour
    
    ref T5938
    
    Signed-off-by: Mike Blumenkrantz <zm...@osg.samsung.com>
---
 src/tests/elementary/elm_test_genlist.c | 63 ++++++++++++++++++++++++++++++++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/src/tests/elementary/elm_test_genlist.c 
b/src/tests/elementary/elm_test_genlist.c
index 678041fd7b..f1132abe7e 100644
--- a/src/tests/elementary/elm_test_genlist.c
+++ b/src/tests/elementary/elm_test_genlist.c
@@ -14,9 +14,69 @@ static int counter;
 static Efl_Access_Event_Children_Changed_Data ev_data;
 Evas_Object *content;
 
+static void
+verify_group_api(Elm_Object_Item *git)
+{
+   Elm_Object_Item *it;
+   int i;
+
+   /* the last item is the group item
+    * this is not consistent with the visual layout but this is consistent 
with behavior since 1.0
+    */
+   it = elm_genlist_last_item_get(genlist);
+   ck_assert_ptr_ne(it, NULL);
+   ck_assert_ptr_eq(it, git);
+
+   /* assert that the last item is actually the last item */
+   it = elm_genlist_item_next_get(git);
+   ck_assert_ptr_eq(it, NULL);
+
+   /* assert that the other items added to the list exist */
+   it = elm_genlist_item_prev_get(git);
+   ck_assert_ptr_ne(it, NULL);
+
+   /* assert that the parent of this item is the group item */
+   ck_assert_ptr_eq(elm_genlist_item_parent_get(it), git);
+
+   /* check that the first item in the list is a normal item */
+   it = elm_genlist_first_item_get(genlist);
+   ck_assert_ptr_eq(elm_genlist_item_parent_get(it), git);
+
+   /* verify list consistency */
+   for (i = 0; i < 9; i++)
+     {
+        it = elm_genlist_item_next_get(it);
+        ck_assert_ptr_eq(elm_genlist_item_parent_get(it), git);
+     }
+   it = elm_genlist_item_next_get(it);
+   /* verify once again that we have arrived at the group item */
+   ck_assert_ptr_eq(it, git);
+}
+
+START_TEST (elm_genlist_group)
+{
+   const char *type;
+   Elm_Object_Item *git;
+   int i;
+
+   char *args[] = { "exe" };
+   elm_init(1, args);
+   win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
+
+   genlist = elm_genlist_add(win);
+
+   git = elm_genlist_item_append(genlist, &itc, NULL, NULL, 
ELM_GENLIST_ITEM_GROUP, NULL, NULL);
+   for (i = 0; i < 10; i++)
+     elm_genlist_item_append(genlist, &itc, NULL, git, 0, NULL, NULL);
+
+   verify_group_api(git);
+
+   elm_shutdown();
+}
+END_TEST
+
 START_TEST (elm_genlist_legacy_type_check)
 {
-   Evas_Object *win, *genlist;
    const char *type;
 
    char *args[] = { "exe" };
@@ -204,6 +264,7 @@ END_TEST
 void elm_test_genlist(TCase *tc)
 {
    tcase_add_test(tc, elm_genlist_legacy_type_check);
+   tcase_add_test(tc, elm_genlist_group);
    tcase_add_test(tc, elm_atspi_role_get);
    tcase_add_test(tc, elm_atspi_children_get1);
    tcase_add_test(tc, elm_atspi_children_get2);

-- 


Reply via email to