[gdk-pixbuf] tests: Move pixdata_equal() to helpers



commit f3fabf8d4d4835515dc2c1582ef2362f29f57ca0
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Nov 3 19:04:23 2014 +0100

    tests: Move pixdata_equal() to helpers

 tests/pixbuf-resource.c |   22 ----------------------
 tests/pixbuf-save.c     |   22 ----------------------
 tests/test-common.c     |   22 ++++++++++++++++++++++
 tests/test-common.h     |    2 ++
 4 files changed, 24 insertions(+), 44 deletions(-)
---
diff --git a/tests/pixbuf-resource.c b/tests/pixbuf-resource.c
index 2e6ef2c..9b53ab7 100644
--- a/tests/pixbuf-resource.c
+++ b/tests/pixbuf-resource.c
@@ -28,28 +28,6 @@
   g_strcmp0 (gdk_pixbuf_get_option (p1, key), gdk_pixbuf_get_option (p2, key))
 
 static gboolean
-pixdata_equal (GdkPixbuf *p1, GdkPixbuf *p2)
-{
-  if (gdk_pixbuf_get_colorspace (p1) != gdk_pixbuf_get_colorspace (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_n_channels (p1) != gdk_pixbuf_get_n_channels (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_bits_per_sample (p1) != gdk_pixbuf_get_bits_per_sample (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_width (p1) != gdk_pixbuf_get_width (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_height (p1) != gdk_pixbuf_get_height (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_rowstride (p1) != gdk_pixbuf_get_rowstride (p2))
-    return FALSE;
-  if (memcmp (gdk_pixbuf_get_pixels (p1), gdk_pixbuf_get_pixels (p2),
-          gdk_pixbuf_get_byte_length (p1)) != 0)
-    return FALSE;
-
-  return TRUE;
-}
-
-static gboolean
 pixbuf_equal (GdkPixbuf *p1, GdkPixbuf *p2)
 {
   if (!pixdata_equal (p1, p2))
diff --git a/tests/pixbuf-save.c b/tests/pixbuf-save.c
index 61ef07b..4afa514 100644
--- a/tests/pixbuf-save.c
+++ b/tests/pixbuf-save.c
@@ -27,28 +27,6 @@
   g_strcmp0 (gdk_pixbuf_get_option (p1, key), gdk_pixbuf_get_option (p2, key))
 
 static gboolean
-pixdata_equal (GdkPixbuf *p1, GdkPixbuf *p2)
-{
-  if (gdk_pixbuf_get_colorspace (p1) != gdk_pixbuf_get_colorspace (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_n_channels (p1) != gdk_pixbuf_get_n_channels (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_bits_per_sample (p1) != gdk_pixbuf_get_bits_per_sample (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_width (p1) != gdk_pixbuf_get_width (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_height (p1) != gdk_pixbuf_get_height (p2))
-    return FALSE;
-  if (gdk_pixbuf_get_rowstride (p1) != gdk_pixbuf_get_rowstride (p2))
-    return FALSE;
-  if (memcmp (gdk_pixbuf_get_pixels (p1), gdk_pixbuf_get_pixels (p2),
-          gdk_pixbuf_get_byte_length (p1)) != 0)
-    return FALSE;
-
-  return TRUE;
-}
-
-static gboolean
 pixbuf_equal (GdkPixbuf *p1, GdkPixbuf *p2)
 {
   if (!pixdata_equal (p1, p2))
diff --git a/tests/test-common.c b/tests/test-common.c
index b7ff926..1cbf974 100644
--- a/tests/test-common.c
+++ b/tests/test-common.c
@@ -63,3 +63,25 @@ format_supported (const gchar *filename)
 
   return retval;
 }
+
+gboolean
+pixdata_equal (GdkPixbuf *p1, GdkPixbuf *p2)
+{
+  if (gdk_pixbuf_get_colorspace (p1) != gdk_pixbuf_get_colorspace (p2))
+    return FALSE;
+  if (gdk_pixbuf_get_n_channels (p1) != gdk_pixbuf_get_n_channels (p2))
+    return FALSE;
+  if (gdk_pixbuf_get_bits_per_sample (p1) != gdk_pixbuf_get_bits_per_sample (p2))
+    return FALSE;
+  if (gdk_pixbuf_get_width (p1) != gdk_pixbuf_get_width (p2))
+    return FALSE;
+  if (gdk_pixbuf_get_height (p1) != gdk_pixbuf_get_height (p2))
+    return FALSE;
+  if (gdk_pixbuf_get_rowstride (p1) != gdk_pixbuf_get_rowstride (p2))
+    return FALSE;
+  if (memcmp (gdk_pixbuf_get_pixels (p1), gdk_pixbuf_get_pixels (p2),
+          gdk_pixbuf_get_byte_length (p1)) != 0)
+    return FALSE;
+
+  return TRUE;
+}
diff --git a/tests/test-common.h b/tests/test-common.h
index 32ff35a..179d5cb 100644
--- a/tests/test-common.h
+++ b/tests/test-common.h
@@ -23,10 +23,12 @@
 #ifndef __TEST_COMMON_H__
 
 #include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
 
 G_BEGIN_DECLS
 
 gboolean format_supported (const gchar *filename);
+gboolean pixdata_equal (GdkPixbuf *p1, GdkPixbuf *p2);
 
 G_END_DECLS
 


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