aboutsummaryrefslogtreecommitdiffstats
path: root/tests/empathy-irc-server-test.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-10-28 00:10:41 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-03 20:25:01 +0800
commit85268449651286df02e6da607abd98828fd68a6a (patch)
tree91030f116511b107fa94493352d75b3f90d41e5d /tests/empathy-irc-server-test.c
parent2a974fc78e833d232a6203d5a807b0ee5efb396a (diff)
downloadgsoc2013-empathy-85268449651286df02e6da607abd98828fd68a6a.tar.gz
gsoc2013-empathy-85268449651286df02e6da607abd98828fd68a6a.tar.zst
gsoc2013-empathy-85268449651286df02e6da607abd98828fd68a6a.zip
port check-empathy-irc-server.c to GTest
Diffstat (limited to 'tests/empathy-irc-server-test.c')
-rw-r--r--tests/empathy-irc-server-test.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/tests/empathy-irc-server-test.c b/tests/empathy-irc-server-test.c
new file mode 100644
index 000000000..b9574c40c
--- /dev/null
+++ b/tests/empathy-irc-server-test.c
@@ -0,0 +1,98 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "check-irc-helper.h"
+#include "test-helper.h"
+
+#include <libempathy/empathy-irc-server.h>
+
+static void
+test_empathy_irc_server_new (void)
+{
+ EmpathyIrcServer *server;
+
+ server = empathy_irc_server_new ("test.localhost", 6667, TRUE);
+ check_server (server, "test.localhost", 6667, TRUE);
+
+ g_object_unref (server);
+}
+
+static void
+test_property_change (void)
+{
+ EmpathyIrcServer *server;
+
+ server = empathy_irc_server_new ("test.localhost", 6667, TRUE);
+ g_assert (server != NULL);
+
+ g_object_set (server,
+ "address", "test2.localhost",
+ "port", 6668,
+ "ssl", FALSE,
+ NULL);
+
+ check_server (server, "test2.localhost", 6668, FALSE);
+
+ g_object_unref (server);
+}
+
+static gboolean modified = FALSE;
+
+static void
+modified_cb (EmpathyIrcServer *server,
+ gpointer unused)
+{
+ modified = TRUE;
+}
+
+static void
+test_modified_signal (void)
+{
+ EmpathyIrcServer *server;
+
+ server = empathy_irc_server_new ("test.localhost", 6667, TRUE);
+ g_assert (server != NULL);
+
+ g_signal_connect (server, "modified", G_CALLBACK (modified_cb), NULL);
+
+ /* address */
+ g_object_set (server, "address", "test2.localhost", NULL);
+ g_assert (modified);
+ modified = FALSE;
+ g_object_set (server, "address", "test2.localhost", NULL);
+ g_assert (!modified);
+
+ /* port */
+ g_object_set (server, "port", 6668, NULL);
+ g_assert (modified);
+ modified = FALSE;
+ g_object_set (server, "port", 6668, NULL);
+ g_assert (!modified);
+
+ /* ssl */
+ g_object_set (server, "ssl", FALSE, NULL);
+ g_assert (modified);
+ modified = FALSE;
+ g_object_set (server, "ssl", FALSE, NULL);
+ g_assert (!modified);
+
+ g_object_unref (server);
+}
+
+int
+main (int argc,
+ char **argv)
+{
+ int result;
+
+ test_init (argc, argv);
+
+ g_test_add_func ("/irc-server/new", test_empathy_irc_server_new);
+ g_test_add_func ("/irc-server/property-change", test_property_change);
+ g_test_add_func ("/irc-server/modified-signal", test_modified_signal);
+
+ result = g_test_run ();
+ test_deinit ();
+ return result;
+}