From 5706c6027b7c6082afbc3950310f410fd70ed43c Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Thu, 28 Mar 2013 13:54:29 +0000 Subject: [PATCH] eeze/sensor/tests: Catch all callbacks from async read. Originally we quit mainloop on the first event we got. As we expect a bit more we are now counting them and only leave when all arrived. --- src/tests/eeze/eeze_suite.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests/eeze/eeze_suite.c b/src/tests/eeze/eeze_suite.c index 1de767e5eb..cb49b2d651 100644 --- a/src/tests/eeze/eeze_suite.c +++ b/src/tests/eeze/eeze_suite.c @@ -491,6 +491,8 @@ START_TEST(eeze_test_sensor_read) } END_TEST +static int cb_count = 0; + static Eina_Bool event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event) { @@ -506,15 +508,16 @@ event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event) rc = eeze_sensor_timestamp_get(sens, ×tamp); fail_if(rc == EINA_FALSE); - ecore_main_loop_quit(); + /* We expect 5 callbacks from async reads right now */ + if (++cb_count == 5) + ecore_main_loop_quit(); - return EINA_FALSE; + return ECORE_CALLBACK_DONE; } START_TEST(eeze_test_sensor_async_read) { Ecore_Event_Handler *handler; - Ecore_Event *event; Eeze_Sensor_Obj *sens = NULL; int ret = 0; @@ -561,9 +564,6 @@ START_TEST(eeze_test_sensor_async_read) rc = eeze_sensor_async_read(sens, NULL); fail_if(rc == EINA_FALSE); - event = ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, sens, NULL, NULL); - fail_if(event == NULL); - /* Error case */ sens = eeze_sensor_new(EEZE_SENSOR_TYPE_LAST + 1); fail_if(sens != NULL);