summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2019-04-03 09:26:50 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-04-03 09:32:21 -0400
commit55751f12044c5939b189d9ef149d82e8f331811a (patch)
treec4aa8e6af7a2c1351815d6862937c85dc099ddb3 /src/tests
parent894c7af10a1bf4fb2220a0db6462865ab2748a46 (diff)
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
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/efl_ui_suite.c1
-rw-r--r--src/tests/elementary/efl_ui_suite.h1
-rw-r--r--src/tests/elementary/efl_ui_test_callback.c53
-rw-r--r--src/tests/elementary/meson.build1
4 files changed, 56 insertions, 0 deletions
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[] = {
10 //{ "elm_focus_sub", elm_test_focus_sub}, 10 //{ "elm_focus_sub", elm_test_focus_sub},
11 //{ "elm_widget_focus", elm_test_widget_focus}, 11 //{ "elm_widget_focus", elm_test_widget_focus},
12 { "efl_ui_atspi", efl_ui_test_atspi}, 12 { "efl_ui_atspi", efl_ui_test_atspi},
13 { "efl_ui_callback", efl_ui_test_callback},
13 { "efl_ui_focus", efl_ui_test_focus}, 14 { "efl_ui_focus", efl_ui_test_focus},
14 { "efl_ui_focus_sub", efl_ui_test_focus_sub}, 15 { "efl_ui_focus_sub", efl_ui_test_focus_sub},
15 { "efl_ui_box", efl_ui_test_box}, 16 { "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);
29void efl_ui_test_image_zoomable(TCase *tc); 29void efl_ui_test_image_zoomable(TCase *tc);
30void efl_ui_test_layout(TCase *tc); 30void efl_ui_test_layout(TCase *tc);
31void efl_ui_test_image(TCase *tc); 31void efl_ui_test_image(TCase *tc);
32void efl_ui_test_callback(TCase *tc);
32 33
33void efl_ui_test_focus(TCase *tc); 34void efl_ui_test_focus(TCase *tc);
34void efl_ui_test_focus_sub(TCase *tc); 35void 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 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Efl_Ui.h>
6#include <Elementary.h>
7#include "elm_suite.h"
8
9static Eo *win;
10
11static void
12callback_setup()
13{
14 win = win_add();
15
16 efl_gfx_entity_size_set(win, EINA_SIZE2D(500, 50));
17}
18
19static void
20_btn_visibility_change(void *data EINA_UNUSED, const Efl_Event *ev)
21{
22 Eina_Bool *flag = data;
23 Eina_Bool *visible = ev->info;
24
25 if (!(*visible))
26 *flag = EINA_TRUE;
27}
28
29static void
30callback_timer_cb(void *data EINA_UNUSED, const Efl_Event *event)
31{
32 ck_assert(0);
33 efl_del(event->object);
34 ecore_main_loop_quit();
35}
36
37EFL_START_TEST(efl_ui_callback_visibility)
38{
39 Eina_Bool check = EINA_FALSE;
40 Eo *box = efl_add(EFL_UI_BOX_CLASS, win,
41 efl_content_set(win, efl_added));
42 efl_event_callback_add(box, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, _btn_visibility_change, &check);
43 efl_gfx_entity_visible_set(box, EINA_FALSE);
44
45 ck_assert_int_eq(check, EINA_TRUE);
46}
47EFL_END_TEST
48
49void efl_ui_test_callback(TCase *tc)
50{
51 tcase_add_checked_fixture(tc, callback_setup, NULL);
52 tcase_add_test(tc, efl_ui_callback_visibility);
53}
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 = [
120 'suite_helpers.h', 120 'suite_helpers.h',
121 'elm_test_init.c', 121 'elm_test_init.c',
122 'efl_ui_test_atspi.c', 122 'efl_ui_test_atspi.c',
123 'efl_ui_test_callback.c',
123 'efl_ui_test_focus_common.c', 124 'efl_ui_test_focus_common.c',
124 'efl_ui_test_focus_common.h', 125 'efl_ui_test_focus_common.h',
125 'efl_ui_test_focus.c', 126 'efl_ui_test_focus.c',