]> git.0d.be Git - empathy.git/blob - tests/test-irc-helper.c
Updated Galician translations for docs
[empathy.git] / tests / test-irc-helper.c
1 #include "config.h"
2 #include "test-irc-helper.h"
3
4 void
5 check_server (TpawIrcServer *server,
6               const gchar *_address,
7               guint _port,
8               gboolean _ssl)
9 {
10   gchar *address;
11   guint port;
12   gboolean ssl;
13
14   g_assert (server != NULL);
15
16   g_object_get (server,
17       "address", &address,
18       "port", &port,
19       "ssl", &ssl,
20       NULL);
21
22   g_assert (address != NULL && strcmp (address, _address) == 0);
23   g_assert (port == _port);
24   g_assert (ssl == _ssl);
25
26   g_free (address);
27 }
28
29 void
30 check_network (TpawIrcNetwork *network,
31               const gchar *_name,
32               const gchar *_charset,
33               struct server_t *_servers,
34               guint nb_servers)
35 {
36   gchar  *name, *charset;
37   GSList *servers, *l;
38   guint i;
39
40   g_assert (network != NULL);
41
42   g_object_get (network,
43       "name", &name,
44       "charset", &charset,
45       NULL);
46
47   g_assert (name != NULL && strcmp (name, _name) == 0);
48   g_assert (charset != NULL && strcmp (charset, _charset) == 0);
49
50   servers = tpaw_irc_network_get_servers (network);
51   g_assert (g_slist_length (servers) == nb_servers);
52
53   /* Is that the right servers ? */
54   for (l = servers, i = 0; l != NULL; l = g_slist_next (l), i++)
55     {
56       TpawIrcServer *server;
57       gchar *address;
58       guint port;
59       gboolean ssl;
60
61       server = l->data;
62
63       g_object_get (server,
64           "address", &address,
65           "port", &port,
66           "ssl", &ssl,
67           NULL);
68
69       g_assert (address != NULL && strcmp (address, _servers[i].address)
70           == 0);
71       g_assert (port == _servers[i].port);
72       g_assert (ssl == _servers[i].ssl);
73
74       g_free (address);
75     }
76
77   g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
78   g_slist_free (servers);
79   g_free (name);
80   g_free (charset);
81 }