summaryrefslogtreecommitdiff
path: root/src/tests/eeze
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2013-03-28 13:54:29 +0000
committerStefan Schmidt <s.schmidt@samsung.com>2013-03-28 14:38:12 +0000
commit5706c6027b7c6082afbc3950310f410fd70ed43c (patch)
tree7418f70baadc162928f2da90995fa50d60c2f4e9 /src/tests/eeze
parentbc93fd6aa7b14a5935d03e7d6ca30d596dbcffc6 (diff)
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.
Diffstat (limited to 'src/tests/eeze')
-rw-r--r--src/tests/eeze/eeze_suite.c12
1 files 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)
491} 491}
492END_TEST 492END_TEST
493 493
494static int cb_count = 0;
495
494static Eina_Bool 496static Eina_Bool
495event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event) 497event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
496{ 498{
@@ -506,15 +508,16 @@ event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
506 rc = eeze_sensor_timestamp_get(sens, &timestamp); 508 rc = eeze_sensor_timestamp_get(sens, &timestamp);
507 fail_if(rc == EINA_FALSE); 509 fail_if(rc == EINA_FALSE);
508 510
509 ecore_main_loop_quit(); 511 /* We expect 5 callbacks from async reads right now */
512 if (++cb_count == 5)
513 ecore_main_loop_quit();
510 514
511 return EINA_FALSE; 515 return ECORE_CALLBACK_DONE;
512} 516}
513 517
514START_TEST(eeze_test_sensor_async_read) 518START_TEST(eeze_test_sensor_async_read)
515{ 519{
516 Ecore_Event_Handler *handler; 520 Ecore_Event_Handler *handler;
517 Ecore_Event *event;
518 521
519 Eeze_Sensor_Obj *sens = NULL; 522 Eeze_Sensor_Obj *sens = NULL;
520 int ret = 0; 523 int ret = 0;
@@ -561,9 +564,6 @@ START_TEST(eeze_test_sensor_async_read)
561 rc = eeze_sensor_async_read(sens, NULL); 564 rc = eeze_sensor_async_read(sens, NULL);
562 fail_if(rc == EINA_FALSE); 565 fail_if(rc == EINA_FALSE);
563 566
564 event = ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, sens, NULL, NULL);
565 fail_if(event == NULL);
566
567 /* Error case */ 567 /* Error case */
568 sens = eeze_sensor_new(EEZE_SENSOR_TYPE_LAST + 1); 568 sens = eeze_sensor_new(EEZE_SENSOR_TYPE_LAST + 1);
569 fail_if(sens != NULL); 569 fail_if(sens != NULL);