forked from enlightenment/efl
evas_callbacks: fix emission of EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED
Summary: When I add "efl_event_callback_add(btn, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, _cb, NULL)", _cb is not called. Because of callback_mask is not set correctly. Test Plan: unit test Reviewers: zmike, cedric Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8528
This commit is contained in:
parent
894c7af10a
commit
55751f1204
|
@ -1937,6 +1937,7 @@ tests_elementary_efl_ui_suite_SOURCES = \
|
|||
tests/elementary/efl_ui_build.c \
|
||||
tests/elementary/elm_test_init.c \
|
||||
tests/elementary/efl_ui_test_atspi.c \
|
||||
tests/elementary/efl_ui_test_callback.c \
|
||||
tests/elementary/efl_ui_test_focus_common.c \
|
||||
tests/elementary/efl_ui_test_focus_common.h \
|
||||
tests/elementary/efl_ui_test_focus.c \
|
||||
|
|
|
@ -831,6 +831,11 @@ _check_event_catcher_add(void *data, const Efl_Event *event)
|
|||
{
|
||||
obj->callback_mask |= (((uint64_t)1) << type);
|
||||
}
|
||||
else if (array[i].desc == EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED)
|
||||
{
|
||||
obj->callback_mask |= (((uint64_t)1) << EVAS_CALLBACK_SHOW);
|
||||
obj->callback_mask |= (((uint64_t)1) << EVAS_CALLBACK_HIDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ static const Efl_Test_Case etc[] = {
|
|||
//{ "elm_focus_sub", elm_test_focus_sub},
|
||||
//{ "elm_widget_focus", elm_test_widget_focus},
|
||||
{ "efl_ui_atspi", efl_ui_test_atspi},
|
||||
{ "efl_ui_callback", efl_ui_test_callback},
|
||||
{ "efl_ui_focus", efl_ui_test_focus},
|
||||
{ "efl_ui_focus_sub", efl_ui_test_focus_sub},
|
||||
{ "efl_ui_box", efl_ui_test_box},
|
||||
|
|
|
@ -29,6 +29,7 @@ void efl_ui_test_atspi(TCase *tc);
|
|||
void efl_ui_test_image_zoomable(TCase *tc);
|
||||
void efl_ui_test_layout(TCase *tc);
|
||||
void efl_ui_test_image(TCase *tc);
|
||||
void efl_ui_test_callback(TCase *tc);
|
||||
|
||||
void efl_ui_test_focus(TCase *tc);
|
||||
void efl_ui_test_focus_sub(TCase *tc);
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#include <Efl_Ui.h>
|
||||
#include <Elementary.h>
|
||||
#include "elm_suite.h"
|
||||
|
||||
static Eo *win;
|
||||
|
||||
static void
|
||||
callback_setup()
|
||||
{
|
||||
win = win_add();
|
||||
|
||||
efl_gfx_entity_size_set(win, EINA_SIZE2D(500, 50));
|
||||
}
|
||||
|
||||
static void
|
||||
_btn_visibility_change(void *data EINA_UNUSED, const Efl_Event *ev)
|
||||
{
|
||||
Eina_Bool *flag = data;
|
||||
Eina_Bool *visible = ev->info;
|
||||
|
||||
if (!(*visible))
|
||||
*flag = EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
callback_timer_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||
{
|
||||
ck_assert(0);
|
||||
efl_del(event->object);
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
EFL_START_TEST(efl_ui_callback_visibility)
|
||||
{
|
||||
Eina_Bool check = EINA_FALSE;
|
||||
Eo *box = efl_add(EFL_UI_BOX_CLASS, win,
|
||||
efl_content_set(win, efl_added));
|
||||
efl_event_callback_add(box, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, _btn_visibility_change, &check);
|
||||
efl_gfx_entity_visible_set(box, EINA_FALSE);
|
||||
|
||||
ck_assert_int_eq(check, EINA_TRUE);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void efl_ui_test_callback(TCase *tc)
|
||||
{
|
||||
tcase_add_checked_fixture(tc, callback_setup, NULL);
|
||||
tcase_add_test(tc, efl_ui_callback_visibility);
|
||||
}
|
|
@ -120,6 +120,7 @@ efl_ui_suite_src = [
|
|||
'suite_helpers.h',
|
||||
'elm_test_init.c',
|
||||
'efl_ui_test_atspi.c',
|
||||
'efl_ui_test_callback.c',
|
||||
'efl_ui_test_focus_common.c',
|
||||
'efl_ui_test_focus_common.h',
|
||||
'efl_ui_test_focus.c',
|
||||
|
|
Loading…
Reference in New Issue