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