diff options
author | Subhransu Mohanty <smohantty@gmail.com> | 2020-06-03 12:15:05 +0900 |
---|---|---|
committer | Hermet Park <chuneon.park@samsung.com> | 2020-06-03 12:15:05 +0900 |
commit | c77a34402a9ea21ce18fb05c01f546f7898cc557 (patch) | |
tree | be7f5608cbb35333f5a99b732000fbd2d0964655 /src/bin/elementary/test.c | |
parent | 442fae5c5621636bf52c3467d6d4c7147fd53a5a (diff) |
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
Diffstat (limited to '')
-rw-r--r-- | src/bin/elementary/test.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index bfb505e4a3..1bcf69e9cd 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c | |||
@@ -681,14 +681,23 @@ _my_win_key_up(void *d EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Key *ev) | |||
681 | return ECORE_CALLBACK_RENEW; | 681 | return ECORE_CALLBACK_RENEW; |
682 | } | 682 | } |
683 | 683 | ||
684 | static Eina_Bool | ||
685 | _auto_close(void *data EINA_UNUSED) | ||
686 | { | ||
687 | elm_exit(); | ||
688 | return EINA_FALSE; | ||
689 | } | ||
690 | |||
684 | static void | 691 | static void |
685 | my_win_main(const char *autorun, Eina_Bool test_win_only) | 692 | my_win_main(const char *autorun, Eina_Bool test_win_only, Eina_Bool autoclose) |
686 | { | 693 | { |
687 | Evas_Object *bg = NULL, *bx0 = NULL, *bx1 = NULL, *lb = NULL, *chk = NULL; | 694 | Evas_Object *bg = NULL, *bx0 = NULL, *bx1 = NULL, *lb = NULL, *chk = NULL; |
688 | Evas_Object *fr = NULL, *tg = NULL, *sc = NULL, *en = NULL; | 695 | Evas_Object *fr = NULL, *tg = NULL, *sc = NULL, *en = NULL; |
689 | Eina_List *l = NULL; | 696 | Eina_List *l = NULL; |
690 | struct elm_test *t = NULL; | 697 | struct elm_test *t = NULL; |
691 | 698 | ||
699 | if (autoclose) ecore_timer_add(2, _auto_close, win); | ||
700 | |||
692 | if (test_win_only) goto add_tests; | 701 | if (test_win_only) goto add_tests; |
693 | /* Create an elm window - It returns an evas object. This is a little | 702 | /* Create an elm window - It returns an evas object. This is a little |
694 | * special as the object lives in the canvas that is inside the window | 703 | * special as the object lives in the canvas that is inside the window |
@@ -1414,6 +1423,7 @@ efl_main(void *data EINA_UNUSED, | |||
1414 | { | 1423 | { |
1415 | Efl_Loop_Arguments *arge = ev->info; | 1424 | Efl_Loop_Arguments *arge = ev->info; |
1416 | Eina_Bool test_win_only = EINA_FALSE; | 1425 | Eina_Bool test_win_only = EINA_FALSE; |
1426 | Eina_Bool autoclose = EINA_FALSE; | ||
1417 | char *autorun = NULL; | 1427 | char *autorun = NULL; |
1418 | 1428 | ||
1419 | if (arge->initialization) | 1429 | if (arge->initialization) |
@@ -1454,6 +1464,7 @@ efl_main(void *data EINA_UNUSED, | |||
1454 | "$ elementary_test\n" | 1464 | "$ elementary_test\n" |
1455 | "$ elementary_test --test-win-only [TEST_NAME]\n" | 1465 | "$ elementary_test --test-win-only [TEST_NAME]\n" |
1456 | "$ elementary_test -to [TEST_NAME]\n\n" | 1466 | "$ elementary_test -to [TEST_NAME]\n\n" |
1467 | "$ elementary_test --autoclose\n\n" | ||
1457 | "Examples:\n" | 1468 | "Examples:\n" |
1458 | "$ elementary_test -to Button\n\n")); | 1469 | "$ elementary_test -to Button\n\n")); |
1459 | return ; | 1470 | return ; |
@@ -1467,6 +1478,8 @@ efl_main(void *data EINA_UNUSED, | |||
1467 | } | 1478 | } |
1468 | else if (eina_streq(arg, "--all") || eina_streq(arg, "-a")) | 1479 | else if (eina_streq(arg, "--all") || eina_streq(arg, "-a")) |
1469 | all_tests = EINA_TRUE; | 1480 | all_tests = EINA_TRUE; |
1481 | else if (eina_streq(arg, "--autoclose")) | ||
1482 | autoclose = EINA_TRUE; | ||
1470 | else if ((i == eina_array_count(arge->argv) - 1) && (arg[0] != '-')) | 1483 | else if ((i == eina_array_count(arge->argv) - 1) && (arg[0] != '-')) |
1471 | autorun = arg; | 1484 | autorun = arg; |
1472 | 1485 | ||
@@ -1476,7 +1489,7 @@ efl_main(void *data EINA_UNUSED, | |||
1476 | { | 1489 | { |
1477 | } | 1490 | } |
1478 | 1491 | ||
1479 | my_win_main(autorun, test_win_only); /* create main window */ | 1492 | my_win_main(autorun, test_win_only, autoclose); /* create main window */ |
1480 | 1493 | ||
1481 | /* FIXME: Hum, no exit code anywhere anymore ? */ | 1494 | /* FIXME: Hum, no exit code anywhere anymore ? */ |
1482 | } | 1495 | } |