diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2011-02-15 18:57:18 -0800 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2011-02-15 19:10:24 -0800 |
commit | a7463d1f3c08c8746fbadef573416f5f9af28205 (patch) | |
tree | 1c413c389f8b303afda403112fa99bd4e59d716e /test | |
parent | b86a7e0ae6149edba37c5771d05a815a65f9235c (diff) |
Add test app and test pdf file
The test program is a just a simple exerciser for the EvPreviewer
widget, and the pdf is borrowed from evince.
Diffstat (limited to 'test')
-rw-r--r-- | test/3-page.pdf | bin | 0 -> 8222 bytes | |||
-rw-r--r-- | test/Makefile.am | 5 | ||||
-rw-r--r-- | test/previewer.c | 63 |
3 files changed, 68 insertions, 0 deletions
diff --git a/test/3-page.pdf b/test/3-page.pdf Binary files differnew file mode 100644 index 0000000..78eb41b --- /dev/null +++ b/test/3-page.pdf diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..8c154fc --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,5 @@ +AM_CFLAGS = $(PREVIEWER_CFLAGS) +LDADD = $(top_builddir)/previewer/libevpreviewer.la $(PREVIEWER_LIBS) + +noinst_PROGRAMS = previewer + diff --git a/test/previewer.c b/test/previewer.c new file mode 100644 index 0000000..62155a2 --- /dev/null +++ b/test/previewer.c @@ -0,0 +1,63 @@ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "previewer/ev-previewer.h" +#include <stdio.h> +#include <stdlib.h> +#include <glib.h> +#include <gtk/gtk.h> +#include <evince-document.h> + +int main(int argc, char *argv[]) +{ + const char *filename; + GtkWidget *pview; + GtkWidget *window; + + /* Init gtk asap */ + gtk_init(&argc, &argv); + + /* See if a filename was passed */ + if (argc < 2) { + fprintf(stderr, "No filename supplied\n"); + exit(EXIT_FAILURE); + } + filename = argv[1]; + + /* See if this is a regular file */ + if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { + g_warning("Filename \"%s\" does not exist or is not a regular file", + filename); + exit(EXIT_FAILURE); + } + + /* Initialize evince */ + if (!ev_init()) + exit(EXIT_FAILURE); + ev_stock_icons_init(); + + g_set_application_name("Document Previewer"); + gtk_window_set_default_icon_name("evince"); + + /* create the previewer */ + pview = ev_previewer_new(); + gtk_widget_show(pview); + + /* create a toplevel window */ + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + g_signal_connect (window, "delete-event", + G_CALLBACK (gtk_main_quit), NULL); + g_signal_connect (window, "destroy", + G_CALLBACK (gtk_main_quit), NULL); + + gtk_window_set_default_size (GTK_WINDOW (window), 600, 600); + gtk_container_add(GTK_CONTAINER(window), pview); + gtk_widget_show (window); + + ev_previewer_set_source_file(EV_PREVIEWER(pview), filename); + + gtk_main(); + + return 0; +} |