summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-12-01 20:34:46 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-12-02 12:27:37 +0100
commitbf4b18ec928d897e443d27ee9a66078434b45388 (patch)
tree0abb3aa1d691bf741bd76a83285d4f2d67e400dd /src/tests/eo/suite
parent0f72c8a031e885ff2d28c2ab1c58d45c1186f102 (diff)
eo: add new test case to check event emission while emitting
Diffstat (limited to 'src/tests/eo/suite')
-rw-r--r--src/tests/eo/suite/eo_test_event.c58
1 files changed, 55 insertions, 3 deletions
diff --git a/src/tests/eo/suite/eo_test_event.c b/src/tests/eo/suite/eo_test_event.c
index b12280116b..ebbeaa859c 100644
--- a/src/tests/eo/suite/eo_test_event.c
+++ b/src/tests/eo/suite/eo_test_event.c
@@ -27,9 +27,8 @@ typedef struct {
27 int not_empty; 27 int not_empty;
28} Efl_Test_Event_Data; 28} Efl_Test_Event_Data;
29 29
30
31static void 30static void
32_cb3(void *data, const Efl_Event *event) 31_cb3(void *data, const Efl_Event *event EINA_UNUSED)
33{ 32{
34 Test_Data *d = data; 33 Test_Data *d = data;
35 34
@@ -37,7 +36,7 @@ _cb3(void *data, const Efl_Event *event)
37} 36}
38 37
39static void 38static void
40_cb2(void *data, const Efl_Event *event) 39_cb2(void *data, const Efl_Event *event EINA_UNUSED)
41{ 40{
42 Test_Data *d = data; 41 Test_Data *d = data;
43 42
@@ -80,9 +79,62 @@ START_TEST(eo_event)
80} 79}
81END_TEST 80END_TEST
82 81
82static void
83_cb_rec_3(void *data EINA_UNUSED, const Efl_Event *event)
84{
85 Test_Data *d = event->info;
86 ck_assert_int_eq(d->event3, 0);
87 d->event3 = EINA_TRUE;
88}
89
90static void
91_cb_rec_2(void *data EINA_UNUSED, const Efl_Event *event)
92{
93 Test_Data *d = event->info;
94 ck_assert_int_eq(d->event2, 0);
95 d->event2 = EINA_TRUE;
96}
97
98static void
99_cb_rec_1(void *data, const Efl_Event *event)
100{
101 Test_Data *d = event->info;
102
103 if (event->info)
104 {
105 ck_assert_int_eq(d->event1, 0);
106 d->event1 = EINA_TRUE;
107 }
108 else
109 {
110 efl_event_callback_add(event->object , EFL_TEST_EVENT_EVENT_TESTER, _cb_rec_2, NULL);
111 efl_event_callback_add(event->object , EFL_TEST_EVENT_EVENT_TESTER, _cb_rec_3, NULL);
112 efl_event_callback_call(event->object, EFL_TEST_EVENT_EVENT_TESTER, data);
113 }
114}
115
116START_TEST(eo_event_call_in_call)
117{
118 Test_Data data;
119 efl_object_init();
120 Eo *obj;
121
122 obj = efl_add(efl_test_event_class_get(), NULL);
123 efl_event_callback_priority_add(obj, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, _cb_rec_1, &data);
124
125 memset(&data, 0, sizeof(Test_Data));
126 efl_event_callback_call(obj, EFL_TEST_EVENT_EVENT_TESTER, NULL);
127 ck_assert_int_ne(data.event1, 0);
128 ck_assert_int_ne(data.event2, 0);
129 ck_assert_int_ne(data.event3, 0);
130
131 efl_object_shutdown();
132}
133END_TEST
83void eo_test_event(TCase *tc) 134void eo_test_event(TCase *tc)
84{ 135{
85 tcase_add_test(tc, eo_event); 136 tcase_add_test(tc, eo_event);
137 tcase_add_test(tc, eo_event_call_in_call);
86} 138}
87 139
88//class implementation 140//class implementation