forked from enlightenment/efl
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
This commit is contained in:
parent
31cf281bdd
commit
15c3843b55
|
@ -2254,6 +2254,7 @@ tests/evas/evas_suite.h
|
||||||
tests_evas_evas_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
tests_evas_evas_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||||
-I$(top_srcdir)/src/lib/ecore_evas \
|
-I$(top_srcdir)/src/lib/ecore_evas \
|
||||||
-I$(top_builddir)/src/lib/evas/canvas \
|
-I$(top_builddir)/src/lib/evas/canvas \
|
||||||
|
-I$(top_srcdir)/src/modules/evas/engines/buffer \
|
||||||
-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
|
-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
|
||||||
-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \
|
-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/evas\" \
|
||||||
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/evas\" \
|
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/evas\" \
|
||||||
|
|
|
@ -5,8 +5,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
|
#include <Evas_Engine_Buffer.h>
|
||||||
|
|
||||||
#include "evas_suite.h"
|
#include "evas_suite.h"
|
||||||
|
#include "evas_tests_helpers.h"
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_find_list(const Eina_List *lst, const char *item)
|
_find_list(const Eina_List *lst, const char *item)
|
||||||
|
@ -75,8 +77,62 @@ EFL_START_TEST(evas_render_lookup)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
EFL_END_TEST
|
||||||
|
|
||||||
|
static unsigned int counter;
|
||||||
|
|
||||||
|
static void
|
||||||
|
render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
render_flush_post(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, render_post, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
render_flush_pre(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
evas_event_callback_add(e, EVAS_CALLBACK_RENDER_FLUSH_POST, render_flush_post, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
render_pre(void *data EINA_UNUSED, Evas *e, void *event_info EINA_UNUSED)
|
||||||
|
{
|
||||||
|
counter++;
|
||||||
|
evas_event_callback_add(e, EVAS_CALLBACK_RENDER_FLUSH_PRE, render_flush_pre, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
EFL_START_TEST(evas_render_callbacks)
|
||||||
|
{
|
||||||
|
Evas_Object *rect;
|
||||||
|
Evas *evas = EVAS_TEST_INIT_EVAS();
|
||||||
|
Evas_Engine_Info_Buffer *einfo;
|
||||||
|
|
||||||
|
einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(evas);
|
||||||
|
/* 500 x 500 */
|
||||||
|
einfo->info.dest_buffer_row_bytes = 500 * sizeof(int);
|
||||||
|
einfo->info.dest_buffer = malloc(einfo->info.dest_buffer_row_bytes * 500);
|
||||||
|
ck_assert(evas_engine_info_set(evas, (Evas_Engine_Info *)einfo));
|
||||||
|
|
||||||
|
rect = evas_object_rectangle_add(evas);
|
||||||
|
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||||
|
evas_object_resize(rect, 500, 500);
|
||||||
|
evas_object_show(rect);
|
||||||
|
|
||||||
|
evas_event_callback_add(evas, EVAS_CALLBACK_RENDER_PRE, render_pre, NULL);
|
||||||
|
evas_render(evas);
|
||||||
|
ck_assert_int_eq(counter, 4);
|
||||||
|
evas_free(evas);
|
||||||
|
}
|
||||||
|
EFL_END_TEST
|
||||||
|
|
||||||
void evas_test_render_engines(TCase *tc)
|
void evas_test_render_engines(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, evas_render_engines);
|
tcase_add_test(tc, evas_render_engines);
|
||||||
tcase_add_test(tc, evas_render_lookup);
|
tcase_add_test(tc, evas_render_lookup);
|
||||||
|
tcase_add_test(tc, evas_render_callbacks);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ evas_suite_src = [
|
||||||
evas_suite = executable('evas_suite',
|
evas_suite = executable('evas_suite',
|
||||||
evas_suite_src,
|
evas_suite_src,
|
||||||
dependencies: [evas_bin, evas, ecore_evas, dl, check],
|
dependencies: [evas_bin, evas, ecore_evas, dl, check],
|
||||||
|
include_directories: include_directories(join_paths('..', '..', 'modules', 'evas', 'engines', 'buffer')),
|
||||||
c_args : [
|
c_args : [
|
||||||
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
|
'-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
|
||||||
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
|
'-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
|
||||||
|
|
Loading…
Reference in New Issue