summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-02-26 13:18:54 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-02-26 14:02:51 -0500
commit3e94be5d73256a7f5c02d3a9474173226be7beff (patch)
treee4dc2ae168815cb2d0aadb14a52db72caec9588e
parent28fe00b94e55575c15684959b89a614d5a579309 (diff)
efl: add test suite for efl_app
this moves existing tests out of the ecore suite and into a new one, adds some checks to verify loop object parenting, and verifies compile for Efl_Core.h and Efl_Net.h using EFL_NOLEGACY_API_SUPPORT
-rw-r--r--src/Makefile_Ecore.am49
-rw-r--r--src/tests/ecore/ecore_test_ecore.c63
-rw-r--r--src/tests/ecore/efl_app_suite.c106
-rw-r--r--src/tests/ecore/efl_app_suite.h8
4 files changed, 161 insertions, 65 deletions
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index a758ebf9aa..01d581b280 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -264,8 +264,8 @@ endif
264 264
265if EFL_ENABLE_TESTS 265if EFL_ENABLE_TESTS
266 266
267check_PROGRAMS += tests/ecore/ecore_suite 267check_PROGRAMS += tests/ecore/ecore_suite tests/ecore/efl_app_suite
268TESTS += tests/ecore/ecore_suite 268TESTS += tests/ecore/ecore_suite tests/ecore/efl_app_suite
269 269
270tests_ecore_ecore_suite_SOURCES = \ 270tests_ecore_ecore_suite_SOURCES = \
271tests/ecore/ecore_suite.c \ 271tests/ecore/ecore_suite.c \
@@ -324,6 +324,51 @@ tests_ecore_ecore_suite_DEPENDENCIES = \
324@USE_ECORE_FB_INTERNAL_LIBS@ \ 324@USE_ECORE_FB_INTERNAL_LIBS@ \
325@USE_ECORE_INPUT_INTERNAL_LIBS@ 325@USE_ECORE_INPUT_INTERNAL_LIBS@
326 326
327tests_ecore_efl_app_suite_SOURCES = \
328tests/ecore/efl_app_suite.c \
329tests/ecore/efl_app_suite.h
330
331tests_ecore_efl_app_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
332-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/ecore\" \
333-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/ecore\" \
334@CHECK_CFLAGS@ \
335@ECORE_CFLAGS@ \
336@ECORE_AUDIO_CFLAGS@ \
337@ECORE_FILE_CFLAGS@ \
338@ECORE_X_CFLAGS@ \
339@ECORE_IMF_CFLAGS@ \
340@ECORE_EVAS_CFLAGS@ \
341@ECORE_WAYLAND_CFLAGS@ \
342@ECORE_WAYLAND_SRV_CFLAGS@ \
343@ECORE_DRM_CFLAGS@ \
344@ECORE_FB_CFLAGS@ \
345@ECORE_INPUT_CFLAGS@
346
347tests_ecore_efl_app_suite_LDADD = \
348@CHECK_LIBS@ \
349@USE_ECORE_LIBS@ \
350@USE_ECORE_AUDIO_LIBS@ \
351@USE_ECORE_FILE_LIBS@ \
352@USE_ECORE_X_LIBS@ \
353@USE_ECORE_IMF_LIBS@ \
354@USE_ECORE_EVAS_LIBS@ \
355@USE_ECORE_WAYLAND_LIBS@ \
356@USE_ECORE_FB_LIBS@ \
357@ECORE_WAYLAND_SRV_LIBS@ \
358@ECORE_DRM_LIBS@ \
359@USE_ECORE_INPUT_LIBS@
360tests_ecore_efl_app_suite_DEPENDENCIES = \
361@USE_ECORE_INTERNAL_LIBS@ \
362@USE_ECORE_AUDIO_INTERNAL_LIBS@ \
363@USE_ECORE_FILE_INTERNAL_LIBS@ \
364@USE_ECORE_X_INTERNAL_LIBS@ \
365@USE_ECORE_IMF_INTERNAL_LIBS@ \
366@USE_ECORE_EVAS_INTERNAL_LIBS@ \
367@USE_ECORE_WAYLAND_INTERNAL_LIBS@ \
368@USE_ECORE_DRM_INTERNAL_LIBS@ \
369@USE_ECORE_FB_INTERNAL_LIBS@ \
370@USE_ECORE_INPUT_INTERNAL_LIBS@
371
327if HAVE_ECORE_X 372if HAVE_ECORE_X
328tests_ecore_ecore_suite_SOURCES += tests/ecore/ecore_test_ecore_x.c 373tests_ecore_ecore_suite_SOURCES += tests/ecore/ecore_test_ecore_x.c
329endif 374endif
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index de04c643cc..f94e9055b5 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)
857} 857}
858END_TEST 858END_TEST
859 859
860START_TEST(ecore_test_efl_loop_register)
861{
862 Efl_Object *t, *n;
863
864 ecore_init();
865
866 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_CLASS);
867 fail_if(!efl_isa(t, EFL_LOOP_CLASS));
868
869 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS);
870 fail_if(t != NULL);
871
872 n = efl_add(EFL_LOOP_TIMER_CLASS, efl_app_main_loop_get(efl_app_get()));
873 fail_if(n != NULL);
874
875 n = efl_add(EFL_LOOP_TIMER_CLASS, efl_app_main_loop_get(efl_app_get()),
876 efl_loop_timer_interval_set(efl_added, 1.0));
877 efl_loop_register(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS, n);
878
879 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS);
880 fail_if(!efl_isa(t, EFL_LOOP_TIMER_CLASS));
881 fail_if(t != n);
882
883 efl_loop_unregister(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS, n);
884
885 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS);
886 fail_if(t != NULL);
887
888 ecore_shutdown();
889}
890END_TEST
891
892START_TEST(ecore_test_efl_build_version)
893{
894 const Efl_Version *ver;
895 Eo *app;
896
897 ecore_init();
898
899 app = efl_app_get();
900 fail_if(!efl_isa(app, EFL_APP_CLASS));
901
902 efl_build_version_set(EFL_VERSION_MAJOR, EFL_VERSION_MINOR, 0, 0, NULL, EFL_BUILD_ID);
903 ver = efl_app_build_efl_version_get(app);
904 fail_if(!ver);
905 fail_if(ver->major != EFL_VERSION_MAJOR);
906 fail_if(ver->minor != EFL_VERSION_MINOR);
907 fail_if(ver->micro != 0);
908 fail_if(ver->revision != 0);
909 fail_if(ver->flavor);
910 fail_if(!eina_streq(ver->build_id, EFL_BUILD_ID));
911
912 ver = efl_app_efl_version_get(app);
913 fail_if(!ver);
914 fail_if(ver->major != EFL_VERSION_MAJOR);
915 fail_if(ver->minor != EFL_VERSION_MINOR);
916
917 ecore_shutdown();
918}
919END_TEST
920
921void ecore_test_ecore(TCase *tc) 860void ecore_test_ecore(TCase *tc)
922{ 861{
923 tcase_add_test(tc, ecore_test_ecore_init); 862 tcase_add_test(tc, ecore_test_ecore_init);
@@ -940,6 +879,4 @@ void ecore_test_ecore(TCase *tc)
940 tcase_add_test(tc, ecore_test_ecore_main_loop_poller_add_del); 879 tcase_add_test(tc, ecore_test_ecore_main_loop_poller_add_del);
941 tcase_add_test(tc, ecore_test_efl_loop_fd); 880 tcase_add_test(tc, ecore_test_efl_loop_fd);
942 tcase_add_test(tc, ecore_test_efl_loop_fd_lifecycle); 881 tcase_add_test(tc, ecore_test_efl_loop_fd_lifecycle);
943 tcase_add_test(tc, ecore_test_efl_loop_register);
944 tcase_add_test(tc, ecore_test_efl_build_version);
945} 882}
diff --git a/src/tests/ecore/efl_app_suite.c b/src/tests/ecore/efl_app_suite.c
new file mode 100644
index 0000000000..7bd52d58b0
--- /dev/null
+++ b/src/tests/ecore/efl_app_suite.c
@@ -0,0 +1,106 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#include <stdio.h>
6#include <unistd.h>
7#define EFL_NOLEGACY_API_SUPPORT
8#include <Efl_Core.h>
9#include <Efl_Net.h>
10#include "efl_app_suite.h"
11#include "../efl_check.h"
12
13START_TEST(efl_app_test_efl_loop_register)
14{
15 Efl_Object *t, *n, *parent;
16
17 ecore_init();
18
19 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_CLASS);
20 fail_if(!efl_isa(t, EFL_LOOP_CLASS));
21
22 parent = efl_parent_get(t);
23 fail_if(!efl_isa(parent, EFL_APP_CLASS));
24 fail_if(parent != efl_app_get());
25
26 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS);
27 fail_if(t != NULL);
28
29 n = efl_add(EFL_LOOP_TIMER_CLASS, efl_app_main_loop_get(efl_app_get()));
30 fail_if(n != NULL);
31
32 n = efl_add(EFL_LOOP_TIMER_CLASS, efl_app_main_loop_get(efl_app_get()),
33 efl_loop_timer_interval_set(efl_added, 1.0));
34 efl_loop_register(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS, n);
35
36 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS);
37 fail_if(!efl_isa(t, EFL_LOOP_TIMER_CLASS));
38 fail_if(t != n);
39
40 efl_loop_unregister(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS, n);
41
42 t = efl_provider_find(efl_app_main_loop_get(efl_app_get()), EFL_LOOP_TIMER_CLASS);
43 fail_if(t != NULL);
44
45 ecore_shutdown();
46}
47END_TEST
48
49START_TEST(efl_app_test_efl_build_version)
50{
51 const Efl_Version *ver;
52 Eo *app;
53
54 ecore_init();
55
56 app = efl_app_get();
57 fail_if(!efl_isa(app, EFL_APP_CLASS));
58
59 efl_build_version_set(EFL_VERSION_MAJOR, EFL_VERSION_MINOR, 0, 0, NULL, EFL_BUILD_ID);
60 ver = efl_app_build_efl_version_get(app);
61 fail_if(!ver);
62 fail_if(ver->major != EFL_VERSION_MAJOR);
63 fail_if(ver->minor != EFL_VERSION_MINOR);
64 fail_if(ver->micro != 0);
65 fail_if(ver->revision != 0);
66 fail_if(ver->flavor);
67 fail_if(!eina_streq(ver->build_id, EFL_BUILD_ID));
68
69 ver = efl_app_efl_version_get(app);
70 fail_if(!ver);
71 fail_if(ver->major != EFL_VERSION_MAJOR);
72 fail_if(ver->minor != EFL_VERSION_MINOR);
73
74 ecore_shutdown();
75}
76END_TEST
77
78void efl_test_efl_app(TCase *tc)
79{
80 tcase_add_test(tc, efl_app_test_efl_loop_register);
81 tcase_add_test(tc, efl_app_test_efl_build_version);
82}
83
84
85static const Efl_Test_Case etc[] = {
86 { "Efl_App", efl_test_efl_app },
87 { NULL, NULL }
88};
89
90int
91main(int argc, char **argv)
92{
93 int failed_count;
94
95 if (!_efl_test_option_disp(argc, argv, etc))
96 return 0;
97
98#ifdef NEED_RUN_IN_TREE
99 putenv("EFL_RUN_IN_TREE=1");
100#endif
101
102 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
103 "Efl_App", etc);
104
105 return (failed_count == 0) ? 0 : 255;
106}
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 @@
1#ifndef _EFL_APP_SUITE_H
2#define _EFL_APP_SUITE_H
3
4#include <check.h>
5
6void efl_app_test_efl_app(TCase *tc);
7
8#endif /* _EFL_APP_SUITE_H */