eeze/sensor: Setup all ecore event types in init.

We had some set up but not all. Do that and avoid the redo'ing in
eeze_sensor test.
This commit is contained in:
Stefan Schmidt 2013-03-27 17:15:27 +00:00
parent fdb479d060
commit f7c055b0ce
2 changed files with 38 additions and 9 deletions

View File

@ -333,12 +333,44 @@ eeze_sensor_init(void)
if (!g_handle->modules) return EINA_FALSE;
/* Make sure we create new ecore event types before using them */
EEZE_SENSOR_EVENT_SNAP = ecore_event_type_new();
EEZE_SENSOR_EVENT_SHAKE = ecore_event_type_new();
EEZE_SENSOR_EVENT_DOUBLETAP = ecore_event_type_new();
EEZE_SENSOR_EVENT_PANNING = ecore_event_type_new();
EEZE_SENSOR_EVENT_FACEDOWN = ecore_event_type_new();
EEZE_SENSOR_EVENT_ACCELEROMETER = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_ACCELEROMETER == 0)
EEZE_SENSOR_EVENT_ACCELEROMETER = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_MAGNETIC == 0)
EEZE_SENSOR_EVENT_MAGNETIC = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_ORIENTATION == 0)
EEZE_SENSOR_EVENT_ORIENTATION = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_GYROSCOPE == 0)
EEZE_SENSOR_EVENT_GYROSCOPE = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_LIGHT == 0)
EEZE_SENSOR_EVENT_LIGHT = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_PROXIMITY == 0)
EEZE_SENSOR_EVENT_PROXIMITY = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_SNAP == 0)
EEZE_SENSOR_EVENT_SNAP = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_SHAKE == 0)
EEZE_SENSOR_EVENT_SHAKE = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_DOUBLETAP == 0)
EEZE_SENSOR_EVENT_DOUBLETAP = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_PANNING == 0)
EEZE_SENSOR_EVENT_PANNING = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_FACEDOWN == 0)
EEZE_SENSOR_EVENT_FACEDOWN = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_BAROMETER == 0)
EEZE_SENSOR_EVENT_BAROMETER = ecore_event_type_new();
if (EEZE_SENSOR_EVENT_TEMPERATURE == 0)
EEZE_SENSOR_EVENT_TEMPERATURE = ecore_event_type_new();
/* Core is ready so we can load the modules from disk now */
eeze_sensor_modules_load();

View File

@ -524,9 +524,6 @@ START_TEST(eeze_test_sensor_async_read)
ret = eeze_init();
fail_if(ret != 1);
EEZE_SENSOR_EVENT_ACCELEROMETER = ecore_event_type_new();
fail_if(EEZE_SENSOR_EVENT_ACCELEROMETER < 1);
handler = ecore_event_handler_add(EEZE_SENSOR_EVENT_ACCELEROMETER, event_cb, NULL);
fail_if(handler == NULL);
sens = eeze_sensor_new(EEZE_SENSOR_TYPE_ACCELEROMETER);