1 /* -*- Mode: C; c-basic-offset: 2; -*- */
2 /* GdkPixbuf library - test loaders
4 * Copyright (C) 2001 Søren Sandmann (sandmann@daimi.au.dk)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22 #include "gdk-pixbuf/gdk-pixbuf.h"
27 test_loader (const guchar *bytes, gsize len, GError **err)
29 GdkPixbufLoader *loader;
31 loader = gdk_pixbuf_loader_new ();
32 gdk_pixbuf_loader_write (loader, bytes, len, err);
36 gdk_pixbuf_loader_close (loader, err);
46 g_print ("usage: pixbuf-read <files>\n");
51 main (int argc, char **argv)
56 g_log_set_always_fatal (G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
61 for (i = 1; i < argc; ++i)
67 g_print ("%s\t\t", argv[i]);
69 if (!g_file_get_contents (argv[i], &contents, &size, &err))
71 fprintf (stderr, "%s: error: %s\n", argv[i], err->message);
77 if (test_loader (contents, size, &err))
78 g_print ("success\n");
80 g_print ("error: %s\n", err->message);