1
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3
* Copyright © 2012 - Igalia S.L.
5
* Epiphany is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* Epiphany is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with Epiphany; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor,
18
* Boston, MA 02110-1301 USA
23
#include "ephy-debug.h"
24
#include "ephy-embed-prefs.h"
25
#include "ephy-encodings.h"
26
#include "ephy-file-helpers.h"
27
#include "ephy-private.h"
28
#include "ephy-shell.h"
32
/* TODO: don't hardcode the number of encodings in ephy-encodings.c here! */
33
#define NUM_ENCODINGS 78
36
test_ephy_encodings_create ()
38
EphyEncoding *encoding;
40
encoding = ephy_encoding_new ("UTF-8", "Unicode (UTF-8)",
43
g_assert_cmpstr (ephy_encoding_get_encoding (encoding), ==, "UTF-8");
44
g_assert_cmpstr (ephy_encoding_get_title (encoding), ==, "Unicode (UTF-8)");
45
g_assert_cmpstr (ephy_encoding_get_title_elided (encoding), ==, "Unicode (UTF-8)");
46
g_assert_cmpstr (ephy_encoding_get_collation_key (encoding), ==, "Unicode (UTF-8)");
47
g_assert_cmpint (ephy_encoding_get_language_groups (encoding), ==, LG_UNICODE);
49
g_object_unref (encoding);
53
test_ephy_encodings_get ()
55
EphyEncodings *encodings;
58
encodings = EPHY_ENCODINGS (ephy_embed_shell_get_encodings (embed_shell));
61
all = ephy_encodings_get_all (encodings);
63
g_assert_cmpint (g_list_length (all), ==, NUM_ENCODINGS);
65
for (p = all; p; p = p->next) {
66
EphyEncoding *encoding = EPHY_ENCODING (p->data);
68
g_assert (EPHY_IS_ENCODING (encoding));
75
main (int argc, char *argv[])
79
gtk_test_init (&argc, &argv);
82
ephy_embed_prefs_init ();
84
if (!ephy_file_helpers_init (NULL,
85
EPHY_FILE_HELPERS_PRIVATE_PROFILE | EPHY_FILE_HELPERS_ENSURE_EXISTS,
87
g_debug ("Something wrong happened with ephy_file_helpers_init()");
91
_ephy_shell_create_instance (EPHY_EMBED_SHELL_MODE_TEST);
92
g_assert (ephy_shell);
94
g_test_add_func ("/src/ephy-encodings/create",
95
test_ephy_encodings_create);
97
g_test_add_func ("/src/ephy-encodings/get",
98
test_ephy_encodings_get);
102
ephy_file_helpers_shutdown ();
103
g_object_unref (ephy_shell);