summaryrefslogtreecommitdiff
path: root/legacy/eeze
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@datenfreihafen.org>2012-09-20 15:46:04 +0000
committerStefan Schmidt <stefan@datenfreihafen.org>2012-09-20 15:46:04 +0000
commitdede039b3546226742b6967a253fffb929a35bd4 (patch)
tree4b032dada10b7eca1b1e7012bca9199417cc41c7 /legacy/eeze
parent3a8be0b07adaa1f4352911e407241e120e8afc22 (diff)
eeze/tests: Fix test for sensor events.
Inject the event by hand to test the code pathes handling a sensor event coming in. SVN revision: 76916
Diffstat (limited to 'legacy/eeze')
-rw-r--r--legacy/eeze/src/tests/eeze_suite.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/legacy/eeze/src/tests/eeze_suite.c b/legacy/eeze/src/tests/eeze_suite.c
index f349c3d698..c84ef07fa6 100644
--- a/legacy/eeze/src/tests/eeze_suite.c
+++ b/legacy/eeze/src/tests/eeze_suite.c
@@ -479,11 +479,18 @@ event_cb(void *data EINA_UNUSED, int ev_type, void *event)
479 rc = eeze_sensor_timestamp_get(sens, &timestamp); 479 rc = eeze_sensor_timestamp_get(sens, &timestamp);
480 fail_if(rc == EINA_FALSE); 480 fail_if(rc == EINA_FALSE);
481 481
482 return ECORE_CALLBACK_PASS_ON; 482 eeze_sensor_free(sens);
483
484 ecore_main_loop_quit();
485
486 return EINA_FALSE;
483} 487}
484 488
485START_TEST(eeze_test_sensor_async_read) 489START_TEST(eeze_test_sensor_async_read)
486{ 490{
491 Ecore_Event_Handler *handler;
492 Ecore_Event *event;
493
487 Eeze_Sensor_Obj *sens = NULL; 494 Eeze_Sensor_Obj *sens = NULL;
488 int ret = 0; 495 int ret = 0;
489 Eina_Bool rc = EINA_FALSE; 496 Eina_Bool rc = EINA_FALSE;
@@ -492,7 +499,11 @@ START_TEST(eeze_test_sensor_async_read)
492 ret = eeze_init(); 499 ret = eeze_init();
493 fail_if(ret != 1); 500 fail_if(ret != 1);
494 501
495 ecore_event_handler_add(EEZE_SENSOR_EVENT_ACCELEROMETER, event_cb, NULL); 502 EEZE_SENSOR_EVENT_ACCELEROMETER = ecore_event_type_new();
503 fail_if(EEZE_SENSOR_EVENT_ACCELEROMETER < 1);
504
505 handler = ecore_event_handler_add(EEZE_SENSOR_EVENT_ACCELEROMETER, event_cb, NULL);
506 fail_if(handler == NULL);
496 sens = eeze_sensor_new(EEZE_SENSOR_TYPE_ACCELEROMETER); 507 sens = eeze_sensor_new(EEZE_SENSOR_TYPE_ACCELEROMETER);
497 fail_if(sens == NULL); 508 fail_if(sens == NULL);
498 rc = eeze_sensor_async_read(sens, NULL); 509 rc = eeze_sensor_async_read(sens, NULL);
@@ -528,7 +539,10 @@ START_TEST(eeze_test_sensor_async_read)
528 rc = eeze_sensor_async_read(sens, NULL); 539 rc = eeze_sensor_async_read(sens, NULL);
529 fail_if(rc == EINA_FALSE); 540 fail_if(rc == EINA_FALSE);
530 541
531 eeze_sensor_free(sens); 542 event = ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, sens, NULL, NULL);
543 fail_if(event == NULL);
544
545 ecore_main_loop_begin();
532 546
533 ret = eeze_shutdown(); 547 ret = eeze_shutdown();
534 fail_if(ret != 0); 548 fail_if(ret != 0);