summaryrefslogtreecommitdiff
path: root/src/tests/evas/evas_test_image.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/evas/evas_test_image.c')
-rw-r--r--src/tests/evas/evas_test_image.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index bfc581992a..3f39b270e5 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -1117,6 +1117,50 @@ EFL_START_TEST(evas_object_image_9patch)
1117} 1117}
1118EFL_END_TEST 1118EFL_END_TEST
1119 1119
1120EFL_START_TEST(evas_object_image_save_from_proxy)
1121{
1122 Evas *e;
1123 Evas_Object *obj, *proxy, *ref;
1124 int w, h, r_w, r_h;
1125 const uint32_t *d, *r_d;
1126 const char *img_path, *img_path2;
1127 Eina_Bool ret;
1128
1129 e = _setup_evas();
1130 img_path = TESTS_IMG_DIR "/Pic1.png";
1131 img_path2 = TESTS_IMG_DIR "/Pic1_saved.png";
1132
1133 obj = evas_object_image_add(e);
1134 proxy = evas_object_image_add(e);
1135 ref = evas_object_image_add(e);
1136
1137 evas_object_image_file_set(obj, img_path, NULL);
1138 fail_if(evas_object_image_load_error_get(obj) != EVAS_LOAD_ERROR_NONE);
1139 evas_object_image_size_get(obj, &w, &h);
1140 d = evas_object_image_data_get(obj, EINA_FALSE);
1141
1142 evas_object_image_source_set(proxy, obj);
1143 ret = evas_object_image_save(proxy, img_path2, NULL, NULL);
1144 fail_if(!ret);
1145
1146 evas_object_image_file_set(ref, img_path2, NULL);
1147 fail_if(evas_object_image_load_error_get(ref) != EVAS_LOAD_ERROR_NONE);
1148 evas_object_image_size_get(ref, &r_w, &r_h);
1149 r_d = evas_object_image_data_get(ref, EINA_FALSE);
1150
1151 fail_if(w != r_w || h != r_h);
1152 fail_if(memcmp(d, r_d, w * h * 4));
1153
1154 evas_object_del(proxy);
1155 evas_object_del(obj);
1156 evas_object_del(ref);
1157
1158 remove(img_path2);
1159
1160 evas_free(e);
1161}
1162EFL_END_TEST
1163
1120void evas_test_image_object(TCase *tc) 1164void evas_test_image_object(TCase *tc)
1121{ 1165{
1122 tcase_add_test(tc, evas_object_image_api); 1166 tcase_add_test(tc, evas_object_image_api);
@@ -1143,6 +1187,7 @@ void evas_test_image_object(TCase *tc)
1143 tcase_add_test(tc, evas_object_image_partially_load_orientation); 1187 tcase_add_test(tc, evas_object_image_partially_load_orientation);
1144 tcase_add_test(tc, evas_object_image_cached_data_comparision); 1188 tcase_add_test(tc, evas_object_image_cached_data_comparision);
1145 tcase_add_test(tc, evas_object_image_9patch); 1189 tcase_add_test(tc, evas_object_image_9patch);
1190 tcase_add_test(tc, evas_object_image_save_from_proxy);
1146} 1191}
1147 1192
1148 1193