tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=75b56c75898ca527a013d275c950a21b173dd1f8

commit 75b56c75898ca527a013d275c950a21b173dd1f8
Author: Tom Hacohen <t...@stosb.com>
Date:   Tue May 20 15:31:53 2014 +0100

    Eo legacy events: Add legacy events tests.
    
    These tests test mixing legacy events with eo events.
---
 src/tests/eo/suite/eo_test_general.c | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/src/tests/eo/suite/eo_test_general.c 
b/src/tests/eo/suite/eo_test_general.c
index 6547218..f1ff3f2 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -38,15 +38,15 @@ START_TEST(eo_stack)
 }
 END_TEST
 
-static int _eo_signals_cb_curent = 0;
+static int _eo_signals_cb_current = 0;
 static int _eo_signals_cb_flag = 0;
 
 static Eina_Bool
 _eo_signals_a_changed_cb(void *_data, Eo *obj EINA_UNUSED, const 
Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
 {
    int data = (intptr_t) _data;
-   _eo_signals_cb_curent++;
-   ck_assert_int_eq(data, _eo_signals_cb_curent);
+   _eo_signals_cb_current++;
+   ck_assert_int_eq(data, _eo_signals_cb_current);
    _eo_signals_cb_flag |= 0x1;
    return EO_CALLBACK_CONTINUE;
 }
@@ -115,6 +115,34 @@ START_TEST(eo_signals)
 
    eo_unref(obj);
 
+   obj = eo_add(SIMPLE_CLASS, NULL);
+   /* Legacy support signals. */
+     {
+        const Eo_Event_Description *a_desc = 
eo_base_legacy_only_event_description_get("a,changed");
+        fail_if(!a_desc);
+        ck_assert_str_eq(a_desc->name, "a,changed");
+        fail_if(a_desc == EV_A_CHANGED);
+
+        const Eo_Event_Description *bad_desc = 
eo_base_legacy_only_event_description_get("bad");
+        fail_if(!bad_desc);
+        ck_assert_str_eq(bad_desc->name, "bad");
+
+        /* Call Eo event with legacy and non-legacy callbacks. */
+        _eo_signals_cb_current = 0;
+        eo_do(obj, eo_event_callback_priority_add(EV_A_CHANGED, -100, 
_eo_signals_a_changed_cb, (void *) 1));
+        eo_do(obj, eo_event_callback_add(a_desc, _eo_signals_a_changed_cb2, 
NULL));
+        eo_do(obj, simple_a_set(1));
+        ck_assert_int_eq(_eo_signals_cb_flag, 0x3);
+
+        /* Call legacy event with legacy and non-legacy callbacks. */
+        int a = 3;
+        _eo_signals_cb_current = 0;
+        _eo_signals_cb_flag = 0;
+        eo_do(obj, eo_event_callback_call(a_desc, &a));
+        ck_assert_int_eq(_eo_signals_cb_flag, 0x3);
+     }
+   eo_unref(obj);
+
    eo_shutdown();
 }
 END_TEST

-- 


Reply via email to