summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2009-09-23 23:45:34 -0500
committerShaun McCance <shaunm@gnome.org>2009-09-23 23:53:56 -0500
commit2962b08821183df2f8d4dbfcc4f451e5c2ca89a1 (patch)
treeb4646e1ce1c23996feb3c84c8292a33685683383 /tests
parent5ae3df6e692727af6d10518a10406f520ad03d51 (diff)
downloadyelp-2962b08821183df2f8d4dbfcc4f451e5c2ca89a1.tar.gz
[libyelp] YelpView basic implementation, YelpSimpleDocument for (X)HTML
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/test-view.c61
2 files changed, 66 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b1efc6a3..d9cfd0fc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -9,10 +9,14 @@ YELP_COMMON_LDADD = \
check_PROGRAMS = \
test-location-entry \
- test-uri
+ test-uri \
+ test-view
test_location_entry_CFLAGS = $(YELP_COMMON_CFLAGS)
test_location_entry_LDADD = $(YELP_COMMON_LDADD)
test_uri_CFLAGS = $(YELP_COMMON_CFLAGS)
test_uri_LDADD = $(YELP_COMMON_LDADD)
+
+test_view_CFLAGS = $(YELP_COMMON_CFLAGS)
+test_view_LDADD = $(YELP_COMMON_LDADD)
diff --git a/tests/test-view.c b/tests/test-view.c
new file mode 100644
index 00000000..99a70f02
--- /dev/null
+++ b/tests/test-view.c
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * Copyright (C) 2003-2009 Shaun McCance <shaunm@gnome.org>
+ *
+ * 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: Shaun McCance <shaunm@gnome.org>
+ */
+
+#include <gtk/gtk.h>
+#include <webkit/webkit.h>
+#include "yelp-view.h"
+#include "yelp-uri.h"
+#include "yelp-simple-document.h"
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *window, *scroll, *view;
+ YelpUri *uri;
+ YelpDocument *document;
+ GCancellable *cancellable;
+
+ gtk_init (&argc, &argv);
+
+ g_thread_init (NULL);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
+
+ scroll = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (window), scroll);
+
+ view = yelp_view_new ();
+ gtk_container_add (GTK_CONTAINER (scroll), view);
+
+ g_assert (argc >= 2);
+ uri = yelp_uri_resolve (argv[1]);
+ document = yelp_simple_document_new (uri);
+ yelp_view_load_document (view, uri, document);
+
+ gtk_widget_show_all (GTK_WIDGET (window));
+
+ gtk_main ();
+}