From ede4ff100ed8eb39be2711dec829f8623f0fe306 Mon Sep 17 00:00:00 2001 From: Daniel Zaoui Date: Sat, 24 Nov 2018 21:45:27 +0200 Subject: [PATCH] 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 --- src/bin/inspect.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bin/inspect.c b/src/bin/inspect.c index 6067a3c..cf3dc64 100644 --- a/src/bin/inspect.c +++ b/src/bin/inspect.c @@ -1505,6 +1505,7 @@ main(int argc, char *argv[]) { const char *out_ext = strrchr(output, '.'); Exactness_Unit *unit1 = NULL, *unit2 = NULL, *unitO = NULL; + int nb_diffs = 0; Eina_List *itr1, *itr2; 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_img2 = itr2 ? eina_list_data_get(itr2) : 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)); unitO->imgs = eina_list_append(unitO->imgs, ex_imgO); unitO->nb_shots++; @@ -1564,7 +1567,7 @@ main(int argc, char *argv[]) else if (!strcmp(out_ext, ".exu")) { _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