From: Taehyub Kim Date: Wed, 17 Jun 2020 12:04:08 +0000 (+0900) Subject: elm_image: keep backword compatibility for elm_image_file_set API when setting url... X-Git-Tag: accepted/tizen/unified/20200618.130024~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ead76c0e2950eeb7d4f02cf45cf59694316887a;p=platform%2Fupstream%2Fefl.git elm_image: keep backword compatibility for elm_image_file_set API when setting url file set twice Summary: when trying to set file using url path twice, the second api call's return value is EINA_FALSE since image obj has already has same file path. After applying Efl.File interface, the behavior is changed compared to before. both of the return values should be EINA_TRUE. @fix ex) Eina_Bool ret1, ret2; ret1 = elm_image_file_set(image, "http://sameurl/image.jpg", NULL); ret2 = elm_image_file_set(image, "http://sameurl/image.jpg", NULL); ret1 and ret2 should be EINA_TURE Test Plan: 1. call elm_image_file_set api with same url path 2. see the return value Reviewers: Hermet, kimcinoo, jsuya Reviewed By: Hermet Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11979 Change-Id: If64d8d58424b559ea07dba14efb36996484c2fd5 --- diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c index a470c8f..2f6fb82 100644 --- a/src/lib/elementary/efl_ui_image.c +++ b/src/lib/elementary/efl_ui_image.c @@ -2465,6 +2465,20 @@ elm_image_file_set(Evas_Object *obj, const char *file, const char *group) Eina_Bool ret = EINA_FALSE; EFL_UI_IMAGE_CHECK(obj) EINA_FALSE; + + /* check if previous path is same with new one. + and return true if they are same */ + const char *cur_file_path = efl_file_get(obj); + if ((cur_file_path && file) && !strcmp(cur_file_path, file)) + { + const char *cur_group = efl_file_key_get(obj); + if (!(cur_group && group && strcmp(cur_group, group))) + { + if (efl_file_loaded_get(obj)) return EINA_TRUE; + if (_efl_ui_image_is_remote(file)) return EINA_TRUE; + } + } + ret = efl_file_simple_load(obj, file, group); efl_canvas_group_change(obj); return ret;