[gdk-pixbuf] tests: Add test for bug 775693
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] tests: Add test for bug 775693
- Date: Tue, 13 Dec 2016 16:34:28 +0000 (UTC)
commit 3724a739bb538af08260cad21ad9e70ae3bf4b1e
Author: Bastien Nocera <hadess hadess net>
Date: Tue Dec 13 14:40:07 2016 +0100
tests: Add test for bug 775693
https://bugzilla.gnome.org/show_bug.cgi?id=775693
tests/Makefile.am | 1 +
tests/bug775693.pixdata | Bin 0 -> 1317 bytes
tests/pixbuf-pixdata.c | 28 ++++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f008273..34d12f0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -62,6 +62,7 @@ dist_installed_test_data = \
large.jpg \
bug775218.jpg \
test-image.pixdata \
+ bug775693.pixdata \
$(wildcard $(srcdir)/test-images/fail/*) \
$(wildcard $(srcdir)/test-images/randomly-modified/*) \
$(wildcard $(srcdir)/test-images/reftests/*.*) \
diff --git a/tests/bug775693.pixdata b/tests/bug775693.pixdata
new file mode 100644
index 0000000..784103c
Binary files /dev/null and b/tests/bug775693.pixdata differ
diff --git a/tests/pixbuf-pixdata.c b/tests/pixbuf-pixdata.c
index 4cb7d1c..0493fc5 100644
--- a/tests/pixbuf-pixdata.c
+++ b/tests/pixbuf-pixdata.c
@@ -21,9 +21,36 @@
#include "config.h"
#include "gdk-pixbuf/gdk-pixbuf.h"
+#include "gdk-pixbuf/gdk-pixdata.h"
#include "test-common.h"
#include <string.h>
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+static void
+test_pixdata_deserialize (gconstpointer data)
+{
+ const gchar *filename = data;
+ GdkPixbuf *pixbuf;
+ GdkPixdata pixdata;
+ GError *error = NULL;
+ gchar *contents;
+ gsize size;
+
+ g_file_get_contents (g_test_get_filename (G_TEST_DIST, filename, NULL), &contents, &size, &error);
+ g_assert_no_error (error);
+
+ gdk_pixdata_deserialize (&pixdata, size, (const guint8 *) contents, &error);
+ g_assert_no_error (error);
+ g_free (contents);
+
+ pixbuf = gdk_pixbuf_from_pixdata (&pixdata, TRUE, &error);
+ g_assert_error (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE);
+ g_clear_error (&error);
+
+ g_clear_object (&pixbuf);
+}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
static void
test_pixdata (void)
{
@@ -48,6 +75,7 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/pixbuf/pixdata", test_pixdata);
+ g_test_add_data_func ("/pixbuf/pixdata/bug775693", "bug775693.pixdata", test_pixdata_deserialize);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]