summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-03-25 21:22:23 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-03-25 21:22:23 -0400
commit44481d355e98f77d7277b26bc542894d44c95b49 (patch)
tree15d7d08f3a91803e1f39f441cc0496abdbf4d552
parent6f8240805617c2c772c4d298dc692ac831d22013 (diff)
downloadgtk+-44481d355e98f77d7277b26bc542894d44c95b49.tar.gz
Make testsuite fail if we lack pixbuf loaders
Add a test that requires that we have png and jpeg loaders.
-rw-r--r--testsuite/gdk/meson.build1
-rw-r--r--testsuite/gdk/pixbuf.c31
2 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/gdk/meson.build b/testsuite/gdk/meson.build
index cc3125de37..5216d7a518 100644
--- a/testsuite/gdk/meson.build
+++ b/testsuite/gdk/meson.build
@@ -11,6 +11,7 @@ tests = [
'encoding',
'keysyms',
'memorytexture',
+ 'pixbuf',
'rectangle',
'rgba',
'seat',
diff --git a/testsuite/gdk/pixbuf.c b/testsuite/gdk/pixbuf.c
new file mode 100644
index 0000000000..592f5d0d32
--- /dev/null
+++ b/testsuite/gdk/pixbuf.c
@@ -0,0 +1,31 @@
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+int
+main (int argc, char *argv[])
+{
+ GSList *formats;
+ gboolean have_png, have_jpeg;
+
+ have_png = FALSE;
+ have_jpeg = FALSE;
+
+ formats = gdk_pixbuf_get_formats ();
+
+ for (GSList *l = formats; l; l = l->next)
+ {
+ GdkPixbufFormat *format = l->data;
+ const char *name;
+
+ name = gdk_pixbuf_format_get_name (format);
+
+ if (strcmp (name, "png") == 0)
+ have_png = TRUE;
+ else if (strcmp (name, "jpeg") == 0)
+ have_jpeg = TRUE;
+ }
+
+ if (!have_png || !have_jpeg)
+ return 1;
+
+ return 0;
+}