summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-08-27 13:24:05 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-08-28 11:13:27 +0100
commit16df0d82689c0d916c1657ca987a7265eddf7eb8 (patch)
tree4c018db1a8a9b569840318fd4e8aada97383103a
parent0e35b89efafb1f8f7c9cac4110fd348bfcafa285 (diff)
add and test wocky_resource_contact_get_bare_contact
-rw-r--r--tests/wocky-resource-contact-test.c20
-rw-r--r--wocky/wocky-resource-contact.c8
-rw-r--r--wocky/wocky-resource-contact.h3
3 files changed, 31 insertions, 0 deletions
diff --git a/tests/wocky-resource-contact-test.c b/tests/wocky-resource-contact-test.c
index 9661031..0d4aa16 100644
--- a/tests/wocky-resource-contact-test.c
+++ b/tests/wocky-resource-contact-test.c
@@ -56,6 +56,25 @@ test_get_resource (void)
g_object_unref (resource_contact);
}
+static void
+test_get_bare_contact (void)
+{
+ WockyBareContact *bare_contact;
+ WockyResourceContact *resource_contact;
+
+ bare_contact = g_object_new (WOCKY_TYPE_BARE_CONTACT,
+ "jid", "juliet@example.net",
+ NULL);
+
+ resource_contact = wocky_resource_contact_new (bare_contact, "Balcony");
+
+ g_assert (wocky_resource_contact_get_bare_contact (resource_contact) ==
+ bare_contact);
+
+ g_object_unref (bare_contact);
+ g_object_unref (resource_contact);
+}
+
int
main (int argc, char **argv)
{
@@ -65,6 +84,7 @@ main (int argc, char **argv)
g_test_add_func ("/resource-contact/instantiation", test_instantiation);
g_test_add_func ("/resource-contact/get-resource", test_get_resource);
+ g_test_add_func ("/resource-contact/get-bare-contact", test_get_bare_contact);
result = g_test_run ();
test_deinit ();
diff --git a/wocky/wocky-resource-contact.c b/wocky/wocky-resource-contact.c
index 9a28ddc..058cb0d 100644
--- a/wocky/wocky-resource-contact.c
+++ b/wocky/wocky-resource-contact.c
@@ -225,3 +225,11 @@ wocky_resource_contact_get_resource (WockyResourceContact *self)
return priv->resource;
}
+
+WockyBareContact *
+wocky_resource_contact_get_bare_contact (WockyResourceContact *self)
+{
+ WockyResourceContactPrivate *priv = WOCKY_RESOURCE_CONTACT_GET_PRIVATE (self);
+
+ return priv->bare_contact;
+}
diff --git a/wocky/wocky-resource-contact.h b/wocky/wocky-resource-contact.h
index 597c3a5..765074e 100644
--- a/wocky/wocky-resource-contact.h
+++ b/wocky/wocky-resource-contact.h
@@ -64,6 +64,9 @@ WockyResourceContact * wocky_resource_contact_new (WockyBareContact *bare,
const gchar * wocky_resource_contact_get_resource (
WockyResourceContact *contact);
+WockyBareContact * wocky_resource_contact_get_bare_contact (
+ WockyResourceContact *contact);
+
G_END_DECLS
#endif /* #ifndef __WOCKY_RESOURCE_CONTACT_H__*/