summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Zaoui <daniel.zaoui@yahoo.com>2018-11-03 22:59:50 +0200
committerDaniel Zaoui <daniel.zaoui@yahoo.com>2018-11-04 10:59:11 +0200
commitf7dfae4423b0c1f5e605f5016a69d21d0c1071db (patch)
tree5a4c210de3ad648eb8a7666eb51b5039c45accf0
parente48bda302a59c55dcc185e705c57dac427663d50 (diff)
Inspector: implement command line exu comparison
Only png comparison was supported.
-rw-r--r--src/bin/inspect.c54
1 files changed, 45 insertions, 9 deletions
diff --git a/src/bin/inspect.c b/src/bin/inspect.c
index 6b8484c..670144f 100644
--- a/src/bin/inspect.c
+++ b/src/bin/inspect.c
@@ -1362,6 +1362,7 @@ main(int argc, char *argv[])
1362 goto end; 1362 goto end;
1363 } 1363 }
1364 ex_unit->imgs = eina_list_append(ex_unit->imgs, ex_img); 1364 ex_unit->imgs = eina_list_append(ex_unit->imgs, ex_img);
1365 ex_unit->nb_shots++;
1365 _units = eina_list_append(_units, ex_unit); 1366 _units = eina_list_append(_units, ex_unit);
1366 } 1367 }
1367 } 1368 }
@@ -1437,9 +1438,10 @@ main(int argc, char *argv[])
1437 1438
1438 if (compare_files && output) 1439 if (compare_files && output)
1439 { 1440 {
1440 Exactness_Unit *unit1 = NULL, *unit2 = NULL; 1441 const char *out_ext = strrchr(output, '.');
1441 Eina_List *itr; 1442 Exactness_Unit *unit1 = NULL, *unit2 = NULL, *unitO = NULL;
1442 EINA_LIST_FOREACH(_units, itr, unit) 1443 Eina_List *itr1, *itr2;
1444 EINA_LIST_FOREACH(_units, itr1, unit)
1443 { 1445 {
1444 if (!unit1) unit1 = unit; 1446 if (!unit1) unit1 = unit;
1445 else if (!unit2) unit2 = unit; 1447 else if (!unit2) unit2 = unit;
@@ -1450,16 +1452,39 @@ main(int argc, char *argv[])
1450 } 1452 }
1451 } 1453 }
1452 1454
1453 if (!strcmp(ext, ".png")) 1455 if (!strcmp(out_ext, ".png"))
1454 { 1456 {
1455 Exactness_Image *ex_img1 = eina_list_data_get(unit1->imgs); 1457 if (unit1->nb_shots != 1 || unit2->nb_shots != 1)
1456 Exactness_Image *ex_img2 = eina_list_data_get(unit2->imgs); 1458 {
1457 Exactness_Image *ex_imgO = NULL; 1459 fprintf(stderr, "Comparison output can be png only if the number of shots to compare is 1.\n");
1460 goto end;
1461 }
1462 }
1463
1464 itr1 = unit1 ? unit1->imgs : NULL;
1465 itr2 = unit2 ? unit2->imgs : NULL;
1458 1466
1467 while (itr1 || itr2)
1468 {
1469 Exactness_Image *ex_img1 = itr1 ? eina_list_data_get(itr1) : NULL;
1470 Exactness_Image *ex_img2 = itr2 ? eina_list_data_get(itr2) : NULL;
1471 Exactness_Image *ex_imgO = NULL;
1459 if (exactness_image_compare(ex_img1, ex_img2, &ex_imgO)) 1472 if (exactness_image_compare(ex_img1, ex_img2, &ex_imgO))
1460 { 1473 {
1461 Ecore_Evas *ee; 1474 if (!unitO) unitO = calloc(1, sizeof(*unitO));
1462 Eo *e, *img; 1475 unitO->imgs = eina_list_append(unitO->imgs, ex_imgO);
1476 unitO->nb_shots++;
1477 }
1478 itr1 = eina_list_next(itr1);
1479 itr2 = eina_list_next(itr2);
1480 }
1481 if (!strcmp(out_ext, ".png"))
1482 {
1483 Ecore_Evas *ee;
1484 Eo *e, *img;
1485 if (unitO->nb_shots == 1)
1486 {
1487 Exactness_Image *ex_imgO = eina_list_data_get(unitO->imgs);
1463 ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL); 1488 ee = ecore_evas_new(NULL, 0, 0, 100, 100, NULL);
1464 e = ecore_evas_get(ee); 1489 e = ecore_evas_get(ee);
1465 img = evas_object_image_add(e); 1490 img = evas_object_image_add(e);
@@ -1469,7 +1494,18 @@ main(int argc, char *argv[])
1469 ecore_evas_free(ee); 1494 ecore_evas_free(ee);
1470 goto end; 1495 goto end;
1471 } 1496 }
1497 ret = 0;
1498 }
1499 else if (!strcmp(out_ext, ".exu"))
1500 {
1501 if (unitO) exactness_unit_file_write(unitO, output);
1502 else ret = 0;
1472 } 1503 }
1504 else
1505 {
1506 fprintf(stderr, "Correct output extension (.exu/.png) required\n");
1507 }
1508 goto end;
1473 } 1509 }
1474 1510
1475 ret = 0; 1511 ret = 0;