kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=ab918a65acf8d8ebd0c7211123a1ccd93dccd5fb
commit ab918a65acf8d8ebd0c7211123a1ccd93dccd5fb Author: Kim Woelders <k...@woelders.dk> Date: Fri Oct 11 17:20:47 2019 +0200 Miscellaneous imlib_test_load tweaks - Error messages to stdout (not stderr). - Check progress call. - Break on error option. --- src/bin/imlib2_test_load.c | 47 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/bin/imlib2_test_load.c b/src/bin/imlib2_test_load.c index 81519ec..263b200 100644 --- a/src/bin/imlib2_test_load.c +++ b/src/bin/imlib2_test_load.c @@ -9,6 +9,9 @@ #define PROG_NAME "imlib2_test_load" +static char progress_called; +static char break_on_error; + static void usage(int exit_status) { @@ -19,15 +22,46 @@ usage(int exit_status) exit(exit_status); } +static int +progress(Imlib_Image im, char percent, int update_x, int update_y, + int update_w, int update_h) +{ + progress_called = 1; + return 1; /* Continue */ +} + int main(int argc, char **argv) { + const char *s; Imlib_Image im; Imlib_Load_Error lerr; + break_on_error = 0; + + for (;;) + { + argv++; + argc--; + if (argc <= 0) + break; + s = argv[0]; + if (*s++ != '-') + break; + switch (*s++) + { + case 'e': + break_on_error += 1; + break; + } + } + if (argc <= 1) usage(0); + imlib_context_set_progress_function(progress); + imlib_context_set_progress_granularity(10); + for (;;) { argc--; @@ -35,16 +69,25 @@ main(int argc, char **argv) if (argc <= 0) break; + progress_called = 0; + printf("Loading image: '%s'\n", argv[0]); im = imlib_load_image_with_error_return(argv[0], &lerr); if (!im) { - fprintf(stderr, PROG_NAME ": Error %d loading image: %s\n", lerr, - argv[0]); + printf("*** Error %d loading image: %s\n", lerr, argv[0]); + if (break_on_error & 2) + break; continue; } imlib_context_set_image(im); imlib_free_image_and_decache(); + if (!progress_called) + { + printf("*** No progress during image load\n"); + if (break_on_error & 1) + break; + } } return 0; --