From 84bf949d447462e9889fd0f86d8560aa707140d5 Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Tue, 6 Mar 2018 17:56:56 -0800 Subject: [PATCH] elementary: bg - keep file path and key string for legacy bg widget Summary: If a file path and key string was passed to elm_bg, we could get the same file path and key string. Even if it failed to load the image file. And the file path also remained its original form. ex) Setting file path "~/image.png" => Getting file path "~/image.png" (Not "/home/user_name/image.png") @fix Test Plan: Included in elementary test suite. Reviewers: jpeg, cedric, raster Reviewed By: cedric Subscribers: woohyun Differential Revision: https://phab.enlightenment.org/D5823 Change-Id: Iadc615664d27832b5e232a150f0cd82f197defd2 Signed-off-by: Cedric Bail --- src/tests/elementary/elm_test_bg.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/tests/elementary/elm_test_bg.c b/src/tests/elementary/elm_test_bg.c index 0c5d33d..680af82 100644 --- a/src/tests/elementary/elm_test_bg.c +++ b/src/tests/elementary/elm_test_bg.c @@ -77,6 +77,33 @@ START_TEST (elm_bg_legacy_file_set_get_check) } END_TEST +START_TEST (elm_bg_legacy_file_set_get_check) +{ + Evas_Object *win, *bg; + const char *file = NULL, *key = NULL; + + elm_init(1, NULL); + win = elm_win_add(NULL, "bg", ELM_WIN_BASIC); + + bg = elm_bg_add(win); + + /* This test case will check the following things for legacy widget. + * It is all about backward compatibility. + * 1. Set and Get file path, key even if there is no proper image file for the given file path. + * 2. Even if there is a proper image file and the given file path is interpreted to full file path, + * the Get function should give original file path. NOT interpreted. */ + elm_bg_file_set(bg, "~/test.png", "test_key"); + elm_bg_file_get(bg, &file, &key); + + ck_assert(file != NULL); + ck_assert(!strcmp(file, "~/test.png")); + ck_assert(key != NULL); + ck_assert(!strcmp(key, "test_key")); + + elm_shutdown(); +} +END_TEST + void elm_test_bg(TCase *tc EINA_UNUSED) { tcase_add_test(tc, elm_bg_legacy_type_check); -- 2.7.4