summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-08-14 14:45:47 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2013-09-17 22:37:02 +0200
commit37632fc33fce7e8ae1a482bae80a59f9f8c913e3 (patch)
tree6c5a686c02af9c3efe84dc3526635a10111384ad
parent7cfbac8113e2e0ae7a9836fc64a4d234a370a7f2 (diff)
downloadefl-37632fc33fce7e8ae1a482bae80a59f9f8c913e3.tar.gz
eo2-bench.c: add event_test
-rw-r--r--eo2test/eo2-bench.c57
1 files changed, 54 insertions, 3 deletions
diff --git a/eo2test/eo2-bench.c b/eo2test/eo2-bench.c
index 4ae8796d51..85579d2b06 100644
--- a/eo2test/eo2-bench.c
+++ b/eo2test/eo2-bench.c
@@ -290,18 +290,69 @@ check:
return 0;
}
+static int evt_count = 0;
+static Eina_Bool
+_changed_cb(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info)
+{
+ (void) data;
+ (void) desc;
+ (void) obj;
+ int val = *((int *) event_info);
+ check(val, 66);
+ evt_count++;
+
+ return EO_CALLBACK_CONTINUE;
+}
+
+static void
+event_test()
+{
+ Eo *eo_obj, *eo2_obj;
+
+ printf("\n *** event_test\n");
+
+ eo_obj = eo_add(EO_SIMPLE_CLASS, NULL);
+ eo2_obj = eo2_add(EO2_SIMPLE_CLASS, NULL);
+
+ evt_count = 0;
+ eo_do(eo_obj, eo_event_callback_add(EO_EV_X_CHANGED, _changed_cb, NULL));
+ eo_do(eo_obj, eo_set_evt(66));
+ check(evt_count, 1);
+
+ evt_count = 0;
+ eo2_do(eo2_obj, eo2_event_callback_add(EO2_EV_X_CHANGED, _changed_cb, NULL));
+ eo2_do(eo2_obj, eo2_set_evt(66));
+ check(evt_count, 1);
+}
+
+static void
+class_do_test()
+{
+ printf("\n *** class_do_test\n");
+
+ eo2_class_do(EO2_INHERIT_CLASS, eo2_class_hello(2); );
+}
+
int
main(int argc EINA_UNUSED, char** argv EINA_UNUSED, char** env EINA_UNUSED)
{
eo_init();
+ if (argc > 1)
+ eina_log_domain_level_set("eo", EINA_LOG_LEVEL_DBG);
+
+ if(cleanup_test())
+ fprintf(stderr, "something went wrong in cleanup_test()\n");
+
+ class_do_test();
+
do_batch_test();
+
override_batch_test();
+
virtual_test();
- if(cleanup_test())
- printf("something went wrong in cleanup_test()\n");
- eo2_class_do(EO2_INHERIT_CLASS, eo2_class_hello(2); );
+ event_test();
eo_shutdown();