diff options
author | Mikael Hallendal <micke@codefactory.se> | 2002-05-07 23:31:19 +0000 |
---|---|---|
committer | Mikael Hallendal <hallski@src.gnome.org> | 2002-05-07 23:31:19 +0000 |
commit | 7941b068f0541cf66151e67bec0986f2c64a1d93 (patch) | |
tree | 02a84eb59d2ddfcec517079dc8c035089bd64388 | |
parent | 3f4a4cfd1e1fdb4ba449b2fa7cb1f0d4904d7634 (diff) | |
download | yelp-7941b068f0541cf66151e67bec0986f2c64a1d93.tar.gz |
added, test file for the YelpReader.
2002-05-08 Mikael Hallendal <micke@codefactory.se>
* src/test-reader.c: added, test file for the YelpReader.
* src/Makefile.am (yelp_SOURCES):
(test_reader_SOURCES): added test-reader
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | src/.cvsignore | 1 | ||||
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/test-reader.c | 82 |
4 files changed, 97 insertions, 1 deletions
@@ -1,6 +1,9 @@ 2002-05-08 Mikael Hallendal <micke@codefactory.se> + * src/test-reader.c: added, test file for the YelpReader. + * src/Makefile.am (yelp_SOURCES): + (test_reader_SOURCES): added test-reader - added yelp-reader.[ch] * src/yelp-uri.[ch]: diff --git a/src/.cvsignore b/src/.cvsignore index ad2d5d60..ae340d66 100644 --- a/src/.cvsignore +++ b/src/.cvsignore @@ -11,6 +11,7 @@ GNOME_Yelp.h GNOME_Yelp.server gnome_yelp_idl_stamp test-uri +test-reader yelp-marshal.c yelp-marshal.h yelp diff --git a/src/Makefile.am b/src/Makefile.am index e5a7d309..8f091679 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,7 @@ INCLUDES = \ bin_PROGRAMS = yelp -noinst_PROGRAMS = test-uri +noinst_PROGRAMS = test-uri test-reader test_uri_SOURCES = \ test-uri.c \ @@ -21,6 +21,16 @@ test_uri_SOURCES = \ test_uri_LDADD = \ $(YELP_LIBS) +test_reader_SOURCES = \ + test-uri.c \ + yelp-uri.c yelp-uri.h \ + yelp-reader.c yelp-reader.h \ + yelp-error.c yelp-error.h \ + yelp-util.c yelp-util.h + +test_reader_LDADD = \ + $(YELP_LIBS) + install-exec-local: rm -f $(DESTDIR)$(bindir)/gnome-help ln -s yelp $(DESTDIR)$(bindir)/gnome-help diff --git a/src/test-reader.c b/src/test-reader.c new file mode 100644 index 00000000..6ca3df8b --- /dev/null +++ b/src/test-reader.c @@ -0,0 +1,82 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Copyright (C) 2002 Mikael Hallendal <micke@codefactory.se> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Mikael Hallendal <micke@codefactory.se> + */ + +#include <config.h> + +#include <libgnome/gnome-init.h> +#include <libgnome/gnome-program.h> +#include <libgnomevfs/gnome-vfs.h> + +#include "yelp-uri.h" +#include "yelp-reader.h" + +int +main (int argc, char **argv) +{ + GnomeProgram *program; + YelpURI *uri; + YelpReader *reader; + + if (argc < 2) { + g_print ("Usage: test-uri uri\n"); + return 1; + } + + program = gnome_program_init (PACKAGE, VERSION, + LIBGNOME_MODULE, + argc, argv, + GNOME_PROGRAM_STANDARD_PROPERTIES, + NULL); + + gnome_vfs_init (); + + uri = yelp_uri_new (argv[1]); + + if (!yelp_uri_exists (uri)) { + g_print ("URI (%s) does not exist\n", argv[1]); + + return 1; + } + + reader = yelp_reader_new (FALSE); + + + g_signal_connect (reader, "open", + G_CALLBACK (open_cb), + NULL); + g_signal_connect (reader, "read", + G_CALLBACK (read_cb), + NULL); + g_signal_connect (reader, "close", + G_CALLBACK (close_cb), + NULL); + + yelp_reader_read (uri); + + yelp_uri_unref (uri); + + g_main_loop_run (g_main_loop_new (NULL, TRUE)); + + gnome_vfs_shutdown (); + + return 0; +} |