[epiphany] tests: some simple EphyBookmarks tests
- From: Xan Lopez <xan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] tests: some simple EphyBookmarks tests
- Date: Fri, 7 Sep 2012 21:35:26 +0000 (UTC)
commit dfb243b5951298d745bb1b670205f8d9a186758d
Author: Xan Lopez <xan igalia com>
Date: Fri Sep 7 23:34:49 2012 +0200
tests: some simple EphyBookmarks tests
tests/Makefile.am | 4 ++
tests/ephy-bookmarks-test.c | 78 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 0 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b480cdc..5ce8c1b 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 0000000..464a9de
--- /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;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]