summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-11 13:38:20 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-11 13:38:20 -0400
commit7f691b47fb1d9742380a0222915503110e5a22fa (patch)
tree28fbfbee9b78cdb6f933775b02e6e193817ed0e0 /src/tests
parentd5bf69ff53f5e9268663f0dd3d16ac79113217a0 (diff)
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
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/efl_ui_suite.c1
-rw-r--r--src/tests/elementary/efl_ui_suite.h1
-rw-r--r--src/tests/elementary/efl_ui_test_group_item.c82
-rw-r--r--src/tests/elementary/meson.build1
4 files changed, 85 insertions, 0 deletions
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[] = {
40 { "efl_ui_list_container", efl_ui_test_list_container }, 40 { "efl_ui_list_container", efl_ui_test_list_container },
41 { "efl_ui_select_model", efl_ui_test_select_model }, 41 { "efl_ui_select_model", efl_ui_test_select_model },
42 { "efl_ui_view_model", efl_ui_test_view_model }, 42 { "efl_ui_view_model", efl_ui_test_view_model },
43 { "efl_ui_group_item", efl_ui_test_group_item },
43 { NULL, NULL } 44 { NULL, NULL }
44}; 45};
45 46
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);
51void efl_ui_test_scroller(TCase *tc); 51void efl_ui_test_scroller(TCase *tc);
52void efl_ui_test_select_model(TCase *tc); 52void efl_ui_test_select_model(TCase *tc);
53void efl_ui_test_view_model(TCase *tc); 53void efl_ui_test_view_model(TCase *tc);
54void efl_ui_test_group_item(TCase *tc);
54 55
55void loop_timer_interval_set(Eo *obj, double in); 56void loop_timer_interval_set(Eo *obj, double in);
56 57
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 @@
1#define EFL_NOLEGACY_API_SUPPORT
2#ifdef HAVE_CONFIG_H
3# include "elementary_config.h"
4#endif
5#define EFL_LAYOUT_CALC_PROTECTED
6#include <Efl_Ui.h>
7#include "efl_ui_suite.h"
8
9static Eo *win;
10static Eo *grid;
11
12static void
13create_ui(void)
14{
15 win = win_add();
16 grid = efl_add(EFL_UI_GRID_CLASS, win);
17
18}
19
20static void
21_ordering_equals(Efl_Ui_Widget **wid, unsigned int len)
22{
23 for (unsigned int i = 0; i < len; ++i)
24 {
25 ck_assert_ptr_eq(efl_pack_content_get(grid, i), wid[i]);
26 }
27 ck_assert_int_eq(efl_content_count(grid), len);
28}
29
30EFL_START_TEST(non_linear_insertion_pack_at)
31{
32 Eo *group[3];
33 Eo *order[12];
34
35 for (int i = 0; i < 3; ++i)
36 {
37 order[i*4] = group[i] = efl_add(EFL_UI_GROUP_ITEM_CLASS, grid);
38 efl_pack_at(grid, group[i], i);
39 }
40
41 for (int i = 0; i < 3; ++i)
42 {
43 for (int j = 0; j < 3; ++j)
44 {
45 Eo *item = order[4*i+(1+j)] = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
46 efl_pack_at(group[i], item, j);
47 }
48 }
49 _ordering_equals(order, 12);
50}
51EFL_END_TEST
52
53EFL_START_TEST(non_linear_insertion_pack_end)
54{
55 Eo *group[3];
56 Eo *order[12];
57
58 for (int i = 0; i < 3; ++i)
59 {
60 order[i*4] = group[i] = efl_add(EFL_UI_GROUP_ITEM_CLASS, grid);
61 efl_pack_end(grid, group[i]);
62 }
63
64 for (int i = 0; i < 3; ++i)
65 {
66 for (int j = 0; j < 3; ++j)
67 {
68 Eo *item = order[4*i+(1+j)] = efl_add(EFL_UI_GRID_DEFAULT_ITEM_CLASS, grid);
69 efl_pack_end(group[i], item);
70 }
71 }
72 _ordering_equals(order, 12);
73}
74EFL_END_TEST
75
76void efl_ui_test_group_item(TCase *tc)
77{
78 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
79 tcase_add_checked_fixture(tc, create_ui, NULL);
80 tcase_add_test(tc, non_linear_insertion_pack_at);
81 tcase_add_test(tc, non_linear_insertion_pack_end);
82}
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 = [
156 'efl_ui_test_scroller.c', 156 'efl_ui_test_scroller.c',
157 'efl_ui_test_select_model.c', 157 'efl_ui_test_select_model.c',
158 'efl_ui_test_view_model.c', 158 'efl_ui_test_view_model.c',
159 'efl_ui_test_group_item.c',
159] 160]
160 161
161efl_ui_suite = executable('efl_ui_suite', 162efl_ui_suite = executable('efl_ui_suite',