summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeongjong Lee <cleanlyj@naver.com>2019-02-27 14:45:34 -0500
committerMike Blumenkrantz <zmike@samsung.com>2019-02-27 14:45:34 -0500
commite4e5b5a349b9624e1b8ec95d9dbc297743a14f9d (patch)
treee23dddd091559706e6a0b4448b8794c01494dde4
parent138fa4eeaa37eb45ec52be9a194ae4d98aa76c1e (diff)
test/ui_table: add unittest for Efl.Ui.Table
Summary: {F3627728} {F3627729} ref T5487 Depends on D7892 Test Plan: make check Reviewers: jpeg, Jaehyun_Cho, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T5487 Differential Revision: https://phab.enlightenment.org/D7840
-rw-r--r--src/Makefile_Elementary.am1
-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_table.c364
-rw-r--r--src/tests/elementary/meson.build1
5 files changed, 368 insertions, 0 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 98d953df9c..ddc2db7a51 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -1630,6 +1630,7 @@ tests_elementary_efl_ui_suite_SOURCES = \
1630 tests/elementary/efl_ui_test_focus.c \ 1630 tests/elementary/efl_ui_test_focus.c \
1631 tests/elementary/efl_ui_test_focus_sub.c \ 1631 tests/elementary/efl_ui_test_focus_sub.c \
1632 tests/elementary/efl_ui_test_box.c \ 1632 tests/elementary/efl_ui_test_box.c \
1633 tests/elementary/efl_ui_test_table.c \
1633 tests/elementary/efl_ui_test_relative_layout.c \ 1634 tests/elementary/efl_ui_test_relative_layout.c \
1634 tests/elementary/efl_ui_test_grid.c \ 1635 tests/elementary/efl_ui_test_grid.c \
1635 tests/elementary/efl_ui_test_image.c \ 1636 tests/elementary/efl_ui_test_image.c \
diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c
index a0aa9022f8..aa5de44f60 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -13,6 +13,7 @@ static const Efl_Test_Case etc[] = {
13 { "efl_ui_focus", efl_ui_test_focus}, 13 { "efl_ui_focus", efl_ui_test_focus},
14 { "efl_ui_focus_sub", efl_ui_test_focus_sub}, 14 { "efl_ui_focus_sub", efl_ui_test_focus_sub},
15 { "efl_ui_box", efl_ui_test_box}, 15 { "efl_ui_box", efl_ui_test_box},
16 { "efl_ui_table", efl_ui_test_table},
16 { "efl_ui_grid", efl_ui_test_grid}, 17 { "efl_ui_grid", efl_ui_test_grid},
17 { "efl_ui_relative_layout", efl_ui_test_relative_layout}, 18 { "efl_ui_relative_layout", efl_ui_test_relative_layout},
18 { "efl_ui_image", efl_ui_test_image}, 19 { "efl_ui_image", efl_ui_test_image},
diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h
index e0c9089c22..4f5e529af0 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -20,6 +20,7 @@
20 } 20 }
21 21
22void efl_ui_test_box(TCase *tc); 22void efl_ui_test_box(TCase *tc);
23void efl_ui_test_table(TCase *tc);
23void efl_ui_test_grid(TCase *tc); 24void efl_ui_test_grid(TCase *tc);
24void efl_ui_test_relative_layout(TCase *tc); 25void efl_ui_test_relative_layout(TCase *tc);
25void efl_ui_test_atspi(TCase *tc); 26void efl_ui_test_atspi(TCase *tc);
diff --git a/src/tests/elementary/efl_ui_test_table.c b/src/tests/elementary/efl_ui_test_table.c
new file mode 100644
index 0000000000..467208e651
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_table.c
@@ -0,0 +1,364 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_suite.h"
7
8#define COORD_EQ(a, b) (!!(abs(a - b) < 2))
9#define GEOMETRY_EQ(a, b) (COORD_EQ(a.x, b.x) && COORD_EQ(a.y, b.y) && \
10 COORD_EQ(a.w, b.w) && COORD_EQ(a.h, b.h))
11
12typedef struct {
13 Eina_Size2D max;
14 Eina_Size2D min;
15 double weightx;
16 double weighty;
17 double alignx;
18 double aligny;
19 int marginl;
20 int marginr;
21 int margint;
22 int marginb;
23 Efl_Gfx_Hint_Aspect mode;
24 Eina_Size2D aspect;
25 Eina_Bool fillx;
26 Eina_Bool filly;
27 Eina_Size2D layout_size;
28 Eina_Size2D layout_expected;
29 Eina_Rect expected;
30 char testname[1024];
31} Hint;
32
33static Hint hints[] = {
34 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(0, 0), 1, 1, 0.5, 0.5, 0, 0, 0, 0,
35 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
36 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 200),
37 EINA_RECT(0, 0, 200, 200), "[0]" },
38 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.3, 0.5, 0, 0, 0, 0,
39 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
40 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 200),
41 EINA_RECT(0, 0, 200, 200), "[1]" },
42 { EINA_SIZE2D(50, 150), EINA_SIZE2D(70, 70), 1, 1, 0.3, 0.7, 0, 0, 0, 0,
43 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
44 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 200),
45 EINA_RECT((200 - 70) * 0.3, (200 - 150) * 0.7, 70, 150), "[2]" },
46 { EINA_SIZE2D(150, -1), EINA_SIZE2D(70, 70), 0, 0, 0.3, 0.7, 0, 0, 0, 0,
47 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_FALSE,
48 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 200),
49 EINA_RECT((200 - 70) * 0.8, (200 - 70) * 0.2, 70, 70), "[3]" },
50 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
51 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_TRUE,
52 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 200),
53 EINA_RECT((200 - 70) * 0.3, (200 - 70) * 0.2, 70, 70), "[4]" },
54 { EINA_SIZE2D(150, 150), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
55 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_TRUE,
56 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 200),
57 EINA_RECT((200 - 70) * 0.3, (200 - 70) * 0.2, 70, 70), "[5]" },
58 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 0, 1, 0.3, 0.7, 0, 0, 0, 0,
59 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
60 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 210),
61 EINA_RECT((200 - 70) * 0.8, 0, 70, 70 * 3), "[6]" },
62 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 0, 1, 0.3, 0.7, 0, 0, 0, 0,
63 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
64 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
65 EINA_RECT((300 - 70) * 0.8, (300 - 70 * 3) * 0.7, 70, 70 * 3), "[7]" },
66 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
67 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
68 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 210),
69 EINA_RECT((200 - 70) * 0.3, 0, 70, 70 * 3), "[8]" },
70 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
71 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
72 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
73 EINA_RECT((300 - 70) * 0.3, (300 - 70 * 3) * 0.2, 70, 70 * 3), "[9]" },
74 { EINA_SIZE2D(-1, 150), EINA_SIZE2D(70, 70), 0, 1, 0.3, 0.7, 0, 0, 0, 0,
75 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
76 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 210),
77 EINA_RECT((200 - 70) * 0.8, 0, 70, 70 * 3), "[10]" },
78 { EINA_SIZE2D(-1, 150), EINA_SIZE2D(70, 70), 0, 1, 0.3, 0.7, 0, 0, 0, 0,
79 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
80 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
81 EINA_RECT((300 - 70) * 0.8, (300 - 70 * 3) * 0.7, 70, 70 * 3), "[11]" },
82 { EINA_SIZE2D(-1, 150), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
83 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
84 EINA_SIZE2D(200, 200), EINA_SIZE2D(200, 210),
85 EINA_RECT((200 - 70) * 0.3, 0, 70, 70 * 3), "[12]" },
86 { EINA_SIZE2D(-1, 150), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
87 EFL_GFX_HINT_ASPECT_BOTH, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_FALSE,
88 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
89 EINA_RECT((300 - 70) * 0.3, (300 - 70 * 3) * 0.2, 70, 70 * 3), "[13]" },
90};
91
92static Hint hints2[][2] = {
93 {
94 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.3, 0.7, 0, 0, 0, 0,
95 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_FALSE,
96 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
97 EINA_RECT((150 - 70) * 0.3, (150 - 70) * 0.7, 70, 70), "[1/1 weight btn]" },
98 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
99 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_FALSE,
100 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
101 EINA_RECT((150 - 70) * 0.8, (150 - 70) * 0.2 + 150, 70, 70), "[1/1 weight btn2]" }
102 },
103 {
104 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
105 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_FALSE,
106 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
107 EINA_RECT((150 - 70) * 0.3, 0, 70, 70), "[0/1 weight btn]" },
108 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
109 EFL_GFX_HINT_ASPECT_VERTICAL, EINA_SIZE2D(1, 3), EINA_TRUE, EINA_TRUE,
110 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
111 EINA_RECT((150 - ((300 - 70) / 3)) * 0.8, 70, (300 - 70) / 3, (300 - 70)), "[0/1 weight btn2]" }
112 },
113 {
114 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 0, 0.3, 0.7, 0, 0, 0, 0,
115 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_FALSE,
116 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
117 EINA_RECT((150 - 70) * 0.3, (300 - 210) * 0.2, 70, 70), "[0/0 weight btn]" },
118 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 0, 0.8, 0.2, 0, 0, 0, 0,
119 EFL_GFX_HINT_ASPECT_HORIZONTAL, EINA_SIZE2D(1, 2), EINA_TRUE, EINA_FALSE,
120 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
121 EINA_RECT((150 - 70) * 0.8, (300 - 210) * 0.2 + 70, 70, 70 * 2), "[0/0 weight btn2]" }
122 },
123};
124
125static Hint hints3[][3] = {
126 {
127 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.3, 0.7, 0, 0, 0, 0,
128 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
129 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
130 EINA_RECT(0, 0, 150, 100), "[1/1/1 weight_l btn]" },
131 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 100), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
132 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
133 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
134 EINA_RECT(0, 100, 150, 100), "[1/1/1 weight_l btn2]" },
135 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
136 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
137 EINA_SIZE2D(150, 300), EINA_SIZE2D(150, 300),
138 EINA_RECT(0, 100 + 100, 150, 100), "[1/1/1 weight_l btn3]" }
139 },
140 {
141 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.3, 0.7, 0, 0, 0, 0,
142 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
143 EINA_SIZE2D(150, 270), EINA_SIZE2D(150, 270),
144 EINA_RECT(0, 0, 150, 85), "[1/1/1 weight_m btn]" },
145 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 100), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
146 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
147 EINA_SIZE2D(150, 270), EINA_SIZE2D(150, 270),
148 EINA_RECT(0, 85, 150, 100), "[1/1/1 weight_m btn2]" },
149 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
150 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
151 EINA_SIZE2D(150, 270), EINA_SIZE2D(150, 270),
152 EINA_RECT(0, 100 + 85, 150, 85), "[1/1/1 weight_m btn3]" }
153 },
154 {
155 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.3, 0.7, 0, 0, 0, 0,
156 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
157 EINA_SIZE2D(150, 200), EINA_SIZE2D(150, 240),
158 EINA_RECT(0, 0, 150, 70), "[1/1/1 weight_s btn]" },
159 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 100), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
160 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
161 EINA_SIZE2D(150, 200), EINA_SIZE2D(150, 240),
162 EINA_RECT(0, 70, 150, 100), "[1/1/1 weight_s btn2]" },
163 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(70, 70), 1, 1, 0.8, 0.2, 0, 0, 0, 0,
164 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
165 EINA_SIZE2D(150, 200), EINA_SIZE2D(150, 240),
166 EINA_RECT(0, 170, 150, 70), "[1/1/1 weight_s btn3]" }
167 },
168};
169
170static Hint hints_matrix[] = {
171 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 0, 0, 0.2, 0.8, 0, 0, 0, 0,
172 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_TRUE,
173 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
174 EINA_RECT(10 + (90 - 50) * 0.2, 20, 50, (300 - 50) / 3), "pack btn1" },
175 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 0, 0, 0.5, 0.5, 20, 20, 0, 0,
176 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
177 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
178 EINA_RECT(10 + (90 - 50) * 0.5, 103 + 5, 50, (300 - 50) / 3), "pack btn2" },
179 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 0, 1, -99, 100, 0, 0, 0, 0,
180 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_FALSE, EINA_FALSE,
181 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
182 EINA_RECT(10, 191 + 5 + (83 - 50) * 1, 50, 50), "pack btn3" },
183 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 0, 0, 0.5, 0.5, 0, 0, 0, 0,
184 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
185 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
186 EINA_RECT(110, 20, 170 * 2 / 3, (300 - 50) / 3), "pack btn4" },
187 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 70), 2, 2, 0.5, 0.5, 0, 0, 0, 0,
188 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
189 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
190 EINA_RECT(110, 103 + 5, 170 * 2 / 3, (300 - 50) / 3), "pack btn5" },
191 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 1, 1, 0.5, 0.5, 0, 0, 0, 0,
192 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
193 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
194 EINA_RECT(110, 191 + 5, 170 * 2 / 3, (300 - 50) / 3), "pack btn6" },
195 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 1, 0, 0.5, 0.5, 0, 0, 0, 0,
196 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
197 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
198 EINA_RECT(120 + 170 * 2 / 3, 20, 170 / 3, (300 - 50) / 3), "pack btn7" },
199 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 1, 1, 0.5, 0.5, 0, 0, 0, 0,
200 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
201 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
202 EINA_RECT(120 + 170 * 2 / 3, 103 + 5, 170 / 3, (300 - 50) * 2 / 3 + 5), "pack btn8" },
203 { EINA_SIZE2D(-1, -1), EINA_SIZE2D(50, 50), 1, 1, 0.5, 0.5, 0, 0, 0, 0,
204 EFL_GFX_HINT_ASPECT_NONE, EINA_SIZE2D(0, 0), EINA_TRUE, EINA_TRUE,
205 EINA_SIZE2D(300, 300), EINA_SIZE2D(300, 300),
206 EINA_RECT(120 + 170 * 2 / 3, 191 + 5, 170 / 3, (300 - 50) / 3), "pack btn9" },
207};
208
209static Eo *win, *layout;
210
211static void
212btn_hint_set(Eo *btn, Hint *hint)
213{
214 efl_gfx_entity_size_set(layout, hint->layout_size);
215 efl_gfx_hint_size_max_set(btn, hint->max);
216 efl_gfx_hint_size_min_set(btn, hint->min);
217 efl_gfx_hint_margin_set(btn, hint->marginl, hint->marginr,
218 hint->margint, hint->marginb);
219 efl_gfx_hint_weight_set(btn, hint->weightx, hint->weighty);
220 efl_gfx_hint_align_set(btn, hint->alignx, hint->aligny);
221 efl_gfx_hint_fill_set(btn, hint->fillx, hint->filly);
222 efl_gfx_hint_aspect_set(btn, hint->mode, hint->aspect);
223 efl_canvas_group_calculate(layout);
224}
225
226static void
227btn_geom_assert(Hint *hint, Eina_Rect btn_geom)
228{
229 Eina_Size2D layout_size, layout_min;
230
231 layout_size = efl_gfx_entity_size_get(layout);
232 layout_min = efl_gfx_hint_size_min_get(layout);
233 layout_size.w = layout_size.w > layout_min.w ? layout_size.w : layout_min.w;
234 layout_size.h = layout_size.h > layout_min.h ? layout_size.h : layout_min.h;
235
236 ck_assert_msg(GEOMETRY_EQ(btn_geom, hint->expected),
237 "Case %s failed... button geometry: (%d, %d, %d, %d) expected geometry: (%d, %d, %d, %d)",
238 hint->testname, btn_geom.x, btn_geom.y, btn_geom.w, btn_geom.h,
239 hint->expected.x, hint->expected.y, hint->expected.w, hint->expected.h);
240 ck_assert_msg(COORD_EQ(layout_size.w, hint->layout_expected.w) &&
241 COORD_EQ(layout_size.h, hint->layout_expected.h),
242 "Case %s failed... layout size: (%d, %d) expected size: (%d, %d)",
243 hint->testname, layout_size.w, layout_size.h,
244 hint->layout_expected.w, hint->layout_expected.h);
245}
246
247static void
248layout_setup()
249{
250 win = win_add();
251
252 layout = efl_add(EFL_UI_TABLE_CLASS, win,
253 efl_pack_align_set(efl_added, 0.8, 0.2),
254 efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL));
255}
256
257static void
258layout_teardown()
259{
260 if (win)
261 {
262 efl_del(win);
263 win = NULL;
264 }
265}
266
267EFL_START_TEST (efl_ui_table_class_check)
268{
269 const char *class;
270
271 class = efl_class_name_get(layout);
272
273 ck_assert(class != NULL);
274 ck_assert(!strcmp(class, "Efl.Ui.Table"));
275}
276EFL_END_TEST
277
278EFL_START_TEST (efl_ui_table_layout_update)
279{
280 int i, max_index = (sizeof(hints) / sizeof(Hint));
281
282 Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
283 efl_pack_table(layout, efl_added, 0, 0, 1, 1));
284
285 for (i = 0; i < max_index; i++)
286 {
287 btn_hint_set(btn, &hints[i]);
288 btn_geom_assert(&hints[i], efl_gfx_entity_geometry_get(btn));
289 }
290}
291EFL_END_TEST
292
293EFL_START_TEST (efl_ui_table_layout_update_pack)
294{
295 int i, max_index2, max_index3;
296 Eo *btn, *btn2, *btn3;
297
298 max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2);
299 max_index3 = ((sizeof(hints3) / sizeof(Hint)) / 3);
300
301 btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
302 efl_pack_table(layout, efl_added, 0, 0, 1, 1));
303 btn2 = efl_add(EFL_UI_BUTTON_CLASS, layout,
304 efl_pack_table(layout, efl_added, 0, 1, 1, 1));
305
306 for (i = 0; i < max_index2; i++)
307 {
308 btn_hint_set(btn, &hints2[i][0]);
309 btn_hint_set(btn2, &hints2[i][1]);
310 btn_geom_assert(&hints2[i][0], efl_gfx_entity_geometry_get(btn));
311 btn_geom_assert(&hints2[i][1], efl_gfx_entity_geometry_get(btn2));
312 }
313
314 btn3 = efl_add(EFL_UI_BUTTON_CLASS, layout,
315 efl_pack_table(layout, efl_added, 0, 2, 1, 1));
316
317 for (i = 0; i < max_index3; i++)
318 {
319 btn_hint_set(btn, &hints3[i][0]);
320 btn_hint_set(btn2, &hints3[i][1]);
321 btn_hint_set(btn3, &hints3[i][2]);
322 btn_geom_assert(&hints3[i][0], efl_gfx_entity_geometry_get(btn));
323 btn_geom_assert(&hints3[i][1], efl_gfx_entity_geometry_get(btn2));
324 btn_geom_assert(&hints3[i][2], efl_gfx_entity_geometry_get(btn3));
325 }
326}
327EFL_END_TEST
328
329EFL_START_TEST (efl_ui_table_layout_update_matrix)
330{
331 int i, j, max_index = (sizeof(hints_matrix) / sizeof(Hint));
332 Eo *btn[9];
333
334 efl_gfx_hint_margin_set(layout, 10, 10, 20, 20);
335 efl_ui_table_homogeneous_set(layout, 0, 1);
336 efl_pack_padding_set(layout, 10, 5, 0);
337
338 for (i = 0; i < 3; i++)
339 {
340 for (j = 0; j < 3; j++)
341 {
342 btn[3 * i + j] = efl_add(EFL_UI_BUTTON_CLASS, layout,
343 efl_pack_table(layout, efl_added, i, j, 1, 1));
344
345 if ((i == 2) && (j == 1))
346 efl_pack_table(layout, btn[3 * i + j], i, j, 1, 2);
347 }
348 }
349 for (i = 0; i < max_index; i++)
350 btn_hint_set(btn[i], &hints_matrix[i]);
351
352 for (i = 0; i < max_index; i++)
353 btn_geom_assert(&hints_matrix[i], efl_gfx_entity_geometry_get(btn[i]));
354}
355EFL_END_TEST
356
357void efl_ui_test_table(TCase *tc)
358{
359 tcase_add_checked_fixture(tc, layout_setup, layout_teardown);
360 tcase_add_test(tc, efl_ui_table_class_check);
361 tcase_add_test(tc, efl_ui_table_layout_update);
362 tcase_add_test(tc, efl_ui_table_layout_update_pack);
363 tcase_add_test(tc, efl_ui_table_layout_update_matrix);
364}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 77649a1d26..eaffab6d6b 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -123,6 +123,7 @@ efl_ui_suite_src = [
123 'efl_ui_test_focus.c', 123 'efl_ui_test_focus.c',
124 'efl_ui_test_focus_sub.c', 124 'efl_ui_test_focus_sub.c',
125 'efl_ui_test_box.c', 125 'efl_ui_test_box.c',
126 'efl_ui_test_table.c',
126 'efl_ui_test_grid.c', 127 'efl_ui_test_grid.c',
127 'efl_ui_test_relative_layout.c', 128 'efl_ui_test_relative_layout.c',
128 'efl_ui_test_image.c', 129 'efl_ui_test_image.c',