[gtk/fix-memleaks: 3/3] tests: Make the pixbuf test use TAP
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/fix-memleaks: 3/3] tests: Make the pixbuf test use TAP
- Date: Sun, 28 Mar 2021 01:04:18 +0000 (UTC)
commit b8693cc4f45453f830c5cb9357238e4eebb4daba
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 27 20:44:18 2021 -0400
tests: Make the pixbuf test use TAP
Otherwise, meson just considers this test skipped.
testsuite/gdk/pixbuf.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/testsuite/gdk/pixbuf.c b/testsuite/gdk/pixbuf.c
index 8e34254074..591444fd86 100644
--- a/testsuite/gdk/pixbuf.c
+++ b/testsuite/gdk/pixbuf.c
@@ -1,33 +1,42 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
-int
-main (int argc, char *argv[])
+static void
+test_format (gconstpointer d)
{
+ const char *f = d;
GSList *formats;
- gboolean have_png, have_jpeg;
+ gboolean found;
- have_png = FALSE;
- have_jpeg = FALSE;
+ found = FALSE;
formats = gdk_pixbuf_get_formats ();
- for (GSList *l = formats; l; l = l->next)
+ for (GSList *l = formats; l && !found; l = l->next)
{
GdkPixbufFormat *format = l->data;
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 (strcmp (name, f) == 0)
+ found = TRUE;
g_free (name);
}
- if (!have_png || !have_jpeg)
- return 1;
+ g_slist_free (formats);
+
+ g_assert_true (found);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_data_func ("/pixbuf/format/png", "png", test_format);
+ g_test_add_data_func ("/pixbuf/format/jpeg", "jpeg", test_format);
- return 0;
+ return g_test_run ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]