2016-05-31 01:16:14 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Ecore.h>
|
|
|
|
#include "ecore_suite.h"
|
2016-06-23 10:53:46 -07:00
|
|
|
#include "ecore_private.h"
|
2016-06-22 14:36:39 -07:00
|
|
|
|
|
|
|
static const char *args[] = {
|
|
|
|
"a", "b", "c", "d", "e", "f", "g", "h"
|
|
|
|
};
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_cb_args1(void *data EINA_UNUSED, const Efl_Event *event)
|
2016-05-31 01:16:14 -07:00
|
|
|
{
|
2016-06-22 14:36:39 -07:00
|
|
|
Efl_Loop_Arguments *arge = event->info;
|
|
|
|
unsigned int i;
|
2016-05-31 01:16:14 -07:00
|
|
|
|
2016-06-22 14:36:39 -07:00
|
|
|
fail_if(eina_array_count(arge->argv) != (sizeof (args) / sizeof (args[0])));
|
|
|
|
for (i = 0; i < eina_array_count(arge->argv); i++)
|
|
|
|
{
|
|
|
|
fail_if(!!strcmp(eina_array_data_get(arge->argv, i), args[i]));
|
|
|
|
}
|
2016-05-31 01:16:14 -07:00
|
|
|
ecore_main_loop_quit();
|
|
|
|
}
|
|
|
|
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_START_TEST(ecore_test_args1)
|
2016-05-31 01:16:14 -07:00
|
|
|
{
|
2018-02-26 21:10:12 -08:00
|
|
|
efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS,
|
2016-05-31 01:16:14 -07:00
|
|
|
_cb_args1, NULL);
|
2016-06-22 14:36:39 -07:00
|
|
|
ecore_loop_arguments_send(8, args);
|
2016-05-31 01:16:14 -07:00
|
|
|
ecore_main_loop_begin();
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
2016-05-31 01:16:14 -07:00
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_cb_args2(void *data EINA_UNUSED, const Efl_Event *event)
|
2016-05-31 01:16:14 -07:00
|
|
|
{
|
2016-06-22 14:36:39 -07:00
|
|
|
Efl_Loop_Arguments *arge = event->info;
|
2016-05-31 01:16:14 -07:00
|
|
|
|
2016-06-22 14:36:39 -07:00
|
|
|
fail_if(eina_array_count(arge->argv) != 1);
|
|
|
|
fail_if(!!strcmp(eina_array_data_get(arge->argv, 0), "hello world"));
|
2016-05-31 01:16:14 -07:00
|
|
|
ecore_main_loop_quit();
|
|
|
|
}
|
|
|
|
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_START_TEST(ecore_test_args2)
|
2016-05-31 01:16:14 -07:00
|
|
|
{
|
2016-06-22 14:36:39 -07:00
|
|
|
const char *simple_args[] = {
|
|
|
|
"hello world"
|
|
|
|
};
|
2016-05-31 01:16:14 -07:00
|
|
|
|
2018-02-26 21:10:12 -08:00
|
|
|
efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS,
|
2016-05-31 01:16:14 -07:00
|
|
|
_cb_args2, NULL);
|
2016-06-22 14:36:39 -07:00
|
|
|
ecore_loop_arguments_send(1, simple_args);
|
2016-05-31 01:16:14 -07:00
|
|
|
ecore_main_loop_begin();
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
2016-05-31 01:16:14 -07:00
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_cb_args3(void *data EINA_UNUSED, const Efl_Event *event)
|
2016-05-31 01:16:14 -07:00
|
|
|
{
|
2016-06-22 14:36:39 -07:00
|
|
|
Efl_Loop_Arguments *arge = event->info;
|
2016-05-31 01:16:14 -07:00
|
|
|
|
2016-06-22 14:36:39 -07:00
|
|
|
fail_if(eina_array_count(arge->argv) != 0);
|
2016-05-31 01:16:14 -07:00
|
|
|
ecore_main_loop_quit();
|
|
|
|
}
|
|
|
|
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_START_TEST(ecore_test_args3)
|
2016-05-31 01:16:14 -07:00
|
|
|
{
|
2018-02-26 21:10:12 -08:00
|
|
|
efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_ARGUMENTS,
|
2016-05-31 01:16:14 -07:00
|
|
|
_cb_args3, NULL);
|
2016-06-22 14:36:39 -07:00
|
|
|
ecore_loop_arguments_send(0, NULL);
|
2016-05-31 01:16:14 -07:00
|
|
|
ecore_main_loop_begin();
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
2016-05-31 01:16:14 -07:00
|
|
|
|
|
|
|
void ecore_test_ecore_args(TCase *tc)
|
|
|
|
{
|
|
|
|
tcase_add_test(tc, ecore_test_args1);
|
|
|
|
tcase_add_test(tc, ecore_test_args2);
|
|
|
|
tcase_add_test(tc, ecore_test_args3);
|
|
|
|
}
|