zmike pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=55751f12044c5939b189d9ef149d82e8f331811a

commit 55751f12044c5939b189d9ef149d82e8f331811a
Author: Hosang Kim <hosang12....@samsung.com>
Date:   Wed Apr 3 09:26:50 2019 -0400

    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
---
 src/Makefile_Elementary.am                  |  1 +
 src/lib/evas/canvas/evas_callbacks.c        |  5 +++
 src/tests/elementary/efl_ui_suite.c         |  1 +
 src/tests/elementary/efl_ui_suite.h         |  1 +
 src/tests/elementary/efl_ui_test_callback.c | 53 +++++++++++++++++++++++++++++
 src/tests/elementary/meson.build            |  1 +
 6 files changed, 62 insertions(+)

diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 8de301999e..e4a46399bc 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -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 \
diff --git a/src/lib/evas/canvas/evas_callbacks.c 
b/src/lib/evas/canvas/evas_callbacks.c
index f5dbb15353..dcd3338dd6 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.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);
+          }
      }
 }
 
diff --git a/src/tests/elementary/efl_ui_suite.c 
b/src/tests/elementary/efl_ui_suite.c
index 097f432e8a..a1ba34f1f4 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -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},
diff --git a/src/tests/elementary/efl_ui_suite.h 
b/src/tests/elementary/efl_ui_suite.h
index 3755a0e56f..5282949eb5 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -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);
diff --git a/src/tests/elementary/efl_ui_test_callback.c 
b/src/tests/elementary/efl_ui_test_callback.c
new file mode 100644
index 0000000000..76230499f0
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_callback.c
@@ -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);
+}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 987913aef2..51120beca8 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -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',

-- 


Reply via email to