1#include <gdk-pixbuf/gdk-pixbuf.h>
2
3static void
4test_format (gconstpointer d)
5{
6 const char *f = d;
7 GSList *formats;
8 gboolean found;
9
10 found = FALSE;
11
12 formats = gdk_pixbuf_get_formats ();
13
14 for (GSList *l = formats; l && !found; l = l->next)
15 {
16 GdkPixbufFormat *format = l->data;
17 char *name;
18
19 name = gdk_pixbuf_format_get_name (format);
20
21 if (strcmp (s1: name, s2: f) == 0)
22 found = TRUE;
23
24 g_free (mem: name);
25 }
26
27 g_slist_free (list: formats);
28
29 g_assert_true (found);
30}
31
32
33int
34main (int argc, char *argv[])
35{
36 (g_test_init) (argc: &argc, argv: &argv, NULL);
37
38 g_test_add_data_func (testpath: "/pixbuf/format/png", test_data: "png", test_func: test_format);
39 g_test_add_data_func (testpath: "/pixbuf/format/jpeg", test_data: "jpeg", test_func: test_format);
40
41 return g_test_run ();
42}
43

source code of gtk/testsuite/gdk/pixbuf.c