[evolution-data-server] Add a test for EDataCal method 'receiveObjects'.



commit b75ca066e61c0d914951cca661c178c933eebca2
Author: Travis Reitter <treitter gmail com>
Date:   Tue Dec 22 21:01:54 2009 -0800

    Add a test for EDataCal method 'receiveObjects'.

 calendar/tests/ecal/Makefile.am                 |    3 ++
 calendar/tests/ecal/ecal-test-utils.c           |   13 ++++++++
 calendar/tests/ecal/ecal-test-utils.h           |    3 ++
 calendar/tests/ecal/test-ecal-receive-objects.c |   36 +++++++++++++++++++++++
 4 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/calendar/tests/ecal/Makefile.am b/calendar/tests/ecal/Makefile.am
index 74e082b..38edcb8 100644
--- a/calendar/tests/ecal/Makefile.am
+++ b/calendar/tests/ecal/Makefile.am
@@ -51,6 +51,7 @@ TESTS = \
         test-ecal-get-object-list		\
         test-ecal-modify-object			\
         test-ecal-send-objects			\
+        test-ecal-receive-objects		\
         $(NULL)
 
 # The test program
@@ -89,6 +90,8 @@ test_ecal_modify_object_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_modify_object_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
 test_ecal_open_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_open_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
+test_ecal_receive_objects_LDADD=$(TEST_ECAL_LIBS)
+test_ecal_receive_objects_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
 test_ecal_remove_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_remove_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
 test_ecal_remove_object_LDADD=$(TEST_ECAL_LIBS)
diff --git a/calendar/tests/ecal/ecal-test-utils.c b/calendar/tests/ecal/ecal-test-utils.c
index 0b1be76..ea82c46 100644
--- a/calendar/tests/ecal/ecal-test-utils.c
+++ b/calendar/tests/ecal/ecal-test-utils.c
@@ -634,3 +634,16 @@ ecal_test_utils_cal_send_objects (ECal           *cal,
 		g_print ("        %s\n", (const char*) l->data);
 	}
 }
+
+void
+ecal_test_utils_cal_receive_objects (ECal          *cal,
+				     icalcomponent *component)
+{
+	GError *error = NULL;
+
+	if (!e_cal_receive_objects (cal, component, &error)) {
+		g_error ("receiving objects: %s\n", error->message);
+	}
+
+	g_print ("successfully received the objects\n");
+}
diff --git a/calendar/tests/ecal/ecal-test-utils.h b/calendar/tests/ecal/ecal-test-utils.h
index 641d6f1..ff3adaf 100644
--- a/calendar/tests/ecal/ecal-test-utils.h
+++ b/calendar/tests/ecal/ecal-test-utils.h
@@ -140,5 +140,8 @@ ecal_test_utils_cal_send_objects (ECal           *cal,
                                   GList         **users,
                                   icalcomponent **component_final);
 
+void
+ecal_test_utils_cal_receive_objects (ECal          *cal,
+                                     icalcomponent *component);
 
 #endif /* _ECAL_TEST_UTILS_H */
diff --git a/calendar/tests/ecal/test-ecal-receive-objects.c b/calendar/tests/ecal/test-ecal-receive-objects.c
new file mode 100644
index 0000000..6500d8f
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-receive-objects.c
@@ -0,0 +1,36 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal.h>
+#include <libical/ical.h>
+
+#include "ecal-test-utils.h"
+
+gint
+main (gint argc, gchar **argv)
+{
+	ECal *cal;
+	char *uri = NULL;
+	ECalComponent *e_component = NULL;
+	icalcomponent *component = NULL;
+	char *uid = NULL;
+
+	g_type_init ();
+
+	cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+	ecal_test_utils_cal_open (cal, FALSE);
+
+        ecal_test_utils_create_component (cal, "20040109T090000Z", "UTC",
+			"20040109T103000", "UTC", "meeting request",
+			&e_component, &uid);
+
+	component = e_cal_component_get_icalcomponent (e_component);
+	ecal_test_utils_cal_receive_objects (cal, component);
+
+	ecal_test_utils_cal_remove (cal);
+
+	g_object_unref (e_component);
+	g_free (uid);
+
+	return 0;
+}



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