[gdk-pixbuf] Add a test for rotating a large image



commit 244f386bce98ca5d69d87a5b49c229a78f945c63
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 24 15:27:24 2015 -0400

    Add a test for rotating a large image
    
    This is prone to segfaults when we are not careful.

 tests/pixbuf-scale.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/tests/pixbuf-scale.c b/tests/pixbuf-scale.c
index 3ea3eb2..32d9840 100644
--- a/tests/pixbuf-scale.c
+++ b/tests/pixbuf-scale.c
@@ -124,6 +124,32 @@ test_add_alpha (gconstpointer data)
   g_object_unref (ref);
 }
 
+static void
+test_rotate (gconstpointer data)
+{
+  const gchar *filename = data;
+  const gchar *path;
+  GError *error = NULL;
+  GdkPixbuf *ref;
+  GdkPixbuf *pixbuf;
+
+  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);
+
+  pixbuf = gdk_pixbuf_rotate_simple (ref, GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE);
+  g_assert (pixbuf != NULL);
+  g_object_unref (pixbuf);
+
+  g_object_unref (ref);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -139,6 +165,7 @@ main (int argc, char **argv)
   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);
   g_test_add_data_func ("/pixbuf/add-alpha/large", "large.png", test_add_alpha);
+  g_test_add_data_func ("/pixbuf/rotate/large", "large.png", test_rotate);
 
   return g_test_run ();
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]