summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-04-08 13:19:56 +0900
committerHermet Park <hermetpark@gmail.com>2019-04-08 13:19:56 +0900
commit15c3843b55600243053e23b0f8ea030fb5cdfc04 (patch)
treeeff6141dff20f98f9cdc39d8932802ed840d7a62
parent31cf281bdd5723ac9fc6b82a4f89790cad5abeb2 (diff)
tests: add evas render test for callbacks
Summary: verify that all callbacks can be incrementally added and triggered during a sync render (which is the rendering used in unit testing) Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl_tests Differential Revision: https://phab.enlightenment.org/D8505
-rw-r--r--src/Makefile_Evas.am1
-rw-r--r--src/tests/evas/evas_test_render_engines.c56
-rw-r--r--src/tests/evas/meson.build1
3 files changed, 58 insertions, 0 deletions
diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am
index 6fddfd75e3..3dc49ce4d5 100644
--- a/src/Makefile_Evas.am
+++ b/src/Makefile_Evas.am
@@ -2254,6 +2254,7 @@ tests/evas/evas_suite.h
2254tests_evas_evas_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ 2254tests_evas_evas_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
2255-I$(top_srcdir)/src/lib/ecore_evas \ 2255-I$(top_srcdir)/src/lib/ecore_evas \
2256-I$(top_builddir)/src/lib/evas/canvas \ 2256-I$(top_builddir)/src/lib/evas/canvas \
2257-I$(top_srcdir)/src/modules/evas/engines/buffer \
2257-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \ 2258-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
2258-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \ 2259-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \
2259-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/evas\" \ 2260-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/evas\" \
diff --git a/src/tests/evas/evas_test_render_engines.c b/src/tests/evas/evas_test_render_engines.c
index 6e9aef730a..f336bf1928 100644
--- a/src/tests/evas/evas_test_render_engines.c
+++ b/src/tests/evas/evas_test_render_engines.c
@@ -5,8 +5,10 @@
5#include <stdio.h> 5#include <stdio.h>
6 6
7#include <Evas.h> 7#include <Evas.h>
8#include <Evas_Engine_Buffer.h>
8 9
9#include "evas_suite.h" 10#include "evas_suite.h"
11#include "evas_tests_helpers.h"
10 12
11static Eina_Bool 13static Eina_Bool
12_find_list(const Eina_List *lst, const char *item) 14_find_list(const Eina_List *lst, const char *item)
@@ -75,8 +77,62 @@ EFL_START_TEST(evas_render_lookup)
75} 77}
76EFL_END_TEST 78EFL_END_TEST
77 79
80static unsigned int counter;
81
82static void
83render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
84{
85 counter++;
86}
87
88static void
89render_flush_post(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
90{
91 counter++;
92 evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, render_post, NULL);
93}
94
95static void
96render_flush_pre(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
97{
98 counter++;
99 evas_event_callback_add(e, EVAS_CALLBACK_RENDER_FLUSH_POST, render_flush_post, NULL);
100}
101
102static void
103render_pre(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
104{
105 counter++;
106 evas_event_callback_add(e, EVAS_CALLBACK_RENDER_FLUSH_PRE, render_flush_pre, NULL);
107}
108
109EFL_START_TEST(evas_render_callbacks)
110{
111 Evas_Object *rect;
112 Evas *evas = EVAS_TEST_INIT_EVAS();
113 Evas_Engine_Info_Buffer *einfo;
114
115 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(evas);
116 /* 500 x 500 */
117 einfo->info.dest_buffer_row_bytes = 500 * sizeof(int);
118 einfo->info.dest_buffer = malloc(einfo->info.dest_buffer_row_bytes * 500);
119 ck_assert(evas_engine_info_set(evas, (Evas_Engine_Info *)einfo));
120
121 rect = evas_object_rectangle_add(evas);
122 evas_object_color_set(rect, 255, 0, 0, 255);
123 evas_object_resize(rect, 500, 500);
124 evas_object_show(rect);
125
126 evas_event_callback_add(evas, EVAS_CALLBACK_RENDER_PRE, render_pre, NULL);
127 evas_render(evas);
128 ck_assert_int_eq(counter, 4);
129 evas_free(evas);
130}
131EFL_END_TEST
132
78void evas_test_render_engines(TCase *tc) 133void evas_test_render_engines(TCase *tc)
79{ 134{
80 tcase_add_test(tc, evas_render_engines); 135 tcase_add_test(tc, evas_render_engines);
81 tcase_add_test(tc, evas_render_lookup); 136 tcase_add_test(tc, evas_render_lookup);
137 tcase_add_test(tc, evas_render_callbacks);
82} 138}
diff --git a/src/tests/evas/meson.build b/src/tests/evas/meson.build
index 62898cd241..5c06ff79ff 100644
--- a/src/tests/evas/meson.build
+++ b/src/tests/evas/meson.build
@@ -21,6 +21,7 @@ evas_suite_src = [
21evas_suite = executable('evas_suite', 21evas_suite = executable('evas_suite',
22 evas_suite_src, 22 evas_suite_src,
23 dependencies: [evas_bin, evas, ecore_evas, dl, check], 23 dependencies: [evas_bin, evas, ecore_evas, dl, check],
24 include_directories: include_directories(join_paths('..', '..', 'modules', 'evas', 'engines', 'buffer')),
24 c_args : [ 25 c_args : [
25 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', 26 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
26 '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"'] 27 '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']