Inspect: create a full comparison output if exu is required and diffs are present

Summary: No exu is created if no diffs have been found. However, if diffs are present, we append all the comparison images, including those which don't have differences.

Differential Revision: https://phab.enlightenment.org/D7355
This commit is contained in:
Daniel Zaoui 2018-11-24 21:45:27 +02:00
parent 239e38f173
commit ede4ff100e
1 changed files with 5 additions and 2 deletions

View File

@ -1505,6 +1505,7 @@ main(int argc, char *argv[])
{ {
const char *out_ext = strrchr(output, '.'); const char *out_ext = strrchr(output, '.');
Exactness_Unit *unit1 = NULL, *unit2 = NULL, *unitO = NULL; Exactness_Unit *unit1 = NULL, *unit2 = NULL, *unitO = NULL;
int nb_diffs = 0;
Eina_List *itr1, *itr2; Eina_List *itr1, *itr2;
EINA_LIST_FOREACH(_units, itr1, unit) EINA_LIST_FOREACH(_units, itr1, unit)
{ {
@ -1534,8 +1535,10 @@ main(int argc, char *argv[])
Exactness_Image *ex_img1 = itr1 ? eina_list_data_get(itr1) : NULL; Exactness_Image *ex_img1 = itr1 ? eina_list_data_get(itr1) : NULL;
Exactness_Image *ex_img2 = itr2 ? eina_list_data_get(itr2) : NULL; Exactness_Image *ex_img2 = itr2 ? eina_list_data_get(itr2) : NULL;
Exactness_Image *ex_imgO = NULL; Exactness_Image *ex_imgO = NULL;
if (exactness_image_compare(ex_img1, ex_img2, &ex_imgO)) Eina_Bool has_diff = exactness_image_compare(ex_img1, ex_img2, &ex_imgO);
if (has_diff || !strcmp(out_ext, ".exu"))
{ {
if (has_diff) nb_diffs++;
if (!unitO) unitO = calloc(1, sizeof(*unitO)); if (!unitO) unitO = calloc(1, sizeof(*unitO));
unitO->imgs = eina_list_append(unitO->imgs, ex_imgO); unitO->imgs = eina_list_append(unitO->imgs, ex_imgO);
unitO->nb_shots++; unitO->nb_shots++;
@ -1564,7 +1567,7 @@ main(int argc, char *argv[])
else if (!strcmp(out_ext, ".exu")) else if (!strcmp(out_ext, ".exu"))
{ {
_diff_result_print(unit1, unit2); _diff_result_print(unit1, unit2);
if (unitO) exactness_unit_file_write(unitO, output); if (nb_diffs) exactness_unit_file_write(unitO, output);
else ret = 0; else ret = 0;
} }
else else