empathy r1547 - trunk/tests



Author: xclaesse
Date: Mon Oct 13 07:53:59 2008
New Revision: 1547
URL: http://svn.gnome.org/viewvc/empathy?rev=1547&view=rev

Log:
copy chatrooms xml file instead of using the sample one for tests

Modified:
   trunk/tests/check-empathy-chatroom-manager.c

Modified: trunk/tests/check-empathy-chatroom-manager.c
==============================================================================
--- trunk/tests/check-empathy-chatroom-manager.c	(original)
+++ trunk/tests/check-empathy-chatroom-manager.c	Mon Oct 13 07:53:59 2008
@@ -19,12 +19,41 @@
       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;
 
-  file = get_xml_file (CHATROOM_SAMPLE);
+  copy_chatroom_file ();
+  file = get_xml_file (CHATROOM_FILE);
   mgr = empathy_chatroom_manager_new (file);
 
   g_free (file);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]