3.12.12
[nijm-empathy.git] / tests / empathy-irc-server-test.c
blob5be3a5ece59ec8e631256f0dbe2179fdaaf5eae2
1 #include "config.h"
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <string.h>
6 #include <tp-account-widgets/tpaw-irc-server.h>
8 #include "test-helper.h"
9 #include "test-irc-helper.h"
11 static void
12 test_tpaw_irc_server_new (void)
14 TpawIrcServer *server;
16 server = tpaw_irc_server_new ("test.localhost", 6667, TRUE);
17 check_server (server, "test.localhost", 6667, TRUE);
19 g_object_unref (server);
22 static void
23 test_property_change (void)
25 TpawIrcServer *server;
27 server = tpaw_irc_server_new ("test.localhost", 6667, TRUE);
28 g_assert (server != NULL);
30 g_object_set (server,
31 "address", "test2.localhost",
32 "port", 6668,
33 "ssl", FALSE,
34 NULL);
36 check_server (server, "test2.localhost", 6668, FALSE);
38 g_object_unref (server);
41 static gboolean modified = FALSE;
43 static void
44 modified_cb (TpawIrcServer *server,
45 gpointer unused)
47 modified = TRUE;
50 static void
51 test_modified_signal (void)
53 TpawIrcServer *server;
55 server = tpaw_irc_server_new ("test.localhost", 6667, TRUE);
56 g_assert (server != NULL);
58 g_signal_connect (server, "modified", G_CALLBACK (modified_cb), NULL);
60 /* address */
61 g_object_set (server, "address", "test2.localhost", NULL);
62 g_assert (modified);
63 modified = FALSE;
64 g_object_set (server, "address", "test2.localhost", NULL);
65 g_assert (!modified);
67 /* port */
68 g_object_set (server, "port", 6668, NULL);
69 g_assert (modified);
70 modified = FALSE;
71 g_object_set (server, "port", 6668, NULL);
72 g_assert (!modified);
74 /* ssl */
75 g_object_set (server, "ssl", FALSE, NULL);
76 g_assert (modified);
77 modified = FALSE;
78 g_object_set (server, "ssl", FALSE, NULL);
79 g_assert (!modified);
81 g_object_unref (server);
84 int
85 main (int argc,
86 char **argv)
88 int result;
90 test_init (argc, argv);
92 g_test_add_func ("/irc-server/new", test_tpaw_irc_server_new);
93 g_test_add_func ("/irc-server/property-change", test_property_change);
94 g_test_add_func ("/irc-server/modified-signal", test_modified_signal);
96 result = g_test_run ();
97 test_deinit ();
98 return result;