diff options
author | Sungtaek Hong <sth253.hong@samsung.com> | 2017-12-18 17:33:49 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-12-18 20:49:46 +0900 |
commit | a2309c5083a643011b4e69347d6be4da3a0adee8 (patch) | |
tree | a3995f0c91782e9a92cdf5b85d0d8cd3e4f61fed /src/bin | |
parent | 81ba035f6935128b2c025c88de05cf2b8f2c0ead (diff) | |
download | efl-a2309c5083a643011b4e69347d6be4da3a0adee8.tar.gz |
efl_ui_image: apply load_size when API is called
Summary:
when efl_image_load_size_set() is called, image only sets
internal variable and not apply to the internal image.
elm_image_prescale_set() is also affected.
Test Plan: Run elementary_test->Image Prescale
Reviewers: jpeg, eunue, woohyun
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D5645
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/elementary/test.c | 2 | ||||
-rw-r--r-- | src/bin/elementary/test_image.c | 75 |
2 files changed, 77 insertions, 0 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 114cd7927a..7484a2545d 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -285,6 +285,7 @@ void test_dayselector(void *data, Evas_Object *obj, void *event_info); void test_image(void *data, Evas_Object *obj, void *event_info); void test_image_scale_type(void *data, Evas_Object *obj, void *event_info); void test_image_swallow_align(void *data, Evas_Object *obj, void *event_info); +void test_image_prescale(void *data, Evas_Object *obj, void *event_info); void test_remote_image(void *data, Evas_Object *obj, void *event_info); void test_click_image(void *data, Evas_Object *obj, void *event_info); void test_load_image(void *data, Evas_Object *obj, void *event_info); @@ -773,6 +774,7 @@ add_tests: ADD_TEST(NULL, "Images", "Image Remote", test_remote_image); ADD_TEST(NULL, "Images", "Image Click", test_click_image); ADD_TEST(NULL, "Images", "Image Async Load", test_load_image); + ADD_TEST(NULL, "Images", "Image Prescale", test_image_prescale); ADD_TEST(NULL, "Images", "Slideshow", test_slideshow); ADD_TEST(NULL, "Images", "Video", test_video); diff --git a/src/bin/elementary/test_image.c b/src/bin/elementary/test_image.c index 08232dff20..0dbdbef0b0 100644 --- a/src/bin/elementary/test_image.c +++ b/src/bin/elementary/test_image.c @@ -658,3 +658,78 @@ test_load_image(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve evas_object_resize(win, 320, 480); evas_object_show(win); } + +static void +_cb_prescale_radio_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED) +{ + Evas_Object *o_bg = data; + int size; + size = elm_radio_value_get((Evas_Object *)obj); + elm_image_prescale_set(o_bg, size); +} + +void +test_image_prescale(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Evas_Object *win, *im; + Evas_Object *box, *hbox; + Evas_Object *rd, *rdg; + char buf[PATH_MAX]; + + + win = elm_win_util_standard_add("image-prescale", "Image Prescale Test"); + elm_win_autodel_set(win, EINA_TRUE); + + box = elm_box_add(win); + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, box); + evas_object_show(box); + + im = elm_image_add(win); + snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get()); + elm_image_file_set(im, buf, NULL); + evas_object_size_hint_weight_set(im, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(im, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_box_pack_end(box, im); + evas_object_show(im); + + hbox = elm_box_add(win); + elm_box_horizontal_set(hbox, EINA_TRUE); + evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 50); + elm_object_text_set(rd, "50"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_prescale_radio_changed, im); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + rdg = rd; + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 100); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "100"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_prescale_radio_changed, im); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + rd = elm_radio_add(win); + elm_radio_state_value_set(rd, 200); + elm_radio_group_add(rd, rdg); + elm_object_text_set(rd, "200"); + evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); + evas_object_smart_callback_add(rd, "changed", _cb_prescale_radio_changed, im); + elm_box_pack_end(hbox, rd); + evas_object_show(rd); + + elm_radio_value_set(rdg, 200); + + elm_box_pack_end(box, hbox); + evas_object_show(hbox); + + evas_object_resize(win, 320, 320); + evas_object_show(win); +} |