diff options
author | Bastien Nocera <hadess@hadess.net> | 2014-11-03 19:04:23 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2014-11-18 19:41:01 +0100 |
commit | f3fabf8d4d4835515dc2c1582ef2362f29f57ca0 (patch) | |
tree | 41d439365fa6c85b0afc03c5228fd59506d0d5b8 /tests/test-common.c | |
parent | 4f5da4dff05e75c2fc12367d8a5fc237a76749ec (diff) | |
download | gdk-pixbuf-f3fabf8d4d4835515dc2c1582ef2362f29f57ca0.tar.gz |
tests: Move pixdata_equal() to helpers
Diffstat (limited to 'tests/test-common.c')
-rw-r--r-- | tests/test-common.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test-common.c b/tests/test-common.c index b7ff92652..1cbf9740e 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; +} |