summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_suite.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-01-28 13:38:24 -0500
committerStefan Schmidt <s.schmidt@samsung.com>2019-01-30 09:04:57 +0100
commit9f3d87ccca89bd57d85d721979539f3530726e3a (patch)
tree81174dac96dd98a003df660e36578234c590f030 /src/tests/elementary/elm_suite.c
parent953620402380b88fd8b8f8ec9a9ac116ef71c55b (diff)
tests: modify efl_ui_suite to use same test infrastructure as elm_suite
this should enable us to begin moving efl_ui tests into the proper suite instead of sticking them all into elm_suite also move grid tests to efl_ui_suite Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D7765
Diffstat (limited to 'src/tests/elementary/elm_suite.c')
-rw-r--r--src/tests/elementary/elm_suite.c170
1 files changed, 2 insertions, 168 deletions
diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c
index a046e6c..17bfeae 100644
--- a/src/tests/elementary/elm_suite.c
+++ b/src/tests/elementary/elm_suite.c
@@ -5,12 +5,7 @@
5#include <Elementary.h> 5#include <Elementary.h>
6#include "elm_suite.h" 6#include "elm_suite.h"
7#include "../efl_check.h" 7#include "../efl_check.h"
8#include "elm_widget.h" 8#include "suite_helpers.h"
9
10static int main_pid = -1;
11static Eina_Bool did_shutdown;
12static Evas_Object *global_win;
13static Eina_Bool buffer = EINA_FALSE;
14 9
15static const Efl_Test_Case etc[] = { 10static const Efl_Test_Case etc[] = {
16 { "elm_config", elm_test_config }, 11 { "elm_config", elm_test_config },
@@ -91,126 +86,9 @@ static const Efl_Test_Case etc[] = {
91 { "elm_focus", elm_test_focus}, 86 { "elm_focus", elm_test_focus},
92 { "elm_focus_sub", elm_test_focus_sub}, 87 { "elm_focus_sub", elm_test_focus_sub},
93 { "elm_widget_focus", elm_test_widget_focus}, 88 { "elm_widget_focus", elm_test_widget_focus},
94/* FIXME : This test must move efl_ui_suite when it ready *
95 * EFL_UI_TEST BEGIN */
96 { "efl_ui_grid", efl_ui_test_grid},
97/* EFL_UI_TEST END */
98 { NULL, NULL } 89 { NULL, NULL }
99}; 90};
100 91
101SUITE_INIT(elm)
102{
103 char *args[] = { "exe" };
104 ck_assert_int_eq(elm_init(1, args), 1);
105}
106
107SUITE_INIT(elm2)
108{
109 char *args[] = { "exe" };
110
111 if (getpid() != main_pid)
112 {
113 ecore_fork_reset();
114 return;
115 }
116 if (!did_shutdown)
117 {
118 /* if running un-forked then remove cached init */
119 ck_assert_int_eq(elm_shutdown(), 0);
120 did_shutdown = 1;
121 }
122 ck_assert_int_eq(elm_init(1, args), 1);
123}
124
125SUITE_SHUTDOWN(elm)
126{
127 ck_assert_int_eq(elm_shutdown(), 0);
128 /* verify that ecore was de-initialized completely */
129 ck_assert_int_eq(ecore_init(), 1);
130 /* avoid slowdowns in fork mode */
131 if (getpid() != main_pid) return;
132 ck_assert_int_eq(ecore_shutdown(), 0);
133}
134
135
136static const Efl_Test_Case etc_init[] = {
137 { "init", elm_test_init },
138 { NULL, NULL }
139};
140
141#define BUFFER_RENDER_INTERVAL 0.002
142
143static Eina_Bool
144_win_manual_render(void *data)
145{
146 ecore_animator_custom_tick();
147 evas_norender(evas_object_evas_get(data));
148 return EINA_TRUE;
149}
150
151static void
152_win_show(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
153{
154 evas_object_data_set(obj, "timer", ecore_timer_add(BUFFER_RENDER_INTERVAL, _win_manual_render, obj));
155}
156
157static void
158_win_hide(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
159{
160 ecore_timer_del(evas_object_data_del(obj, "timer"));
161}
162
163static Evas_Object *
164_elm_suite_win_create()
165{
166 Evas_Object *win = elm_win_add(NULL, "elm_suite", ELM_WIN_BASIC);
167 if (!buffer) return win;
168 ecore_evas_manual_render_set(ecore_evas_ecore_evas_get(evas_object_evas_get(win)), EINA_TRUE);
169 edje_frametime_set(BUFFER_RENDER_INTERVAL);
170 ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM);
171 evas_object_event_callback_add(win, EVAS_CALLBACK_SHOW, _win_show, NULL);
172 evas_object_event_callback_add(win, EVAS_CALLBACK_HIDE, _win_hide, NULL);
173 return win;
174}
175
176Evas_Object *
177win_add()
178{
179 if (getpid() != main_pid)
180 {
181 if (global_win) return global_win;
182 }
183 return _elm_suite_win_create();
184}
185
186static void
187force_focus_win(Evas_Object *win)
188{
189 Ecore_Evas *ee;
190
191 ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win));
192 ecore_evas_focus_set(ee, EINA_TRUE);
193 ecore_evas_callback_focus_in_set(ee, NULL);
194 ecore_evas_callback_focus_out_set(ee, NULL);
195 Elm_Widget_Smart_Data *pd = efl_data_scope_safe_get(win, EFL_UI_WIDGET_CLASS);
196 pd->top_win_focused = EINA_TRUE;
197}
198
199Evas_Object *
200win_add_focused()
201{
202 Evas_Object *win;
203
204 if (getpid() != main_pid)
205 {
206 if (global_win) return global_win;
207 }
208
209 win = _elm_suite_win_create();
210 force_focus_win(win);
211 return win;
212}
213
214int 92int
215main(int argc, char **argv) 93main(int argc, char **argv)
216{ 94{
@@ -219,51 +97,7 @@ main(int argc, char **argv)
219 if (!_efl_test_option_disp(argc, argv, etc)) 97 if (!_efl_test_option_disp(argc, argv, etc))
220 return 0; 98 return 0;
221 99
222#ifdef NEED_RUN_IN_TREE 100 failed_count = suite_setup(EINA_TRUE);
223 putenv("EFL_RUN_IN_TREE=1");
224#endif
225 if (!getenv("ELM_ENGINE"))
226 putenv("ELM_ENGINE=buffer");
227 if (eina_streq(getenv("ELM_ENGINE"), "buffer"))
228 {
229 putenv("TESTS_GL_DISABLED=1");
230 buffer = EINA_TRUE;
231 }
232
233 main_pid = getpid();
234 ecore_app_no_system_modules();
235 efreet_cache_disable();
236
237 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
238 "Elementary_Init", etc_init, SUITE_INIT_FN(elm), SUITE_SHUTDOWN_FN(elm));
239 failed_count += !elm_init(1, (char*[]){"exe"});
240 if (buffer)
241 {
242 global_win = _elm_suite_win_create();
243 force_focus_win(global_win);
244 }
245 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
246 /* preload default theme */
247 failed_count += !elm_theme_group_path_find(NULL, "elm/button/base/default");
248 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
249 failed_count += !elm_theme_group_path_find(NULL, "elm/border/base/default");
250 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
251 failed_count += !elm_theme_group_path_find(NULL, "elm/win/base/default");
252 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
253
254 /* none of these will be found in the default theme,
255 * but all are "fetched" hundreds of times
256 * T6865
257 */
258 elm_theme_group_path_find(NULL, "elm/cursor/top_side/default");
259 elm_theme_group_path_find(NULL, "elm/cursor/bottom_side/default");
260 elm_theme_group_path_find(NULL, "elm/cursor/top_left_corner/default");
261 elm_theme_group_path_find(NULL, "elm/cursor/bottom_left_corner/default");
262 elm_theme_group_path_find(NULL, "elm/cursor/top_right_corner/default");
263 elm_theme_group_path_find(NULL, "elm/cursor/bottom_right_corner/default");
264
265
266 elm_theme_group_path_find(NULL, "elm/colorselector/item/color/default");
267 101
268 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, 102 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
269 "Elementary", etc, SUITE_INIT_FN(elm2), SUITE_SHUTDOWN_FN(elm)); 103 "Elementary", etc, SUITE_INIT_FN(elm2), SUITE_SHUTDOWN_FN(elm));