zmike pushed a commit to branch master.

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

commit 7f691b47fb1d9742380a0222915503110e5a22fa
Author: Marcel Hollerbach <[email protected]>
Date:   Wed Sep 11 13:38:20 2019 -0400

    introduce test file for Efl.Ui.Group_Item
    
    Summary:
    this tests that the tree structure which is defined by the group and
    child item hirachy is correctly transformed into a linear list.
    This also checks that the bug from the revision before is not happening.
    
    Depends on D9890
    
    Reviewers: segfaultxavi, zmike, cedric
    
    Reviewed By: zmike
    
    Subscribers: #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D9872
---
 src/tests/elementary/efl_ui_suite.c           |  1 +
 src/tests/elementary/efl_ui_suite.h           |  1 +
 src/tests/elementary/efl_ui_test_group_item.c | 82 +++++++++++++++++++++++++++
 src/tests/elementary/meson.build              |  1 +
 4 files changed, 85 insertions(+)

diff --git a/src/tests/elementary/efl_ui_suite.c 
b/src/tests/elementary/efl_ui_suite.c
index b893f253c1..efc6f518a3 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -40,6 +40,7 @@ static const Efl_Test_Case etc[] = {
   { "efl_ui_list_container", efl_ui_test_list_container },
   { "efl_ui_select_model", efl_ui_test_select_model },
   { "efl_ui_view_model", efl_ui_test_view_model },
+  { "efl_ui_group_item", efl_ui_test_group_item },
   { NULL, NULL }
 };
 
diff --git a/src/tests/elementary/efl_ui_suite.h 
b/src/tests/elementary/efl_ui_suite.h
index 00294a9a71..c37d9ed458 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -51,6 +51,7 @@ void efl_ui_test_popup(TCase *tc);
 void efl_ui_test_scroller(TCase *tc);
 void efl_ui_test_select_model(TCase *tc);
 void efl_ui_test_view_model(TCase *tc);
+void efl_ui_test_group_item(TCase *tc);
 
 void loop_timer_interval_set(Eo *obj, double in);
 
diff --git a/src/tests/elementary/efl_ui_test_group_item.c 
b/src/tests/elementary/efl_ui_test_group_item.c
new file mode 100644
index 0000000000..248ffcc2f8
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_group_item.c
@@ -0,0 +1,82 @@
+#define EFL_NOLEGACY_API_SUPPORT
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#define EFL_LAYOUT_CALC_PROTECTED
+#include <Efl_Ui.h>
+#include "efl_ui_suite.h"
+
+static Eo *win;
+static Eo *grid;
+
+static void
+create_ui(void)
+{
+   win = win_add();
+   grid = efl_add(EFL_UI_GRID_CLASS, win);
+
+}
+
+static void
+_ordering_equals(Efl_Ui_Widget **wid, unsigned int len)
+{
+   for (unsigned int i = 0; i < len; ++i)
+     {
+        ck_assert_ptr_eq(efl_pack_content_get(grid, i), wid[i]);
+     }
+   ck_assert_int_eq(efl_content_count(grid), len);
+}
+
+EFL_START_TEST(non_linear_insertion_pack_at)
+{
+   Eo *group[3];
+   Eo *order[12];
+
+   for (int i = 0; i < 3; ++i)
+     {
+        order[i*4] = group[i] = efl_add(EFL_UI_GROUP_ITEM_CLASS, grid);
+        efl_pack_at(grid, group[i], i);
+     }
+
+   for (int i = 0; i < 3; ++i)
+     {
+        for (int j = 0; j < 3; ++j)
+          {
+             Eo *item = order[4*i+(1+j)] = 
efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
+             efl_pack_at(group[i], item, j);
+          }
+     }
+   _ordering_equals(order, 12);
+}
+EFL_END_TEST
+
+EFL_START_TEST(non_linear_insertion_pack_end)
+{
+   Eo *group[3];
+   Eo *order[12];
+
+   for (int i = 0; i < 3; ++i)
+     {
+        order[i*4] = group[i] = efl_add(EFL_UI_GROUP_ITEM_CLASS, grid);
+        efl_pack_end(grid, group[i]);
+     }
+
+   for (int i = 0; i < 3; ++i)
+     {
+        for (int j = 0; j < 3; ++j)
+          {
+             Eo *item = order[4*i+(1+j)] = 
efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
+             efl_pack_end(group[i], item);
+          }
+     }
+   _ordering_equals(order, 12);
+}
+EFL_END_TEST
+
+void efl_ui_test_group_item(TCase *tc)
+{
+   tcase_add_checked_fixture(tc, fail_on_errors_setup, 
fail_on_errors_teardown);
+   tcase_add_checked_fixture(tc, create_ui, NULL);
+   tcase_add_test(tc, non_linear_insertion_pack_at);
+   tcase_add_test(tc, non_linear_insertion_pack_end);
+}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 161a389967..f7d56d742f 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -156,6 +156,7 @@ efl_ui_suite_src = [
   'efl_ui_test_scroller.c',
   'efl_ui_test_select_model.c',
   'efl_ui_test_view_model.c',
+  'efl_ui_test_group_item.c',
 ]
 
 efl_ui_suite = executable('efl_ui_suite',

-- 


Reply via email to