|
|
|
@ -44,6 +44,8 @@ static Elm_Genlist_Item_Class *_objs_itc = NULL, *_obj_itc = NULL; |
|
|
|
|
|
|
|
|
|
static Eina_Hash *_item_infos_hash = NULL; |
|
|
|
|
|
|
|
|
|
static Eina_Bool _show_only_diffs = EINA_FALSE; |
|
|
|
|
|
|
|
|
|
static const char * |
|
|
|
|
_event_name_get(const Variant_st *v) |
|
|
|
|
{ |
|
|
|
@ -157,30 +159,6 @@ _event_specific_info_get(const Variant_st *v, char output[1024]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const Ecore_Getopt optdesc = { |
|
|
|
|
"exactness_inspect", |
|
|
|
|
"%prog [options] [<rec file> | <file1 file2>]", |
|
|
|
|
NULL, |
|
|
|
|
"(C) 2016 Enlightenment", |
|
|
|
|
"BSD", |
|
|
|
|
"Inspector for Exactness", |
|
|
|
|
0, |
|
|
|
|
{ |
|
|
|
|
ECORE_GETOPT_STORE_USHORT('d', "delay", "Delay the given recording by a given time (in milliseconds)."), |
|
|
|
|
ECORE_GETOPT_STORE_TRUE('c', "clean", "Clean the given recording from wrong events."), |
|
|
|
|
ECORE_GETOPT_STORE_TRUE('l', "list", "List the events of the given recording."), |
|
|
|
|
ECORE_GETOPT_STORE_TRUE('C', "compare", "Compare given files (images files or objects eet files)."), |
|
|
|
|
ECORE_GETOPT_STORE_STR('o', "compare_output", "Output of the comparison."), |
|
|
|
|
ECORE_GETOPT_STORE_USHORT('s', "shot", "Select a specific shot (1 = 1st shot...)."), |
|
|
|
|
|
|
|
|
|
ECORE_GETOPT_LICENSE('L', "license"), |
|
|
|
|
ECORE_GETOPT_COPYRIGHT('C', "copyright"), |
|
|
|
|
ECORE_GETOPT_VERSION('V', "version"), |
|
|
|
|
ECORE_GETOPT_HELP('h', "help"), |
|
|
|
|
ECORE_GETOPT_SENTINEL |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
static Eina_Bool |
|
|
|
|
_is_hook_duplicate(const Variant_st *cur_v, const Variant_st *prev_v) |
|
|
|
|
{ |
|
|
|
@ -192,6 +170,56 @@ _is_hook_duplicate(const Variant_st *cur_v, const Variant_st *prev_v) |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static Eina_Bool |
|
|
|
|
_are_scenario_entries_different(Variant_st *v1, Variant_st *v2) |
|
|
|
|
{ |
|
|
|
|
if (!v1 ^ !v2) return EINA_TRUE; |
|
|
|
|
if (strcmp(v1->t.type, v2->t.type)) return EINA_TRUE; |
|
|
|
|
switch(tsuite_event_mapping_type_get(v1->t.type)) |
|
|
|
|
{ |
|
|
|
|
case TSUITE_EVENT_MOUSE_UP: |
|
|
|
|
case TSUITE_EVENT_MOUSE_DOWN: |
|
|
|
|
return !!memcmp(v1->data, v2->data, sizeof(mouse_down_mouse_up)); |
|
|
|
|
case TSUITE_EVENT_MOUSE_MOVE: |
|
|
|
|
return !!memcmp(v1->data, v2->data, sizeof(mouse_move)); |
|
|
|
|
case TSUITE_EVENT_MOUSE_WHEEL: |
|
|
|
|
return !!memcmp(v1->data, v2->data, sizeof(mouse_wheel)); |
|
|
|
|
case TSUITE_EVENT_MULTI_DOWN: case TSUITE_EVENT_MULTI_UP: |
|
|
|
|
return !!memcmp(v1->data, v2->data, sizeof(multi_event)); |
|
|
|
|
case TSUITE_EVENT_MULTI_MOVE: |
|
|
|
|
return !!memcmp(v1->data, v2->data, sizeof(multi_move)); |
|
|
|
|
case TSUITE_EVENT_KEY_UP: case TSUITE_EVENT_KEY_DOWN: |
|
|
|
|
return !!memcmp(v1->data, v2->data, sizeof(key_down_key_up)); |
|
|
|
|
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE: case TSUITE_EVENT_KEY_UP_WITH_KEYCODE: |
|
|
|
|
return !!memcmp(v1->data, v2->data, sizeof(key_down_key_up_with_keycode)); |
|
|
|
|
default: |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static Eina_Bool |
|
|
|
|
_are_images_different(Exactness_Image *e_img1, Exactness_Image *e_img2) |
|
|
|
|
{ |
|
|
|
|
unsigned int w, h; |
|
|
|
|
int *pxs1 = NULL; |
|
|
|
|
int *pxs2 = NULL; |
|
|
|
|
if (!e_img1 ^ !e_img2) return EINA_TRUE; |
|
|
|
|
if (e_img1->w != e_img2->w) return EINA_TRUE; |
|
|
|
|
if (e_img1->h != e_img2->h) return EINA_TRUE; |
|
|
|
|
pxs1 = e_img1->pixels; |
|
|
|
|
pxs2 = e_img2->pixels; |
|
|
|
|
for (w = 0; w < e_img1->w; w++) |
|
|
|
|
{ |
|
|
|
|
for (h = 0; h < e_img1->h; h++) |
|
|
|
|
{ |
|
|
|
|
if (pxs1[h * e_img1->w + w] != pxs2[h * e_img1->w + w]) |
|
|
|
|
return EINA_TRUE; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static Exactness_Image * |
|
|
|
|
_pixels_compare(Exactness_Image *img1, Exactness_Image *img2, Eina_Bool *has_diff) |
|
|
|
|
{ |
|
|
|
@ -279,6 +307,27 @@ _are_objs_different(Exactness_Object *e_obj1, Exactness_Object *e_obj2, Eina_Boo |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static Eina_Bool |
|
|
|
|
_are_objs_trees_different(Exactness_Objects *e_objs1, Exactness_Objects *e_objs2) |
|
|
|
|
{ |
|
|
|
|
if (!e_objs1 ^ !e_objs2) return EINA_TRUE; |
|
|
|
|
Eina_List *itr1 = e_objs1->objs; |
|
|
|
|
Eina_List *itr2 = e_objs2->objs; |
|
|
|
|
Exactness_Object *e_obj1, *e_obj2; |
|
|
|
|
while (itr1 || itr2) |
|
|
|
|
{ |
|
|
|
|
if ((!itr1) ^ (!itr2)) return EINA_TRUE; |
|
|
|
|
e_obj1 = eina_list_data_get(itr1); |
|
|
|
|
e_obj2 = eina_list_data_get(itr2); |
|
|
|
|
|
|
|
|
|
if (_are_objs_different(e_obj1, e_obj2, EINA_TRUE)) return EINA_TRUE; |
|
|
|
|
|
|
|
|
|
itr1 = eina_list_next(itr1); |
|
|
|
|
itr2 = eina_list_next(itr2); |
|
|
|
|
} |
|
|
|
|
return EINA_FALSE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
_win_del(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) |
|
|
|
|
{ |
|
|
|
@ -809,20 +858,23 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2) |
|
|
|
|
while (itr1 || itr2) |
|
|
|
|
{ |
|
|
|
|
Variant_st *v1 = itr1 ? eina_list_data_get(itr1) : NULL; |
|
|
|
|
_Item_Info *ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &v1, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl1, _scn_itc, v1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
if (unit2) |
|
|
|
|
Variant_st *v2 = itr2 ? eina_list_data_get(itr2) : NULL; |
|
|
|
|
if (!_show_only_diffs || _are_scenario_entries_different(v1, v2)) |
|
|
|
|
{ |
|
|
|
|
_Compare_Item_Data *vv = calloc(1, sizeof(*vv)); |
|
|
|
|
Variant_st *v2 = itr2 ? eina_list_data_get(itr2) : NULL; |
|
|
|
|
vv->p1 = v1; |
|
|
|
|
vv->p2 = v2; |
|
|
|
|
vv->dt = EX_SCENARIO; |
|
|
|
|
ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &v2, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl2, _scn_itc, v2, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
elm_genlist_item_append(glc, _scn_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
_Item_Info *ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &v1, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl1, _scn_itc, v1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
if (unit2) |
|
|
|
|
{ |
|
|
|
|
_Compare_Item_Data *vv = calloc(1, sizeof(*vv)); |
|
|
|
|
vv->p1 = v1; |
|
|
|
|
vv->p2 = v2; |
|
|
|
|
vv->dt = EX_SCENARIO; |
|
|
|
|
ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &v2, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl2, _scn_itc, v2, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
elm_genlist_item_append(glc, _scn_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (itr1) itr1 = eina_list_next(itr1); |
|
|
|
|
if (itr2) itr2 = eina_list_next(itr2); |
|
|
|
@ -841,20 +893,23 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2) |
|
|
|
|
while (itr1 || itr2) |
|
|
|
|
{ |
|
|
|
|
Exactness_Image *img1 = itr1 ? eina_list_data_get(itr1) : NULL; |
|
|
|
|
_Item_Info *ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &img1, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl1, _img_itc, img1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
if (unit2) |
|
|
|
|
Exactness_Image *img2 = itr2 ? eina_list_data_get(itr2) : NULL; |
|
|
|
|
if (!_show_only_diffs || _are_images_different(img1, img2)) |
|
|
|
|
{ |
|
|
|
|
_Compare_Item_Data *vv = calloc(1, sizeof(*vv)); |
|
|
|
|
Exactness_Image *img2 = itr2 ? eina_list_data_get(itr2) : NULL; |
|
|
|
|
vv->p1 = img1; |
|
|
|
|
vv->p2 = img2; |
|
|
|
|
vv->dt = EX_IMAGE; |
|
|
|
|
ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &img2, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl2, _img_itc, img2, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
elm_genlist_item_append(glc, _img_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
_Item_Info *ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &img1, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl1, _img_itc, img1, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
if (unit2) |
|
|
|
|
{ |
|
|
|
|
_Compare_Item_Data *vv = calloc(1, sizeof(*vv)); |
|
|
|
|
vv->p1 = img1; |
|
|
|
|
vv->p2 = img2; |
|
|
|
|
vv->dt = EX_IMAGE; |
|
|
|
|
ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &img2, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl2, _img_itc, img2, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
elm_genlist_item_append(glc, _img_itc, vv, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (itr1) itr1 = eina_list_next(itr1); |
|
|
|
|
if (itr2) itr2 = eina_list_next(itr2); |
|
|
|
@ -873,24 +928,27 @@ _gui_unit_display(Exactness_Unit *unit1, Exactness_Unit *unit2) |
|
|
|
|
while (itr1 || itr2) |
|
|
|
|
{ |
|
|
|
|
Exactness_Objects *objs1 = itr1 ? eina_list_data_get(itr1) : NULL; |
|
|
|
|
_Item_Info *ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &objs1, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl1, _objs_itc, objs1, NULL, |
|
|
|
|
ELM_GENLIST_ITEM_TREE, NULL, NULL); |
|
|
|
|
efl_wref_add(ii->gl_item, &(ii->gl_item)); |
|
|
|
|
if (unit2) |
|
|
|
|
Exactness_Objects *objs2 = itr2 ? eina_list_data_get(itr2) : NULL; |
|
|
|
|
if (!_show_only_diffs || _are_objs_trees_different(objs1, objs2)) |
|
|
|
|
{ |
|
|
|
|
_Compare_Item_Data *vv = calloc(1, sizeof(*vv)); |
|
|
|
|
Exactness_Objects *objs2 = itr2 ? eina_list_data_get(itr2) : NULL; |
|
|
|
|
vv->p1 = objs1; |
|
|
|
|
vv->p2 = objs2; |
|
|
|
|
vv->dt = EX_OBJ_INFO; |
|
|
|
|
ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &objs2, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl2, _objs_itc, objs2, NULL, |
|
|
|
|
_Item_Info *ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &objs1, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl1, _objs_itc, objs1, NULL, |
|
|
|
|
ELM_GENLIST_ITEM_TREE, NULL, NULL); |
|
|
|
|
efl_wref_add(ii->gl_item, &(ii->gl_item)); |
|
|
|
|
elm_genlist_item_append(glc, _objs_itc, vv, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL); |
|
|
|
|
if (unit2) |
|
|
|
|
{ |
|
|
|
|
_Compare_Item_Data *vv = calloc(1, sizeof(*vv)); |
|
|
|
|
vv->p1 = objs1; |
|
|
|
|
vv->p2 = objs2; |
|
|
|
|
vv->dt = EX_OBJ_INFO; |
|
|
|
|
ii = calloc(1, sizeof(*ii)); |
|
|
|
|
eina_hash_set(_item_infos_hash, &objs2, ii); |
|
|
|
|
ii->gl_item = elm_genlist_item_append(gl2, _objs_itc, objs2, NULL, |
|
|
|
|
ELM_GENLIST_ITEM_TREE, NULL, NULL); |
|
|
|
|
efl_wref_add(ii->gl_item, &(ii->gl_item)); |
|
|
|
|
elm_genlist_item_append(glc, _objs_itc, vv, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (itr1) itr1 = eina_list_next(itr1); |
|
|
|
|
if (itr2) itr2 = eina_list_next(itr2); |
|
|
|
@ -930,6 +988,31 @@ _image_read(const char *filename) |
|
|
|
|
return ex_img; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static const Ecore_Getopt optdesc = { |
|
|
|
|
"exactness_inspect", |
|
|
|
|
"%prog [options] [<rec file> | <file1 file2>]", |
|
|
|
|
NULL, |
|
|
|
|
"(C) 2016 Enlightenment", |
|
|
|
|
"BSD", |
|
|
|
|
"Inspector for Exactness", |
|
|
|
|
0, |
|
|
|
|
{ |
|
|
|
|
ECORE_GETOPT_STORE_USHORT('d', "delay", "Delay the given recording by a given time (in milliseconds)."), |
|
|
|
|
ECORE_GETOPT_STORE_TRUE('c', "clean", "Clean the given recording from wrong events."), |
|
|
|
|
ECORE_GETOPT_STORE_TRUE('l', "list", "List the events of the given recording."), |
|
|
|
|
ECORE_GETOPT_STORE_TRUE('C', "compare", "Compare given files (images files or objects eet files)."), |
|
|
|
|
ECORE_GETOPT_STORE_TRUE(0, "show-only-diffs", "Show only differences during comparison."), |
|
|
|
|
ECORE_GETOPT_STORE_STR('o', "compare_output", "Output of the comparison."), |
|
|
|
|
ECORE_GETOPT_STORE_USHORT('s', "shot", "Select a specific shot (1 = 1st shot...)."), |
|
|
|
|
|
|
|
|
|
ECORE_GETOPT_LICENSE('L', "license"), |
|
|
|
|
ECORE_GETOPT_COPYRIGHT('C', "copyright"), |
|
|
|
|
ECORE_GETOPT_VERSION('V', "version"), |
|
|
|
|
ECORE_GETOPT_HELP('h', "help"), |
|
|
|
|
ECORE_GETOPT_SENTINEL |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
int |
|
|
|
|
main(int argc, char *argv[]) |
|
|
|
|
{ |
|
|
|
@ -940,12 +1023,13 @@ main(int argc, char *argv[]) |
|
|
|
|
unsigned short delay = 0, shot = 0; |
|
|
|
|
Eina_Bool write_file = EINA_FALSE; |
|
|
|
|
Eina_Bool want_quit, clean = EINA_FALSE, list_get = EINA_FALSE, compare_files = EINA_FALSE; |
|
|
|
|
Eina_Bool gui_needed = EINA_TRUE; |
|
|
|
|
Eina_Bool show_only_diffs = EINA_FALSE, gui_needed = EINA_TRUE; |
|
|
|
|
Ecore_Getopt_Value values[] = { |
|
|
|
|
ECORE_GETOPT_VALUE_USHORT(delay), |
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(clean), |
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(list_get), |
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(compare_files), |
|
|
|
|
ECORE_GETOPT_VALUE_BOOL(show_only_diffs), |
|
|
|
|
ECORE_GETOPT_VALUE_STR(compare_output), |
|
|
|
|
ECORE_GETOPT_VALUE_USHORT(shot), |
|
|
|
|
|
|
|
|
@ -968,27 +1052,38 @@ main(int argc, char *argv[]) |
|
|
|
|
fprintf(stderr, "Failed parsing arguments.\n"); |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
else if (want_quit) |
|
|
|
|
if (want_quit) |
|
|
|
|
{ |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
else if ((clean || delay || shot || list_get) && args == argc) |
|
|
|
|
if ((clean || delay || shot || list_get) && args == argc) |
|
|
|
|
{ |
|
|
|
|
fprintf(stderr, "Expected rec file as the last argument.\n"); |
|
|
|
|
ecore_getopt_help(stderr, &optdesc); |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
else if (shot && !delay) |
|
|
|
|
if (shot && !delay) |
|
|
|
|
{ |
|
|
|
|
fprintf(stderr, "shot option can only be used with delay option.\n"); |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
else if (compare_files && argc - args < 2) |
|
|
|
|
if (compare_files && argc - args < 2) |
|
|
|
|
{ |
|
|
|
|
fprintf(stderr, "Expected at least two files to compare as last arguments.\n"); |
|
|
|
|
ecore_getopt_help(stderr, &optdesc); |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
if (show_only_diffs && !compare_files) |
|
|
|
|
{ |
|
|
|
|
fprintf(stderr, "--show-only-diffs is available with --compare only"); |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
if (show_only_diffs && compare_output) |
|
|
|
|
{ |
|
|
|
|
fprintf(stderr, "--show-only-diffs works in GUI only"); |
|
|
|
|
goto end; |
|
|
|
|
} |
|
|
|
|
_show_only_diffs = show_only_diffs; |
|
|
|
|
|
|
|
|
|
Lists_st *list = NULL; |
|
|
|
|
if (clean || delay || list_get) |
|
|
|
|