cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7cb53a3ae209167e3a65154ffc77844ce95989fe

commit 7cb53a3ae209167e3a65154ffc77844ce95989fe
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Wed Apr 20 15:52:41 2016 -0700

    eo: let's check that this nested restarted event are working somehow.
---
 src/tests/eo/signals/signals_main.c   | 33 +++++++++++++++++++++++++++++++++
 src/tests/eo/signals/signals_simple.c |  4 +++-
 src/tests/eo/signals/signals_simple.h |  3 +++
 3 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/src/tests/eo/signals/signals_main.c 
b/src/tests/eo/signals/signals_main.c
index 453eb1a..5d8839f 100644
--- a/src/tests/eo/signals/signals_main.c
+++ b/src/tests/eo/signals/signals_main.c
@@ -30,6 +30,34 @@ _a_changed_cb(void *data, const Eo_Event *event)
    return (cb_count != 3);
 }
 
+static Eina_Bool inside = EINA_FALSE;
+static int called = 0;
+
+static Eina_Bool
+_restart_1_cb(void *data, const Eo_Event *event)
+{
+   fprintf(stderr, "restart 1 inside: %i\n", inside);
+   fail_if(!inside);
+   called++;
+   return EINA_FALSE;
+}
+
+static Eina_Bool
+_restart_2_cb(void *data, const Eo_Event *event)
+{
+   fprintf(stderr, "restart 2 inside: %i\n", inside);
+   fail_if(inside);
+
+   inside = EINA_TRUE;
+   eo_event_callback_call(event->obj, event->desc, data);
+   inside = EINA_FALSE;
+
+   called++;
+
+   fprintf(stderr, "restart 2 exit inside: %i (%i)\n", inside, called);
+   return EINA_FALSE;
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -169,6 +197,11 @@ main(int argc, char *argv[])
    fcount = eo_event_global_freeze_count_get(EO_CLASS);
    fail_if(fcount != 0);
 
+   eo_event_callback_priority_add(obj, EV_RESTART, 
EO_CALLBACK_PRIORITY_DEFAULT, _restart_1_cb, NULL);
+   eo_event_callback_priority_add(obj, EV_RESTART, 
EO_CALLBACK_PRIORITY_BEFORE, _restart_2_cb, NULL);
+   eo_event_callback_call(obj, EV_RESTART, NULL);
+   fail_if(inside);
+   fail_if(called != 2);
 
    eo_unref(obj);
    eo_shutdown();
diff --git a/src/tests/eo/signals/signals_simple.c 
b/src/tests/eo/signals/signals_simple.c
index b56a87b..2be2767 100644
--- a/src/tests/eo/signals/signals_simple.c
+++ b/src/tests/eo/signals/signals_simple.c
@@ -13,6 +13,8 @@ typedef struct
 
 EAPI const Eo_Event_Description _EV_A_CHANGED =
         EO_EVENT_DESCRIPTION("a,changed");
+EAPI const Eo_Event_Description _EV_RESTART =
+        EO_EVENT_DESCRIPTION_RESTART("restart");
 
 #define MY_CLASS SIMPLE_CLASS
 
@@ -79,6 +81,7 @@ static Eo_Op_Description op_descs[] = {
 
 static const Eo_Event_Description *event_desc[] = {
      EV_A_CHANGED,
+     EV_RESTART,
      NULL
 };
 
@@ -94,4 +97,3 @@ static const Eo_Class_Description class_desc = {
 };
 
 EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL);
-
diff --git a/src/tests/eo/signals/signals_simple.h 
b/src/tests/eo/signals/signals_simple.h
index 830d236..a4f6656 100644
--- a/src/tests/eo/signals/signals_simple.h
+++ b/src/tests/eo/signals/signals_simple.h
@@ -11,6 +11,9 @@ EAPI void simple_a_set(Eo *obj, int a);
 extern const Eo_Event_Description _EV_A_CHANGED;
 #define EV_A_CHANGED (&(_EV_A_CHANGED))
 
+extern const Eo_Event_Description _EV_RESTART;
+#define EV_RESTART (&(_EV_RESTART))
+
 #define SIMPLE_CLASS simple_class_get()
 const Eo_Class *simple_class_get(void);
 

-- 


Reply via email to