[gdk-pixbuf] Add a test for scaling down a huge image
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf] Add a test for scaling down a huge image
- Date: Tue, 25 Aug 2015 19:26:07 +0000 (UTC)
commit e4eaa11b0ac28960ab0696085d49104166c9a5b2
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Aug 24 14:26:24 2015 -0400
Add a test for scaling down a huge image
This currently segfaults in the png loader.
tests/large.png | Bin 0 -> 2507420 bytes
tests/pixbuf-scale.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/tests/large.png b/tests/large.png
new file mode 100644
index 0000000..310bd62
Binary files /dev/null and b/tests/large.png differ
diff --git a/tests/pixbuf-scale.c b/tests/pixbuf-scale.c
index eeddfe6..c6f55b5 100644
--- a/tests/pixbuf-scale.c
+++ b/tests/pixbuf-scale.c
@@ -65,6 +65,35 @@ test_scale (gconstpointer data)
g_object_unref (ref);
}
+static void
+test_scale_down (gconstpointer data)
+{
+ const gchar *filename = data;
+ const gchar *path;
+ GError *error = NULL;
+ GdkPixbuf *ref;
+ GdkPixbuf *pixbuf;
+ gint width, height;
+
+ if (!format_supported (filename))
+ {
+ g_test_skip ("format not supported");
+ return;
+ }
+
+ path = g_test_get_filename (G_TEST_DIST, filename, NULL);
+ ref = gdk_pixbuf_new_from_file (path, &error);
+ g_assert_no_error (error);
+
+ width = gdk_pixbuf_get_width (ref);
+ height = gdk_pixbuf_get_height (ref);
+
+ pixbuf = gdk_pixbuf_scale_simple (ref, width / 10, height / 10, GDK_INTERP_BILINEAR);
+ g_assert (pixbuf != NULL);
+
+ g_object_unref (ref);
+}
+
int
main (int argc, char **argv)
{
@@ -78,6 +107,7 @@ main (int argc, char **argv)
g_test_add_data_func ("/pixbuf/scale/tga", "test-images/valid_tga_test", test_scale);
g_test_add_data_func ("/pixbuf/scale/xpm", "test-images/valid_xpm_test", test_scale);
g_test_add_data_func ("/pixbuf/scale/xbm", "test-images/valid.xbm", test_scale);
+ g_test_add_data_func ("/pixbuf/scale/large", "large.png", test_scale_down);
return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]