From fc0590fee0c23cee809e508f9b2847dda46f24a4 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 2 Apr 2020 16:00:46 +0200 Subject: tests: Add test for issue 70 Add test for the issue fixed by commit 35dcd72bbe7a9349861ff14389a38525fe9c949f. --- tests/pixbuf-jpeg.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tests') diff --git a/tests/pixbuf-jpeg.c b/tests/pixbuf-jpeg.c index d03384e42..3b1f2e4f0 100644 --- a/tests/pixbuf-jpeg.c +++ b/tests/pixbuf-jpeg.c @@ -137,6 +137,39 @@ test_at_size (void) g_object_unref (ref); } +static void +test_jpeg_markers (void) +{ + GdkPixbufLoader *loader; + GdkPixbuf *pixbuf; + GError *error = NULL; + gchar *contents; + gsize size; + + if (!format_supported ("jpeg")) + { + g_test_skip ("format not supported"); + return; + } + + g_file_get_contents (g_test_get_filename (G_TEST_DIST, "issue70.jpg", NULL), &contents, &size, &error); + g_assert_no_error (error); + + loader = gdk_pixbuf_loader_new (); + + gdk_pixbuf_loader_write (loader, (const guchar*)contents, size, &error); + g_assert_no_error (error); + + gdk_pixbuf_loader_close (loader, &error); + g_assert_no_error (error); + + pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); + g_assert_nonnull (pixbuf); + + g_object_unref (loader); + g_free (contents); +} + int main (int argc, char **argv) { @@ -147,6 +180,7 @@ main (int argc, char **argv) g_test_add_func ("/pixbuf/jpeg/bug775218", test_bug_775218); g_test_add_func ("/pixbuf/jpeg/comment", test_comment); g_test_add_func ("/pixbuf/jpeg/at_size", test_at_size); + g_test_add_func ("/pixbuf/jpeg/issue70", test_jpeg_markers); return g_test_run (); } -- cgit v1.2.1