ecore: add test case for Efl.Loop.Job.

This commit is contained in:
Cedric Bail 2016-05-02 18:14:44 -07:00
parent cfdc09fa93
commit 664d677201
4 changed files with 70 additions and 0 deletions

View File

@ -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_file.c \
tests/ecore/ecore_test_promise.c \
tests/ecore/ecore_test_job.c \
tests/ecore/ecore_suite.h
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \

View File

@ -27,6 +27,7 @@ static const Efl_Test_Case etc[] = {
{ "Ecore_Input", ecore_test_ecore_input },
{ "Ecore_File", ecore_test_ecore_file },
{ "Ecore_Promise", ecore_test_ecore_promise },
{ "Ecore_Job", ecore_test_ecore_job },
{ NULL, NULL }
};

View File

@ -16,5 +16,6 @@ void ecore_test_ecore_fb(TCase *tc);
void ecore_test_ecore_input(TCase *tc);
void ecore_test_ecore_file(TCase *tc);
void ecore_test_ecore_promise(TCase *tc);
void ecore_test_ecore_job(TCase *tc);
#endif /* _ECORE_SUITE_H */

View File

@ -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);
}