tests: add test for efl.ui header compilation

This commit is contained in:
Mike Blumenkrantz 2018-02-26 14:48:24 -05:00
parent f535a88d54
commit 568b524411
2 changed files with 93 additions and 2 deletions

View File

@ -1401,8 +1401,8 @@ AM_TESTS_ENVIRONMENT += \
ELM_RUN_IN_TREE=1 \
EFL_RUN_IN_TREE=1
check_PROGRAMS += tests/elementary/elm_suite
TESTS += tests/elementary/elm_suite
check_PROGRAMS += tests/elementary/elm_suite tests/elementary/efl_ui_suite
TESTS += tests/elementary/elm_suite tests/elementary/efl_ui_suite
tests_elementary_elm_suite_SOURCES = \
tests/elementary/elm_suite.c \
@ -1503,6 +1503,24 @@ tests_elementary_elm_suite_CPPFLAGS = \
tests_elementary_elm_suite_LDADD = @CHECK_LIBS@ @USE_ELEMENTARY_LIBS@
tests_elementary_elm_suite_DEPENDENCIES = @USE_ELEMENTARY_INTERNAL_LIBS@ $(top_builddir)/data/elementary/objects/test.edj
tests_elementary_efl_ui_suite_SOURCES = \
tests/elementary/efl_ui_suite.c
tests_elementary_efl_ui_suite_CPPFLAGS = \
-DTESTS_BUILD_DIR=\"${top_builddir}/src/tests/elementary\" \
-DTESTS_SRC_DIR=\"${top_srcdir}/src/tests/elementary\" \
-DELM_IMAGE_DATA_DIR=\"${top_srcdir}/data/elementary\" \
-DELM_TEST_DATA_DIR=\"${abs_top_builddir}/data/elementary\" \
-DPACKAGE_DATA_DIR=\"${abs_top_builddir}/data/elementary\" \
-I$(top_srcdir)/src/lib/elementary \
-I$(top_builddir)/src/lib/elementary \
-I$(top_builddir)/src/tests/elementary \
@CHECK_CFLAGS@ \
@ELEMENTARY_CFLAGS@
tests_elementary_efl_ui_suite_LDADD = @CHECK_LIBS@ @USE_ELEMENTARY_LIBS@
tests_elementary_efl_ui_suite_DEPENDENCIES = @USE_ELEMENTARY_INTERNAL_LIBS@ $(top_builddir)/data/elementary/objects/test.edj
endif
if HAVE_ELUA

View File

@ -0,0 +1,73 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <check.h>
#define EFL_NOLEGACY_API_SUPPORT
#include <Efl_Ui.h>
#include "../efl_check.h"
EAPI_MAIN void
efl_main(void *data EINA_UNUSED,
const Efl_Event *ev)
{
Efl_Loop_Arguments *arge = ev->info;
fail_if(!arge->initialization);
fprintf(stderr, "ARGC %d\n", eina_array_count(arge->argv));
fail_if(eina_array_count(arge->argv) != 1);
fail_if(!eina_streq(eina_array_data_get(arge->argv, 0), "test"));
efl_loop_quit(ev->object, eina_value_string_init("success"));
}
START_TEST(efl_ui_test_init)
{
/* EFL_MAIN */
Eina_Value *ret__;
int real__;
int argc = 2;
char *argv[] = { "efl_ui_suite", "test" };
_efl_startup_time = ecore_time_unix_get();
_EFL_APP_VERSION_SET();
fail_if(!ecore_init());
efl_event_callback_add(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_EVENT_ARGUMENTS, efl_main, NULL);
fail_if(!ecore_init_ex(argc, argv));
__EFL_MAIN_CONSTRUCTOR;
ret__ = efl_loop_begin(efl_app_main_loop_get(efl_app_get()));
real__ = efl_loop_exit_code_process(ret__);
__EFL_MAIN_DESTRUCTOR;
ecore_shutdown_ex();
ecore_shutdown();
}
END_TEST
void efl_ui_test(TCase *tc)
{
tcase_add_test(tc, efl_ui_test_init);
}
static const Efl_Test_Case etc[] = {
{ "Efl_Ui", efl_ui_test },
{ NULL, NULL }
};
int
main(int argc, char **argv)
{
int failed_count;
if (!_efl_test_option_disp(argc, argv, etc))
return 0;
#ifdef NEED_RUN_IN_TREE
putenv("EFL_RUN_IN_TREE=1");
#endif
failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
"Efl_Ui", etc);
return (failed_count == 0) ? 0 : 255;
}