stefan pushed a commit to branch master.
commit 5706c6027b7c6082afbc3950310f410fd70ed43c
Author: Stefan Schmidt <[email protected]>
Date: Thu Mar 28 13:54:29 2013 +0000
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 1de767e..cb49b2d 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);
--
------------------------------------------------------------------------------
Own the Future-Intel® Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest.
Compete for recognition, cash, and the chance to get your game
on Steam. $5K grand prize plus 10 genre and skill prizes.
Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d