summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2020-03-24 13:22:19 -0400
committerMike Blumenkrantz <zmike@samsung.com>2020-03-24 13:22:19 -0400
commitf4a877d17d62430be1395fa64c9a18f4c43d06cf (patch)
tree9ad2e77dddd3f21da9571d6cd0c733911849c72f
parent6268bb36ead96702ac3edf2c15e5fe7e4fb6af1d (diff)
tests/elm: add strict test to verify elm image gif support
Summary: Depends on D11583 Reviewers: kimcinoo, Hermet, raster, cedric, bu5hm4n Reviewed By: bu5hm4n Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11484
-rw-r--r--src/tests/elementary/elm_test_image.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_image.c b/src/tests/elementary/elm_test_image.c
index bfd6dad3dd..108ee9f373 100644
--- a/src/tests/elementary/elm_test_image.c
+++ b/src/tests/elementary/elm_test_image.c
@@ -277,6 +277,52 @@ EFL_START_TEST(elm_image_test_memfile_set)
277} 277}
278EFL_END_TEST 278EFL_END_TEST
279 279
280#ifdef BUILD_LOADER_GIF
281static void
282_test_render(void *data, Evas *e EINA_UNUSED, void *event_info)
283{
284 int *pass = data;
285 Evas_Event_Render_Post *ev = event_info;
286 *pass = eina_list_count(ev->updated_area);
287 ecore_main_loop_quit();
288}
289
290static void
291_test_preload(void *data, Evas *e, Evas_Object *obj, void *event_info EINA_UNUSED)
292{
293 if (evas_object_image_load_error_get(obj) == EVAS_LOAD_ERROR_NONE)
294 evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, _test_render, data);
295 else
296 ecore_main_loop_quit();
297}
298
299EFL_START_TEST(elm_image_test_gif)
300{
301 Evas_Object *win, *image;
302 int pass = 0;
303
304 win = win_add(NULL, "image", ELM_WIN_BASIC);
305
306 image = elm_image_add(win);
307 evas_object_resize(win, 100, 100);
308 evas_object_resize(image, 100, 100);
309 evas_object_show(win);
310 evas_object_show(image);
311
312 get_me_to_those_events(win);
313 ck_assert(elm_image_file_set(image, ELM_IMAGE_DATA_DIR"/images/fire.gif", NULL));
314 elm_image_animated_set(image, EINA_TRUE);
315 elm_image_animated_play_set(image, EINA_TRUE);
316 evas_object_event_callback_add(elm_image_object_get(image), EVAS_CALLBACK_IMAGE_PRELOADED, _test_preload, &pass);
317 /* verify that we haven't tried to set a frame with index 0, as this is an error */
318 ck_assert_int_gt(evas_object_image_animated_frame_get(elm_image_object_get(image)), 0);
319 ecore_main_loop_begin();
320 ck_assert_int_gt(pass, 0);
321}
322EFL_END_TEST
323
324#endif
325
280void elm_test_image(TCase *tc) 326void elm_test_image(TCase *tc)
281{ 327{
282 tcase_add_test(tc, elm_image_legacy_type_check); 328 tcase_add_test(tc, elm_image_legacy_type_check);
@@ -286,4 +332,7 @@ void elm_test_image(TCase *tc)
286 tcase_add_test(tc, elm_image_evas_object_color_set); 332 tcase_add_test(tc, elm_image_evas_object_color_set);
287 tcase_add_test(tc, elm_image_evas_image_get); 333 tcase_add_test(tc, elm_image_evas_image_get);
288 tcase_add_test(tc, elm_image_test_memfile_set); 334 tcase_add_test(tc, elm_image_test_memfile_set);
335#ifdef BUILD_LOADER_GIF
336 tcase_add_test(tc, elm_image_test_gif);
337#endif
289} 338}