summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-02-14 08:33:49 -0500
committerMike Blumenkrantz <zmike@samsung.com>2020-02-14 08:33:49 -0500
commit7768b54043ed74fa0d0ce0891be49269a51c7348 (patch)
tree64e85ddd087e752798b02592f1203a292d486d2d
parentacee4e1db53e00e145d845fe99a86b4dffe753f6 (diff)
tests/evas: add simple test for skip_head property
Summary: when using this property, there should be no mmap loaded after a call to evas_object_image_file_set, and we want to make sure the image is eventually loaded ref T8378 Depends on D11340 Reviewers: raster Reviewed By: raster Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8378 Differential Revision: https://phab.enlightenment.org/D11341
-rw-r--r--src/tests/evas/evas_test_image.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/tests/evas/evas_test_image.c b/src/tests/evas/evas_test_image.c
index 3f39b27..e260425 100644
--- a/src/tests/evas/evas_test_image.c
+++ b/src/tests/evas/evas_test_image.c
@@ -9,6 +9,7 @@
9 9
10#include <Evas.h> 10#include <Evas.h>
11#include <Ecore_Evas.h> 11#include <Ecore_Evas.h>
12#include <Ecore.h>
12 13
13#include "evas_suite.h" 14#include "evas_suite.h"
14#include "evas_tests_helpers.h" 15#include "evas_tests_helpers.h"
@@ -1161,6 +1162,45 @@ EFL_START_TEST(evas_object_image_save_from_proxy)
1161} 1162}
1162EFL_END_TEST 1163EFL_END_TEST
1163 1164
1165static void
1166_preload(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
1167{
1168 int *called = data;
1169 int w, h;
1170
1171 *called = 1;
1172 evas_object_image_size_get(obj, &w, &h);
1173 ck_assert_int_ge(w, 1);
1174 ck_assert_int_ge(h, 1);
1175 ecore_main_loop_quit();
1176}
1177
1178EFL_START_TEST(evas_object_image_load_head_skip)
1179{
1180 Evas *e;
1181 Evas_Object *obj;
1182 const char *img_path;
1183 int called = 0;
1184
1185 e = _setup_evas();
1186 img_path = TESTS_IMG_DIR "/Pic1.png";
1187
1188 obj = evas_object_image_filled_add(e);
1189 evas_object_resize(obj, 100, 100);
1190
1191 evas_object_image_load_head_skip_set(obj, EINA_TRUE);
1192 evas_object_event_callback_add(obj, EVAS_CALLBACK_IMAGE_PRELOADED, _preload, &called);
1193 evas_object_image_file_set(obj, img_path, NULL);
1194 evas_object_image_preload(obj, EINA_FALSE);
1195
1196 ck_assert(!efl_file_mmap_get(obj));
1197 ecore_main_loop_begin();
1198 ck_assert_int_eq(called, 1);
1199
1200 evas_free(e);
1201}
1202EFL_END_TEST
1203
1164void evas_test_image_object(TCase *tc) 1204void evas_test_image_object(TCase *tc)
1165{ 1205{
1166 tcase_add_test(tc, evas_object_image_api); 1206 tcase_add_test(tc, evas_object_image_api);
@@ -1188,6 +1228,7 @@ void evas_test_image_object(TCase *tc)
1188 tcase_add_test(tc, evas_object_image_cached_data_comparision); 1228 tcase_add_test(tc, evas_object_image_cached_data_comparision);
1189 tcase_add_test(tc, evas_object_image_9patch); 1229 tcase_add_test(tc, evas_object_image_9patch);
1190 tcase_add_test(tc, evas_object_image_save_from_proxy); 1230 tcase_add_test(tc, evas_object_image_save_from_proxy);
1231 tcase_add_test(tc, evas_object_image_load_head_skip);
1191} 1232}
1192 1233
1193 1234