elementary: bg - keep file path and key string for legacy bg widget
authorYoungbok Shin <youngb.shin@samsung.com>
Wed, 7 Mar 2018 01:56:56 +0000 (17:56 -0800)
committerWonki Kim <wonki_.kim@samsung.com>
Mon, 30 Apr 2018 06:57:04 +0000 (15:57 +0900)
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 <cedric@osg.samsung.com>
src/tests/elementary/elm_test_bg.c

index 0c5d33d..680af82 100644 (file)
@@ -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);