aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ephy-bookmarks-test.c
blob: 464a9de463d6a8e3507060b72266573e54795b70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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;
}