diff --git a/src/lib/tsuite_evas_hook.c b/src/lib/tsuite_evas_hook.c index 7021578..fdb4ac3 100644 --- a/src/lib/tsuite_evas_hook.c +++ b/src/lib/tsuite_evas_hook.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "tsuite_file_data.h" #include "exactness_private.h" @@ -152,7 +153,15 @@ tsuite_evas_hook_init(void) if (!shot_key) shot_key = SHOT_KEY_STR; if (!vr_list) - vr_list = calloc(1, sizeof(*vr_list)); + { + struct sysinfo s_info; + sysinfo(&s_info); + vr_list = calloc(1, sizeof(*vr_list)); + vr_list->first_timestamp = s_info.uptime * 1000; +#ifdef DEBUG_TSUITE + printf("Uptime=<%u>\n", vr_list->first_timestamp); +#endif + } } EAPI void @@ -612,14 +621,36 @@ ecore_main_loop_begin(void) if (!_hook_setting->recording && _hook_setting->file_name) { + double diff_time = 0; /* Time to wait before feeding the first event */ ts.td = calloc(1, sizeof(Timer_Data)); #ifdef DEBUG_TSUITE printf("<%s> rec file is <%s>\n", __func__, _hook_setting->file_name); #endif vr_list = read_events(_hook_setting->file_name, ts.td); if (ts.td->current_event) - { /* Got first event in list, run test */ - tsuite_feed_event(ts.td); + { + /* Got first event in list, run test */ + + /* Calculate the time to wait before feeding the first event */ + unsigned int current_event_time = evt_time_get(0, eina_list_data_get(ts.td->current_event)); + if (current_event_time > vr_list->first_timestamp) + diff_time = (current_event_time - vr_list->first_timestamp) / 1000.0; + +#ifdef DEBUG_TSUITE + printf("%s first_time_stamp=<%u> current_event_time=<%u>\n", __func__, vr_list->first_timestamp, current_event_time); +#endif + + if (diff_time) + { +#ifdef DEBUG_TSUITE + printf(" Waiting <%f>\n", diff_time); +#endif + ecore_timer_add(diff_time, tsuite_feed_event, ts.td); + } + else + { + tsuite_feed_event(ts.td); + } } } diff --git a/src/lib/tsuite_file_data.c b/src/lib/tsuite_file_data.c index 6863e73..5afe7d7 100644 --- a/src/lib/tsuite_file_data.c +++ b/src/lib/tsuite_file_data.c @@ -803,6 +803,8 @@ data_desc *_data_descriptors_init(void) EET_DATA_DESCRIPTOR_ADD_VARIANT(desc->_variant_descriptor, Variant_st, "data", data, t, desc->_variant_unified_descriptor); + EET_DATA_DESCRIPTOR_ADD_BASIC(desc->_lists_descriptor, + Lists_st, "first_timestamp", first_timestamp, EET_T_UINT); EET_DATA_DESCRIPTOR_ADD_LIST(desc->_lists_descriptor, Lists_st, "variant_list", variant_list, desc->_variant_descriptor); diff --git a/src/lib/tsuite_file_data.h b/src/lib/tsuite_file_data.h index 3bea482..8f53856 100644 --- a/src/lib/tsuite_file_data.h +++ b/src/lib/tsuite_file_data.h @@ -177,6 +177,7 @@ typedef struct _mouse_in_mouse_out take_screenshot; struct _Lists_st { Eina_List *variant_list; + unsigned int first_timestamp; }; typedef struct _Lists_st Lists_st;