soylent r230 - trunk/libsoylent/test



Author: svenp
Date: Mon Jul 21 16:57:22 2008
New Revision: 230
URL: http://svn.gnome.org/viewvc/soylent?rev=230&view=rev

Log:
added functions to setup and clean a test-addressbook for tests

Modified:
   trunk/libsoylent/test/test.c
   trunk/libsoylent/test/test.h

Modified: trunk/libsoylent/test/test.c
==============================================================================
--- trunk/libsoylent/test/test.c	(original)
+++ trunk/libsoylent/test/test.c	Mon Jul 21 16:57:22 2008
@@ -34,3 +34,33 @@
       g_warning ("failed to initialize libsoylent");
     }
 }
+
+SlBook *
+test_setup_testbook (void)
+{
+  GError *error = NULL;
+  /*const gchar *testbookname = "testbook";
+  SlBook *testbook = sl_book_create (testbookname, &error);*/
+  /* workaround for known bug 3 */
+  SlBook *testbook = sl_book_open_default (&error);
+  if (testbook == NULL)
+    {
+      /* TODO: quit test here...*/
+      g_warning ("couldn't create addressbook: %s", error->message);
+    }
+  return testbook;
+}
+
+void 
+test_clean_testbook (SlBook *testbook)
+{
+  /* workaround for known bug 3: do nothing */
+  return;
+  GError *error = NULL;
+  if (!sl_book_delete ("testbook", &error))
+    {
+      /* TODO: quit test here...*/
+      g_warning ("couldn't delete addressbook: %s", error->message);
+    }
+  g_object_unref (testbook);
+}

Modified: trunk/libsoylent/test/test.h
==============================================================================
--- trunk/libsoylent/test/test.h	(original)
+++ trunk/libsoylent/test/test.h	Mon Jul 21 16:57:22 2008
@@ -44,5 +44,7 @@
 const gchar *test_name;
 
 void test_soylent_init (void);
+SlBook *test_setup_testbook (void);
+void test_clean_testbook (SlBook *testbook);
 
 #endif



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