aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-09-08 05:34:49 +0800
committerXan Lopez <xan@igalia.com>2012-09-08 05:34:49 +0800
commitdfb243b5951298d745bb1b670205f8d9a186758d (patch)
treeb66e3a6b056e87d81740095f1d4c5a6c3aa32e89 /tests
parent8c793b0359e216cfd96b1d0a3f46e6d2a5f6fda3 (diff)
downloadgsoc2013-epiphany-dfb243b5951298d745bb1b670205f8d9a186758d.tar
gsoc2013-epiphany-dfb243b5951298d745bb1b670205f8d9a186758d.tar.gz
gsoc2013-epiphany-dfb243b5951298d745bb1b670205f8d9a186758d.tar.bz2
gsoc2013-epiphany-dfb243b5951298d745bb1b670205f8d9a186758d.tar.lz
gsoc2013-epiphany-dfb243b5951298d745bb1b670205f8d9a186758d.tar.xz
gsoc2013-epiphany-dfb243b5951298d745bb1b670205f8d9a186758d.tar.zst
gsoc2013-epiphany-dfb243b5951298d745bb1b670205f8d9a186758d.zip
tests: some simple EphyBookmarks tests
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/ephy-bookmarks-test.c78
2 files changed, 82 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b480cdc98..5ce8c1b74 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,7 @@
SUBDIRS = data
noinst_PROGRAMS = \
+ test-ephy-bookmarks \
test-ephy-download \
test-ephy-embed-single \
test-ephy-embed-utils \
@@ -115,6 +116,9 @@ LDADD = \
$(CODE_COVERAGE_LDFLAGS) \
$(DEPENDENCIES_LIBS)
+test_ephy_bookmarks_SOURCES = \
+ ephy-bookmarks-test.c
+
test_ephy_download_SOURCES = \
ephy-download-test.c
diff --git a/tests/ephy-bookmarks-test.c b/tests/ephy-bookmarks-test.c
new file mode 100644
index 000000000..464a9de46
--- /dev/null
+++ b/tests/ephy-bookmarks-test.c
@@ -0,0 +1,78 @@
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * Copyright © 2012 Igalia S.L.
+ *
+ * Epiphany 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.
+ *
+ * Epiphany 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 Epiphany; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "ephy-bookmarks.h"
+
+#include "ephy-debug.h"
+#include "ephy-file-helpers.h"
+
+static void
+test_ephy_bookmarks_create ()
+{
+ EphyBookmarks *bookmarks;
+
+ bookmarks = ephy_bookmarks_new ();
+ g_assert (bookmarks);
+ g_object_unref (bookmarks);
+}
+
+static void
+test_ephy_bookmarks_add ()
+{
+ EphyBookmarks *bookmarks;
+ EphyNode *node, *result;
+
+ bookmarks = ephy_bookmarks_new ();
+ g_assert (bookmarks);
+
+ node = ephy_bookmarks_add (bookmarks, "GNOME", "http://www.gnome.org");
+ g_assert (node);
+ result = ephy_bookmarks_find_bookmark (bookmarks, "http://www.gnome.org");
+ g_assert (node == result);
+
+ g_object_unref (bookmarks);
+}
+
+int
+main (int argc, char *argv[])
+{
+ gboolean ret;
+
+ gtk_test_init (&argc, &argv);
+ ephy_debug_init ();
+
+ if (!ephy_file_helpers_init (NULL,
+ EPHY_FILE_HELPERS_PRIVATE_PROFILE | EPHY_FILE_HELPERS_ENSURE_EXISTS,
+ NULL)) {
+ g_debug ("Something wrong happened with ephy_file_helpers_init()");
+ return -1;
+ }
+
+ g_test_add_func ("/src/bookmarks/ephy-bookmarks/create",
+ test_ephy_bookmarks_create);
+
+ g_test_add_func ("/src/bookmarks/ephy-bookmarks/add",
+ test_ephy_bookmarks_add);
+
+ ret = g_test_run ();
+
+ return ret;
+}