[gdk-pixbuf] tests: Skip reftests for unsupported formats



commit 3585920c5ad748baf5fa9c873644e7a4fd584ad7
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 12 08:00:51 2015 +0200

    tests: Skip reftests for unsupported formats

 tests/pixbuf-reftest.c |    6 ++++++
 tests/test-common.c    |   15 +++++++++++++++
 tests/test-common.h    |    1 +
 3 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/tests/pixbuf-reftest.c b/tests/pixbuf-reftest.c
index b368378..704f3aa 100644
--- a/tests/pixbuf-reftest.c
+++ b/tests/pixbuf-reftest.c
@@ -117,6 +117,12 @@ test_reftest (gconstpointer data)
   gboolean success;
 
   file = G_FILE (data);
+  if (!file_supported (file))
+    {
+      g_test_skip ("format not supported");
+      return;
+    }
+
   filename = g_file_get_path (file);
   ref_file = make_ref_file (file);
 
diff --git a/tests/test-common.c b/tests/test-common.c
index 611a36f..a4ea4fa 100644
--- a/tests/test-common.c
+++ b/tests/test-common.c
@@ -59,6 +59,21 @@ format_supported (const gchar *filename)
 }
 
 gboolean
+file_supported (GFile *file)
+{
+  char *uri;
+  gboolean result;
+
+  uri = g_file_get_uri (file);
+
+  result = format_supported (uri);
+
+  g_free (uri);
+
+  return result;
+}
+
+gboolean
 skip_if_insufficient_memory (GError **err)
 {
   if (*err && g_error_matches (*err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY))
diff --git a/tests/test-common.h b/tests/test-common.h
index f0e1b1a..8da8f96 100644
--- a/tests/test-common.h
+++ b/tests/test-common.h
@@ -30,6 +30,7 @@ G_BEGIN_DECLS
 typedef gboolean (* AddTestFunc) (GFile *file);
 
 gboolean format_supported (const gchar *filename);
+gboolean file_supported (GFile *file);
 gboolean skip_if_insufficient_memory (GError **err);
 gboolean pixdata_equal (GdkPixbuf *test, GdkPixbuf *ref, GError **error);
 void add_test_for_all_images (const gchar   *prefix,


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