From 917a94b445aed6fa466ff1f86cceaf90ef943cd0 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sun, 24 Feb 2019 11:26:13 +1100 Subject: [PATCH] Add "gif-pixel-data-none" test --- test/c/std/gif.c | 18 ++++++++++++++ test/data/artificial/gif-pixel-data-none.gif | Bin 0 -> 40 bytes ...if-pixel-data-none.gif.make-artificial.txt | 23 ++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 test/data/artificial/gif-pixel-data-none.gif create mode 100644 test/data/artificial/gif-pixel-data-none.gif.make-artificial.txt diff --git a/test/c/std/gif.c b/test/c/std/gif.c index dbd0284c..453e6b57 100644 --- a/test/c/std/gif.c +++ b/test/c/std/gif.c @@ -1019,6 +1019,23 @@ const char* test_wuffs_gif_decode_multiple_loop_counts() { return NULL; } +const char* test_wuffs_gif_decode_pixel_data_none() { + CHECK_FOCUS(__func__); + + wuffs_base__io_buffer src = ((wuffs_base__io_buffer){ + .data = global_src_slice, + }); + + const char* status = + read_file(&src, "test/data/artificial/gif-pixel-data-none.gif"); + if (status) { + return status; + } + + return do_test_wuffs_gif_decode_expecting( + src, wuffs_base__error__not_enough_data, true); +} + const char* test_wuffs_gif_decode_not_enough_data() { CHECK_FOCUS(__func__); @@ -1669,6 +1686,7 @@ proc tests[] = { test_wuffs_gif_decode_input_is_a_png, // test_wuffs_gif_decode_missing_two_src_bytes, // test_wuffs_gif_decode_multiple_loop_counts, // + test_wuffs_gif_decode_pixel_data_none, // test_wuffs_gif_decode_not_enough_data, // test_wuffs_gif_decode_too_much_data, // test_wuffs_gif_frame_dirty_rect, // diff --git a/test/data/artificial/gif-pixel-data-none.gif b/test/data/artificial/gif-pixel-data-none.gif new file mode 100644 index 0000000000000000000000000000000000000000..0227f9d2d4cc76fc90252436fa4618a917343e25 GIT binary patch literal 40 rcmZ?wbhEHbWMW`qXk=huVE8Y{@L!4HzcIsq9S|2J&cMXT%3uuus(J?l literal 0 HcmV?d00001 diff --git a/test/data/artificial/gif-pixel-data-none.gif.make-artificial.txt b/test/data/artificial/gif-pixel-data-none.gif.make-artificial.txt new file mode 100644 index 00000000..9dc0eef1 --- /dev/null +++ b/test/data/artificial/gif-pixel-data-none.gif.make-artificial.txt @@ -0,0 +1,23 @@ +# Feed this file to script/make-artificial.go + +make gif + +header + +image { + imageWidthHeight 2 2 + palette { + 0x00 0x00 0xFF + 0x11 0x00 0xFF + 0x22 0x00 0xFF + 0x33 0x00 0xFF + } +} + +frame { + frameLeftTopWidthHeight 0 0 2 2 +} +# The frame is 4 pixels, but we don't supply any. +lzw 2 + +trailer