elementary_test: Added --autoclose option to elementary_test

Summary:
This option will enable writing tools which will automate running the
elementary test cases.

Reviewers: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11910
This commit is contained in:
Subhransu Mohanty 2020-06-03 12:15:05 +09:00 committed by Hermet Park
parent 442fae5c56
commit c77a34402a
1 changed files with 15 additions and 2 deletions

View File

@ -681,14 +681,23 @@ _my_win_key_up(void *d EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Key *ev)
return ECORE_CALLBACK_RENEW;
}
static Eina_Bool
_auto_close(void *data EINA_UNUSED)
{
elm_exit();
return EINA_FALSE;
}
static void
my_win_main(const char *autorun, Eina_Bool test_win_only)
my_win_main(const char *autorun, Eina_Bool test_win_only, Eina_Bool autoclose)
{
Evas_Object *bg = NULL, *bx0 = NULL, *bx1 = NULL, *lb = NULL, *chk = NULL;
Evas_Object *fr = NULL, *tg = NULL, *sc = NULL, *en = NULL;
Eina_List *l = NULL;
struct elm_test *t = NULL;
if (autoclose) ecore_timer_add(2, _auto_close, win);
if (test_win_only) goto add_tests;
/* Create an elm window - It returns an evas object. This is a little
* special as the object lives in the canvas that is inside the window
@ -1414,6 +1423,7 @@ efl_main(void *data EINA_UNUSED,
{
Efl_Loop_Arguments *arge = ev->info;
Eina_Bool test_win_only = EINA_FALSE;
Eina_Bool autoclose = EINA_FALSE;
char *autorun = NULL;
if (arge->initialization)
@ -1454,6 +1464,7 @@ efl_main(void *data EINA_UNUSED,
"$ elementary_test\n"
"$ elementary_test --test-win-only [TEST_NAME]\n"
"$ elementary_test -to [TEST_NAME]\n\n"
"$ elementary_test --autoclose\n\n"
"Examples:\n"
"$ elementary_test -to Button\n\n"));
return ;
@ -1467,6 +1478,8 @@ efl_main(void *data EINA_UNUSED,
}
else if (eina_streq(arg, "--all") || eina_streq(arg, "-a"))
all_tests = EINA_TRUE;
else if (eina_streq(arg, "--autoclose"))
autoclose = EINA_TRUE;
else if ((i == eina_array_count(arge->argv) - 1) && (arg[0] != '-'))
autorun = arg;
@ -1476,7 +1489,7 @@ efl_main(void *data EINA_UNUSED,
{
}
my_win_main(autorun, test_win_only); /* create main window */
my_win_main(autorun, test_win_only, autoclose); /* create main window */
/* FIXME: Hum, no exit code anywhere anymore ? */
}