elm_photocam: fix file_get,set operations
authorYeongjong Lee <yj34.lee@samsung.com>
Tue, 26 Mar 2019 04:16:32 +0000 (13:16 +0900)
committerYeongjong Lee <yj34.lee@samsung.com>
Tue, 26 Mar 2019 04:24:02 +0000 (13:24 +0900)
Summary: This patch fixes bug that elm_photocam_file_get always return NULL.

Test Plan: make check

Reviewers: Hermet, zmike, bu5hm4n

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8472

src/lib/elementary/efl_ui_image_zoomable.c
src/lib/elementary/efl_ui_image_zoomable.eo
src/tests/elementary/elm_test_photocam.c

index f346ee3..41fefb1 100644 (file)
@@ -2426,6 +2426,12 @@ _efl_ui_image_zoomable_efl_file_file_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd
    return efl_file_set(efl_super(obj, MY_CLASS), file);
 }
 
+EOLIAN static const char *
+_efl_ui_image_zoomable_efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
+{
+   return sd->file;
+}
+
 EOLIAN static void
 _efl_ui_image_zoomable_efl_ui_zoom_zoom_level_set(Eo *obj, Efl_Ui_Image_Zoomable_Data *sd, double zoom)
 {
index 374c82f..0f308b4 100644 (file)
@@ -65,7 +65,7 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom,
       Efl.Ui.Scrollable_Interactive.scroll;
       Efl.Access.Widget.Action.elm_actions { get; }
       Efl.File.load;
-      Efl.File.file { set; }
+      Efl.File.file { get; set; }
       Efl.Orientation.orientation { get; set; }
       Efl.Orientation.flip { get; set; }
       Efl.Layout.Group.group_size_min { get; }
index b2bf4ec..8313fdb 100644 (file)
@@ -41,8 +41,25 @@ EFL_START_TEST(elm_atspi_role_get)
 }
 EFL_END_TEST
 
+EFL_START_TEST(elm_photocam_file)
+{
+   Evas_Object *win, *photocam;
+   const char *buf = ELM_IMAGE_DATA_DIR "/images/logo_small.png";
+
+   win = win_add(NULL, "photocam", ELM_WIN_BASIC);
+   photocam = elm_photocam_add(win);
+
+   ck_assert_int_eq(elm_photocam_file_set(photocam, buf), EVAS_LOAD_ERROR_NONE);
+   ck_assert_str_eq(elm_photocam_file_get(photocam), buf);
+
+   ck_assert_int_eq(elm_photocam_file_set(photocam, "non_existing.png"), EVAS_LOAD_ERROR_DOES_NOT_EXIST);
+   ck_assert_str_eq(elm_photocam_file_get(photocam), "non_existing.png");
+}
+EFL_END_TEST
+
 void elm_test_photocam(TCase *tc)
 {
    tcase_add_test(tc, elm_photocam_legacy_type_check);
    tcase_add_test(tc, elm_atspi_role_get);
+   tcase_add_test(tc, elm_photocam_file);
 }