forked from enlightenment/efl
ecore: add test case for Efl.Loop.Job.
This commit is contained in:
parent
cfdc09fa93
commit
664d677201
|
@ -195,6 +195,7 @@ tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c \
|
||||||
tests/ecore/ecore_test_ecore_input.c \
|
tests/ecore/ecore_test_ecore_input.c \
|
||||||
tests/ecore/ecore_test_ecore_file.c \
|
tests/ecore/ecore_test_ecore_file.c \
|
||||||
tests/ecore/ecore_test_promise.c \
|
tests/ecore/ecore_test_promise.c \
|
||||||
|
tests/ecore/ecore_test_job.c \
|
||||||
tests/ecore/ecore_suite.h
|
tests/ecore/ecore_suite.h
|
||||||
|
|
||||||
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||||
|
|
|
@ -27,6 +27,7 @@ static const Efl_Test_Case etc[] = {
|
||||||
{ "Ecore_Input", ecore_test_ecore_input },
|
{ "Ecore_Input", ecore_test_ecore_input },
|
||||||
{ "Ecore_File", ecore_test_ecore_file },
|
{ "Ecore_File", ecore_test_ecore_file },
|
||||||
{ "Ecore_Promise", ecore_test_ecore_promise },
|
{ "Ecore_Promise", ecore_test_ecore_promise },
|
||||||
|
{ "Ecore_Job", ecore_test_ecore_job },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,5 +16,6 @@ void ecore_test_ecore_fb(TCase *tc);
|
||||||
void ecore_test_ecore_input(TCase *tc);
|
void ecore_test_ecore_input(TCase *tc);
|
||||||
void ecore_test_ecore_file(TCase *tc);
|
void ecore_test_ecore_file(TCase *tc);
|
||||||
void ecore_test_ecore_promise(TCase *tc);
|
void ecore_test_ecore_promise(TCase *tc);
|
||||||
|
void ecore_test_ecore_job(TCase *tc);
|
||||||
|
|
||||||
#endif /* _ECORE_SUITE_H */
|
#endif /* _ECORE_SUITE_H */
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Ecore.h>
|
||||||
|
#include "ecore_suite.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_promise_quit(void *data, void **value)
|
||||||
|
{
|
||||||
|
Eina_Bool *bob = data;
|
||||||
|
|
||||||
|
fail_if(data != *value);
|
||||||
|
*bob = EINA_TRUE;
|
||||||
|
ecore_main_loop_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(ecore_test_job_promise)
|
||||||
|
{
|
||||||
|
Eina_Bool bob = EINA_FALSE;
|
||||||
|
Eina_Promise *job = NULL;
|
||||||
|
|
||||||
|
ecore_init();
|
||||||
|
|
||||||
|
efl_loop_job(ecore_main_loop_get(), &job, &bob);
|
||||||
|
eina_promise_then(job, &_ecore_promise_quit, NULL, &bob);
|
||||||
|
|
||||||
|
ecore_main_loop_begin();
|
||||||
|
|
||||||
|
fail_if(bob != EINA_TRUE);
|
||||||
|
|
||||||
|
ecore_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_quit(void *data)
|
||||||
|
{
|
||||||
|
Eina_Bool *bob = data;
|
||||||
|
|
||||||
|
*bob = EINA_TRUE;
|
||||||
|
ecore_main_loop_quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(ecore_test_job)
|
||||||
|
{
|
||||||
|
Eina_Bool bob = EINA_FALSE;
|
||||||
|
Ecore_Job *job;
|
||||||
|
|
||||||
|
ecore_init();
|
||||||
|
|
||||||
|
job = ecore_job_add(&_ecore_quit, &bob);
|
||||||
|
fail_if(!job);
|
||||||
|
|
||||||
|
ecore_main_loop_begin();
|
||||||
|
|
||||||
|
fail_if(bob != EINA_TRUE);
|
||||||
|
|
||||||
|
ecore_shutdown();
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
void ecore_test_ecore_job(TCase *tc)
|
||||||
|
{
|
||||||
|
tcase_add_test(tc, ecore_test_job);
|
||||||
|
tcase_add_test(tc, ecore_test_job_promise);
|
||||||
|
}
|
Loading…
Reference in New Issue