elm_test: replace bespoke arg handling with a for loop
this fixes handling of --help regardless of its position in the arg array Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9405
This commit is contained in:
parent
e0ae3a9a76
commit
e1f2b9d235
|
@ -1387,33 +1387,39 @@ efl_main(void *data EINA_UNUSED,
|
||||||
/* if called with a single argument try to autorun a test with
|
/* if called with a single argument try to autorun a test with
|
||||||
* the same name as the given param
|
* the same name as the given param
|
||||||
* ex: elementary_test "Box Vert 2" */
|
* ex: elementary_test "Box Vert 2" */
|
||||||
if (eina_array_count(arge->argv) == 2)
|
if (eina_array_count(arge->argv) >= 2)
|
||||||
{
|
{
|
||||||
if ((!strcmp(eina_array_data_get(arge->argv, 1), "--help")) ||
|
unsigned int i;
|
||||||
(!strcmp(eina_array_data_get(arge->argv, 1), "-help")) ||
|
for (i = 1; i < eina_array_count(arge->argv); i++)
|
||||||
(!strcmp(eina_array_data_get(arge->argv, 1), "-h")))
|
|
||||||
{
|
{
|
||||||
efl_loop_quit(ev->object,
|
char *arg = eina_array_data_get(arge->argv, i);
|
||||||
eina_value_string_init("Usages:\n"
|
if ((!strcmp(arg, "--help")) ||
|
||||||
"$ elementary_test\n"
|
(!strcmp(arg, "-help")) ||
|
||||||
"$ elementary_test --test-win-only [TEST_NAME]\n"
|
(!strcmp(arg, "-h")))
|
||||||
"$ elementary_test -to [TEST_NAME]\n\n"
|
{
|
||||||
"Examples:\n"
|
efl_loop_quit(ev->object,
|
||||||
"$ elementary_test -to Button\n\n"));
|
eina_value_string_init("Usages:\n"
|
||||||
return ;
|
"$ elementary_test\n"
|
||||||
|
"$ elementary_test --test-win-only [TEST_NAME]\n"
|
||||||
|
"$ elementary_test -to [TEST_NAME]\n\n"
|
||||||
|
"Examples:\n"
|
||||||
|
"$ elementary_test -to Button\n\n"));
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
/* Just a workaround to make the shot module more
|
||||||
|
* useful with elementary test. */
|
||||||
|
if ((!strcmp(arg, "--test-win-only")) ||
|
||||||
|
(!strcmp(arg, "-to")))
|
||||||
|
{
|
||||||
|
test_win_only = EINA_TRUE;
|
||||||
|
}
|
||||||
|
else if ((i == eina_array_count(arge->argv) - 1) && (arg[0] != '-'))
|
||||||
|
autorun = arg;
|
||||||
|
|
||||||
}
|
}
|
||||||
autorun = eina_array_data_get(arge->argv, 1);
|
|
||||||
}
|
}
|
||||||
else if (eina_array_count(arge->argv) == 3)
|
else if (eina_array_count(arge->argv) == 3)
|
||||||
{
|
{
|
||||||
/* Just a workaround to make the shot module more
|
|
||||||
* useful with elementary test. */
|
|
||||||
if ((!strcmp(eina_array_data_get(arge->argv, 1), "--test-win-only")) ||
|
|
||||||
(!strcmp(eina_array_data_get(arge->argv, 1), "-to")))
|
|
||||||
{
|
|
||||||
test_win_only = EINA_TRUE;
|
|
||||||
autorun = eina_array_data_get(arge->argv, 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my_win_main(autorun, test_win_only); /* create main window */
|
my_win_main(autorun, test_win_only); /* create main window */
|
||||||
|
|
Loading…
Reference in New Issue