From 6f31f36aa81cd15c34b9e55f43231e521acd35e0 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Fri, 2 Mar 2018 18:16:05 +0900 Subject: [PATCH] put efl app test back with mods to match app as superclass --- src/Makefile_Ecore.am | 49 +++++++++++++- src/tests/ecore/ecore_test_ecore.c | 63 ------------------ src/tests/ecore/efl_app_suite.c | 103 +++++++++++++++++++++++++++++ src/tests/ecore/efl_app_suite.h | 8 +++ 4 files changed, 158 insertions(+), 65 deletions(-) create mode 100644 src/tests/ecore/efl_app_suite.c create mode 100644 src/tests/ecore/efl_app_suite.h diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am index 630977846d..238d7acb89 100644 --- a/src/Makefile_Ecore.am +++ b/src/Makefile_Ecore.am @@ -267,8 +267,8 @@ endif if EFL_ENABLE_TESTS -check_PROGRAMS += tests/ecore/ecore_suite -TESTS += tests/ecore/ecore_suite +check_PROGRAMS += tests/ecore/ecore_suite tests/ecore/efl_app_suite +TESTS += tests/ecore/ecore_suite tests/ecore/efl_app_suite tests_ecore_ecore_suite_SOURCES = \ tests/ecore/ecore_suite.c \ @@ -327,6 +327,51 @@ tests_ecore_ecore_suite_DEPENDENCIES = \ @USE_ECORE_FB_INTERNAL_LIBS@ \ @USE_ECORE_INPUT_INTERNAL_LIBS@ +tests_ecore_efl_app_suite_SOURCES = \ +tests/ecore/efl_app_suite.c \ +tests/ecore/efl_app_suite.h + +tests_ecore_efl_app_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ +-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/ecore\" \ +-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/ecore\" \ +@CHECK_CFLAGS@ \ +@ECORE_CFLAGS@ \ +@ECORE_AUDIO_CFLAGS@ \ +@ECORE_FILE_CFLAGS@ \ +@ECORE_X_CFLAGS@ \ +@ECORE_IMF_CFLAGS@ \ +@ECORE_EVAS_CFLAGS@ \ +@ECORE_WAYLAND_CFLAGS@ \ +@ECORE_WAYLAND_SRV_CFLAGS@ \ +@ECORE_DRM_CFLAGS@ \ +@ECORE_FB_CFLAGS@ \ +@ECORE_INPUT_CFLAGS@ + +tests_ecore_efl_app_suite_LDADD = \ +@CHECK_LIBS@ \ +@USE_ECORE_LIBS@ \ +@USE_ECORE_AUDIO_LIBS@ \ +@USE_ECORE_FILE_LIBS@ \ +@USE_ECORE_X_LIBS@ \ +@USE_ECORE_IMF_LIBS@ \ +@USE_ECORE_EVAS_LIBS@ \ +@USE_ECORE_WAYLAND_LIBS@ \ +@USE_ECORE_FB_LIBS@ \ +@ECORE_WAYLAND_SRV_LIBS@ \ +@ECORE_DRM_LIBS@ \ +@USE_ECORE_INPUT_LIBS@ +tests_ecore_efl_app_suite_DEPENDENCIES = \ +@USE_ECORE_INTERNAL_LIBS@ \ +@USE_ECORE_AUDIO_INTERNAL_LIBS@ \ +@USE_ECORE_FILE_INTERNAL_LIBS@ \ +@USE_ECORE_X_INTERNAL_LIBS@ \ +@USE_ECORE_IMF_INTERNAL_LIBS@ \ +@USE_ECORE_EVAS_INTERNAL_LIBS@ \ +@USE_ECORE_WAYLAND_INTERNAL_LIBS@ \ +@USE_ECORE_DRM_INTERNAL_LIBS@ \ +@USE_ECORE_FB_INTERNAL_LIBS@ \ +@USE_ECORE_INPUT_INTERNAL_LIBS@ + if HAVE_ECORE_X tests_ecore_ecore_suite_SOURCES += tests/ecore/ecore_test_ecore_x.c endif diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c index 6fd95738f4..fd31285503 100644 --- a/src/tests/ecore/ecore_test_ecore.c +++ b/src/tests/ecore/ecore_test_ecore.c @@ -857,67 +857,6 @@ START_TEST(ecore_test_ecore_main_loop_poller_add_del) } END_TEST -START_TEST(ecore_test_efl_loop_register) -{ - Efl_Object *t, *n; - - ecore_init(); - - t = efl_provider_find(efl_main_loop_get(), EFL_LOOP_CLASS); - fail_if(!efl_isa(t, EFL_LOOP_CLASS)); - - t = efl_provider_find(efl_main_loop_get(), EFL_LOOP_TIMER_CLASS); - fail_if(t != NULL); - - n = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get()); - fail_if(n != NULL); - - n = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get(), - efl_loop_timer_interval_set(efl_added, 1.0)); - efl_loop_register(efl_main_loop_get(), EFL_LOOP_TIMER_CLASS, n); - - t = efl_provider_find(efl_main_loop_get(), EFL_LOOP_TIMER_CLASS); - fail_if(!efl_isa(t, EFL_LOOP_TIMER_CLASS)); - fail_if(t != n); - - efl_loop_unregister(efl_main_loop_get(), EFL_LOOP_TIMER_CLASS, n); - - t = efl_provider_find(efl_main_loop_get(), EFL_LOOP_TIMER_CLASS); - fail_if(t != NULL); - - ecore_shutdown(); -} -END_TEST - -START_TEST(ecore_test_efl_app_version) -{ - const Efl_Version *ver; - Eo *loop; - - ecore_init(); - - loop = efl_app_loop_main_get(EFL_APP_CLASS); - fail_if(!efl_isa(loop, EFL_LOOP_CLASS)); - - efl_build_version_set(EFL_VERSION_MAJOR, EFL_VERSION_MINOR, 0, 0, NULL, EFL_BUILD_ID); - ver = efl_app_build_efl_version_get(loop); - fail_if(!ver); - fail_if(ver->major != EFL_VERSION_MAJOR); - fail_if(ver->minor != EFL_VERSION_MINOR); - fail_if(ver->micro != 0); - fail_if(ver->revision != 0); - fail_if(ver->flavor); - fail_if(!eina_streq(ver->build_id, EFL_BUILD_ID)); - - ver = efl_app_efl_version_get(loop); - fail_if(!ver); - fail_if(ver->major != EFL_VERSION_MAJOR); - fail_if(ver->minor != EFL_VERSION_MINOR); - - ecore_shutdown(); -} -END_TEST - void ecore_test_ecore(TCase *tc) { tcase_add_test(tc, ecore_test_ecore_init); @@ -940,6 +879,4 @@ void ecore_test_ecore(TCase *tc) tcase_add_test(tc, ecore_test_ecore_main_loop_poller_add_del); tcase_add_test(tc, ecore_test_efl_loop_fd); tcase_add_test(tc, ecore_test_efl_loop_fd_lifecycle); - tcase_add_test(tc, ecore_test_efl_loop_register); - tcase_add_test(tc, ecore_test_efl_app_version); } diff --git a/src/tests/ecore/efl_app_suite.c b/src/tests/ecore/efl_app_suite.c new file mode 100644 index 0000000000..173615252d --- /dev/null +++ b/src/tests/ecore/efl_app_suite.c @@ -0,0 +1,103 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#define EFL_NOLEGACY_API_SUPPORT +#include +#include +#include "efl_app_suite.h" +#include "../efl_check.h" + +START_TEST(efl_app_test_efl_loop_register) +{ + Efl_Object *t, *n; + + ecore_init(); + + t = efl_provider_find(efl_app_get(), EFL_LOOP_CLASS); + fail_if(!efl_isa(t, EFL_LOOP_CLASS)); + fail_if(!efl_isa(t, EFL_APP_CLASS)); + + t = efl_provider_find(efl_app_get(), EFL_LOOP_TIMER_CLASS); + fail_if(t != NULL); + + n = efl_add(EFL_LOOP_TIMER_CLASS, efl_app_get()); + fail_if(n != NULL); + + n = efl_add(EFL_LOOP_TIMER_CLASS, efl_app_get(), + efl_loop_timer_interval_set(efl_added, 1.0)); + efl_loop_register(efl_app_get(), EFL_LOOP_TIMER_CLASS, n); + + t = efl_provider_find(efl_app_get(), EFL_LOOP_TIMER_CLASS); + fail_if(!efl_isa(t, EFL_LOOP_TIMER_CLASS)); + fail_if(t != n); + + efl_loop_unregister(efl_app_get(), EFL_LOOP_TIMER_CLASS, n); + + t = efl_provider_find(efl_app_get(), EFL_LOOP_TIMER_CLASS); + fail_if(t != NULL); + + ecore_shutdown(); +} +END_TEST + +START_TEST(efl_app_test_efl_build_version) +{ + const Efl_Version *ver; + Eo *app; + + ecore_init(); + + app = efl_app_get(); + fail_if(!efl_isa(app, EFL_APP_CLASS)); + + efl_build_version_set(EFL_VERSION_MAJOR, EFL_VERSION_MINOR, 0, 0, NULL, EFL_BUILD_ID); + ver = efl_app_build_efl_version_get(app); + fail_if(!ver); + fail_if(ver->major != EFL_VERSION_MAJOR); + fail_if(ver->minor != EFL_VERSION_MINOR); + fail_if(ver->micro != 0); + fail_if(ver->revision != 0); + fail_if(ver->flavor); + fail_if(!eina_streq(ver->build_id, EFL_BUILD_ID)); + + ver = efl_app_efl_version_get(app); + fail_if(!ver); + fail_if(ver->major != EFL_VERSION_MAJOR); + fail_if(ver->minor != EFL_VERSION_MINOR); + + ecore_shutdown(); +} +END_TEST + +void efl_test_efl_app(TCase *tc) +{ + tcase_add_test(tc, efl_app_test_efl_loop_register); + tcase_add_test(tc, efl_app_test_efl_build_version); +} + + +static const Efl_Test_Case etc[] = { + { "Efl_App", efl_test_efl_app }, + { 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_App", etc); + + return (failed_count == 0) ? 0 : 255; +} diff --git a/src/tests/ecore/efl_app_suite.h b/src/tests/ecore/efl_app_suite.h new file mode 100644 index 0000000000..c04dcbe37f --- /dev/null +++ b/src/tests/ecore/efl_app_suite.h @@ -0,0 +1,8 @@ +#ifndef _EFL_APP_SUITE_H +#define _EFL_APP_SUITE_H + +#include + +void efl_app_test_efl_app(TCase *tc); + +#endif /* _EFL_APP_SUITE_H */