aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check-empathy-chatroom-manager.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:02 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-10-13 15:54:02 +0800
commitf0762d3d556c168c9ec1d85d69cf10cdf2fef97a (patch)
tree6aabff5ab9b31bc0885b3b8c6e0b530313f6c833 /tests/check-empathy-chatroom-manager.c
parent70730f587cae7c323d2c6d58384b8c628c62c5ad (diff)
downloadgsoc2013-empathy-f0762d3d556c168c9ec1d85d69cf10cdf2fef97a.tar
gsoc2013-empathy-f0762d3d556c168c9ec1d85d69cf10cdf2fef97a.tar.gz
gsoc2013-empathy-f0762d3d556c168c9ec1d85d69cf10cdf2fef97a.tar.bz2
gsoc2013-empathy-f0762d3d556c168c9ec1d85d69cf10cdf2fef97a.tar.lz
gsoc2013-empathy-f0762d3d556c168c9ec1d85d69cf10cdf2fef97a.tar.xz
gsoc2013-empathy-f0762d3d556c168c9ec1d85d69cf10cdf2fef97a.tar.zst
gsoc2013-empathy-f0762d3d556c168c9ec1d85d69cf10cdf2fef97a.zip
factor out get_xml_file, get_user_xml_file and copy_xml_file
svn path=/trunk/; revision=1548
Diffstat (limited to 'tests/check-empathy-chatroom-manager.c')
-rw-r--r--tests/check-empathy-chatroom-manager.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/tests/check-empathy-chatroom-manager.c b/tests/check-empathy-chatroom-manager.c
index 25014da1f..fbeb9bae1 100644
--- a/tests/check-empathy-chatroom-manager.c
+++ b/tests/check-empathy-chatroom-manager.c
@@ -12,47 +12,12 @@
#define CHATROOM_SAMPLE "chatrooms-sample.xml"
#define CHATROOM_FILE "chatrooms.xml"
-static gchar *
-get_xml_file (const gchar *filename)
-{
- return g_build_filename (g_getenv ("EMPATHY_SRCDIR"), "tests", "xml",
- filename, NULL);
-}
-
-static gchar *
-get_user_xml_file (const gchar *filename)
-{
- return g_build_filename (g_get_tmp_dir (), filename, NULL);
-}
-
-static void
-copy_chatroom_file (void)
-{
- gboolean result;
- gchar *buffer;
- gsize length;
- gchar *sample;
- gchar *file;
-
- sample = get_xml_file (CHATROOM_SAMPLE);
- result = g_file_get_contents (sample, &buffer, &length, NULL);
- fail_if (!result);
-
- file = get_user_xml_file (CHATROOM_FILE);
- result = g_file_set_contents (file, buffer, length, NULL);
- fail_if (!result);
-
- g_free (sample);
- g_free (file);
- g_free (buffer);
-}
-
START_TEST (test_empathy_chatroom_manager_new)
{
EmpathyChatroomManager *mgr;
gchar *file;
- copy_chatroom_file ();
+ copy_xml_file (CHATROOM_SAMPLE, CHATROOM_FILE);
file = get_xml_file (CHATROOM_FILE);
mgr = empathy_chatroom_manager_new (file);