[evolution-data-server/treitter-client-gdbus] Port EDataCal methods '{get, create, remove}Object' and add regression tests.
- From: Travis Reitter <treitter src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-data-server/treitter-client-gdbus] Port EDataCal methods '{get, create, remove}Object' and add regression tests.
- Date: Tue, 22 Dec 2009 06:58:16 +0000 (UTC)
commit bdb655bb4bc347b18cde7f3e37fadec4b7cd4347
Author: Travis Reitter <treitter gmail com>
Date: Mon Dec 21 10:54:53 2009 -0800
Port EDataCal methods '{get,create,remove}Object' and add regression tests.
calendar/libecal/e-cal.c | 16 ++--
calendar/libecal/e-data-cal-gdbus-bindings.h | 47 ++++++++
calendar/tests/ecal/Makefile.am | 12 ++
calendar/tests/ecal/ecal-test-utils.c | 121 ++++++++++++++++++++
calendar/tests/ecal/ecal-test-utils.h | 24 ++++
calendar/tests/ecal/test-ecal-create-object--2.c | 73 ++++++++++++
calendar/tests/ecal/test-ecal-create-object.c | 36 ++++++
.../tests/ecal/test-ecal-get-objects-for-uid.c | 48 ++++++++
calendar/tests/ecal/test-ecal-remove-object.c | 36 ++++++
9 files changed, 405 insertions(+), 8 deletions(-)
---
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 1410550..372604a 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -2019,7 +2019,7 @@ e_cal_get_object (ECal *ecal, const gchar *uid, const gchar *rid, icalcomponent
e_return_error_if_fail (icalcomp != NULL, E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
priv = ecal->priv;
- e_return_error_if_fail (priv->proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
+ e_return_error_if_fail (priv->gdbus_proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
*icalcomp = NULL;
if (priv->load_state != E_CAL_LOAD_LOADED) {
@@ -2027,7 +2027,7 @@ e_cal_get_object (ECal *ecal, const gchar *uid, const gchar *rid, icalcomponent
}
LOCK_CONN ();
- if (!org_gnome_evolution_dataserver_calendar_Cal_get_object (priv->proxy, uid, rid ? rid : "", &object, error)) {
+ if (!e_data_cal_gdbus_get_object_sync (priv->gdbus_proxy, uid, rid ? rid : "", &object, error)) {
UNLOCK_CONN ();
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
@@ -2099,7 +2099,7 @@ e_cal_get_objects_for_uid (ECal *ecal, const gchar *uid, GList **objects, GError
e_return_error_if_fail (objects != NULL, E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
priv = ecal->priv;
- e_return_error_if_fail (priv->proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
+ e_return_error_if_fail (priv->gdbus_proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
*objects = NULL;
if (priv->load_state != E_CAL_LOAD_LOADED) {
@@ -2107,7 +2107,7 @@ e_cal_get_objects_for_uid (ECal *ecal, const gchar *uid, GList **objects, GError
}
LOCK_CONN ();
- if (!org_gnome_evolution_dataserver_calendar_Cal_get_object (priv->proxy, uid, "", &object, error)) {
+ if (!e_data_cal_gdbus_get_object_sync (priv->gdbus_proxy, uid, "", &object, error)) {
UNLOCK_CONN ();
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
@@ -3420,7 +3420,7 @@ e_cal_create_object (ECal *ecal, icalcomponent *icalcomp, gchar **uid, GError **
e_return_error_if_fail (icalcomp != NULL, E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (icalcomponent_is_valid (icalcomp), E_CALENDAR_STATUS_INVALID_ARG);
priv = ecal->priv;
- e_return_error_if_fail (priv->proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
+ e_return_error_if_fail (priv->gdbus_proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
if (priv->load_state != E_CAL_LOAD_LOADED) {
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
@@ -3428,7 +3428,7 @@ e_cal_create_object (ECal *ecal, icalcomponent *icalcomp, gchar **uid, GError **
obj = icalcomponent_as_ical_string_r (icalcomp);
LOCK_CONN ();
- if (!org_gnome_evolution_dataserver_calendar_Cal_create_object (priv->proxy, obj, &muid, error)) {
+ if (!e_data_cal_gdbus_create_object_sync (priv->gdbus_proxy, obj, &muid, error)) {
UNLOCK_CONN ();
g_free (obj);
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
@@ -3527,14 +3527,14 @@ e_cal_remove_object_with_mod (ECal *ecal, const gchar *uid,
e_return_error_if_fail (uid, E_CALENDAR_STATUS_INVALID_ARG);
e_return_error_if_fail (mod & CALOBJ_MOD_ALL, E_CALENDAR_STATUS_INVALID_ARG);
priv = ecal->priv;
- e_return_error_if_fail (priv->proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
+ e_return_error_if_fail (priv->gdbus_proxy, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
if (priv->load_state != E_CAL_LOAD_LOADED) {
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_URI_NOT_LOADED, error);
}
LOCK_CONN ();
- if (!org_gnome_evolution_dataserver_calendar_Cal_remove_object (priv->proxy, uid, rid ? rid : "", mod, error)) {
+ if (!e_data_cal_gdbus_remove_object_sync (priv->gdbus_proxy, uid, rid ? rid : "", mod, error)) {
UNLOCK_CONN ();
E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
}
diff --git a/calendar/libecal/e-data-cal-gdbus-bindings.h b/calendar/libecal/e-data-cal-gdbus-bindings.h
index 9f524d6..3b33941 100644
--- a/calendar/libecal/e-data-cal-gdbus-bindings.h
+++ b/calendar/libecal/e-data-cal-gdbus-bindings.h
@@ -201,6 +201,22 @@ e_data_cal_gdbus_set_mode (GDBusProxy *proxy,
}
static gboolean
+e_data_cal_gdbus_get_object_sync (GDBusProxy *proxy,
+ const char *IN_uid,
+ const char *IN_rid,
+ char **OUT_object,
+ GError **error)
+{
+ GVariant *parameters;
+ GVariant *retvals;
+
+ parameters = g_variant_new ("(ss)", IN_uid, IN_rid);
+ retvals = g_dbus_proxy_invoke_method_sync (proxy, "getObject", parameters, -1, NULL, error);
+
+ return demarshal_retvals__STRING (retvals, OUT_object);
+}
+
+static gboolean
e_data_cal_gdbus_get_default_object_sync (GDBusProxy *proxy,
char **object,
GError **error)
@@ -214,4 +230,35 @@ e_data_cal_gdbus_get_default_object_sync (GDBusProxy *proxy,
return demarshal_retvals__STRING (retvals, object);
}
+static gboolean
+e_data_cal_gdbus_create_object_sync (GDBusProxy *proxy,
+ const char *IN_object,
+ char **OUT_uid,
+ GError **error)
+{
+ GVariant *parameters;
+ GVariant *retvals;
+
+ parameters = g_variant_new ("(s)", IN_object);
+ retvals = g_dbus_proxy_invoke_method_sync (proxy, "createObject", parameters, -1, NULL, error);
+
+ return demarshal_retvals__STRING (retvals, OUT_uid);
+}
+
+static gboolean
+e_data_cal_gdbus_remove_object_sync (GDBusProxy *proxy,
+ const char *IN_uid,
+ const char *IN_rid,
+ guint IN_mod,
+ GError **error)
+{
+ GVariant *parameters;
+ GVariant *retvals;
+
+ parameters = g_variant_new ("(ssu)", IN_uid, IN_rid, IN_mod);
+ retvals = g_dbus_proxy_invoke_method_sync (proxy, "removeObject", parameters, -1, NULL, error);
+
+ return demarshal_retvals__VOID (retvals);
+}
+
G_END_DECLS
diff --git a/calendar/tests/ecal/Makefile.am b/calendar/tests/ecal/Makefile.am
index 93e16db..e9d1d6d 100644
--- a/calendar/tests/ecal/Makefile.am
+++ b/calendar/tests/ecal/Makefile.am
@@ -40,6 +40,10 @@ TESTS = \
test-ecal-get-capabilities \
test-ecal-get-default-object \
test-ecal-set-mode \
+ test-ecal-create-object \
+ test-ecal-create-object--2 \
+ test-ecal-get-objects-for-uid \
+ test-ecal-remove-object \
$(NULL)
# The test program
@@ -50,6 +54,10 @@ TEST_ECAL_CPPFLAGS= \
$(NULL)
# ordered alphanumerically
+test_ecal_create_object_LDADD=$(TEST_ECAL_LIBS)
+test_ecal_create_object_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
+test_ecal_create_object__2_LDADD=$(TEST_ECAL_LIBS)
+test_ecal_create_object__2_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_get_alarm_email_address_LDADD=$(TEST_ECAL_LIBS)
test_ecal_get_alarm_email_address_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_get_cal_address_LDADD=$(TEST_ECAL_LIBS)
@@ -60,10 +68,14 @@ test_ecal_get_ldap_attribute_LDADD=$(TEST_ECAL_LIBS)
test_ecal_get_ldap_attribute_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_get_capabilities_LDADD=$(TEST_ECAL_LIBS)
test_ecal_get_capabilities_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
+test_ecal_get_objects_for_uid_LDADD=$(TEST_ECAL_LIBS)
+test_ecal_get_objects_for_uid_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_open_LDADD=$(TEST_ECAL_LIBS)
test_ecal_open_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)
+test_ecal_remove_object_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_set_mode_LDADD=$(TEST_ECAL_LIBS)
test_ecal_set_mode_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
diff --git a/calendar/tests/ecal/ecal-test-utils.c b/calendar/tests/ecal/ecal-test-utils.c
index 3bdd96e..149b981 100644
--- a/calendar/tests/ecal/ecal-test-utils.c
+++ b/calendar/tests/ecal/ecal-test-utils.c
@@ -263,6 +263,85 @@ ecal_test_utils_cal_get_capabilities (ECal *cal)
);
}
+void
+ecal_test_utils_cal_assert_objects_equal_shallow (icalcomponent *a,
+ icalcomponent *b)
+{
+ const char *uid_a, *uid_b;
+
+ if (!icalcomponent_is_valid (a) && !icalcomponent_is_valid (b)) {
+ g_warning ("both components invalid");
+ return;
+ }
+
+ if (!icalcomponent_is_valid (a) || !icalcomponent_is_valid (b)) {
+ g_error ("exactly one of the components being compared is invalid");
+ }
+
+ uid_a = icalcomponent_get_uid (a);
+ uid_b = icalcomponent_get_uid (b);
+ if (g_strcmp0 (uid_a, uid_b)) {
+ g_error ("icomponents not equal:\n"
+ " uid A: '%s'\n"
+ " uid b: '%s'\n",
+ uid_a, uid_b);
+ }
+}
+
+void
+ecal_test_utils_cal_assert_e_cal_components_equal (ECalComponent *a,
+ ECalComponent *b)
+{
+ icalcomponent *ical_a, *ical_b;
+ ECalComponentTransparency transp_a, transp_b;
+
+ ical_a = e_cal_component_get_icalcomponent (a);
+ ical_b = e_cal_component_get_icalcomponent (b);
+ ecal_test_utils_cal_assert_objects_equal_shallow (ical_a, ical_b);
+
+ /* Dumping icalcomp into a string is not useful as the retrieved object
+ * has some generated information like timestamps. We compare
+ * member values we set during creation*/
+ g_assert (e_cal_component_event_dates_match (a, b));
+
+ e_cal_component_get_transparency (a, &transp_a);
+ e_cal_component_get_transparency (b, &transp_b);
+ g_assert (transp_a == transp_b);
+}
+
+icalcomponent*
+ecal_test_utils_cal_get_object (ECal *cal,
+ const char *uid)
+{
+ GError *error = NULL;
+ icalcomponent *component = NULL;
+
+ if (!e_cal_get_object (cal, uid, NULL, &component, &error)) {
+ g_warning ("failed to get icalcomponent object '%s'; %s\n", uid, error->message);
+ exit(1);
+ }
+ if (!icalcomponent_is_valid (component)) {
+ g_warning ("retrieved icalcomponent is invalid\n");
+ exit(1);
+ }
+ g_print ("successfully got the icalcomponent object '%s'\n", uid);
+
+ return component;
+}
+
+void
+ecal_test_utils_cal_remove_object (ECal *cal,
+ const char *uid)
+{
+ GError *error = NULL;
+
+ if (!e_cal_remove_object (cal, uid, &error)) {
+ g_warning ("failed to remove icalcomponent object '%s'; %s\n", uid, error->message);
+ exit(1);
+ }
+ g_print ("successfully remoed the icalcomponent object '%s'\n", uid);
+}
+
icalcomponent*
ecal_test_utils_cal_get_default_object (ECal *cal)
{
@@ -282,6 +361,48 @@ ecal_test_utils_cal_get_default_object (ECal *cal)
return component;
}
+GList*
+ecal_test_utils_cal_get_objects_for_uid (ECal *cal,
+ const char *uid)
+{
+ GError *error = NULL;
+ GList *objects = NULL;
+
+ if (!e_cal_get_objects_for_uid (cal, uid, &objects, &error)) {
+ g_warning ("failed to get icalcomponent objects for UID '%s'; %s\n", uid, error->message);
+ exit(1);
+ }
+ g_print ("successfully got objects for the icalcomponent with UID '%s'\n", uid);
+
+ return objects;
+}
+
+char*
+ecal_test_utils_cal_create_object (ECal *cal,
+ icalcomponent *component)
+{
+ GError *error = NULL;
+ char *uid = NULL;
+ char *ical_string = NULL;
+
+ if (!icalcomponent_is_valid (component)) {
+ g_warning ("supplied icalcomponent is invalid\n");
+ exit(1);
+ }
+
+ if (!e_cal_create_object (cal, component, &uid, &error)) {
+ g_warning ("failed to get create an icalcomponent object; %s\n", error->message);
+ exit(1);
+ }
+
+ ical_string = icalcomponent_as_ical_string (component);
+ g_print ("successfully created icalcomponent object '%s'\n%s\n", uid,
+ ical_string);
+ g_free (ical_string);
+
+ return uid;
+}
+
static void
cal_set_mode_cb (ECal *cal,
ECalendarStatus status,
diff --git a/calendar/tests/ecal/ecal-test-utils.h b/calendar/tests/ecal/ecal-test-utils.h
index 3e82c52..c0d25c5 100644
--- a/calendar/tests/ecal/ecal-test-utils.h
+++ b/calendar/tests/ecal/ecal-test-utils.h
@@ -60,9 +60,33 @@ ecal_test_utils_cal_get_ldap_attribute (ECal *cal);
void
ecal_test_utils_cal_get_capabilities (ECal *cal);
+void
+ecal_test_utils_cal_assert_objects_equal_shallow (icalcomponent *a,
+ icalcomponent *b);
+
+void
+ecal_test_utils_cal_assert_e_cal_components_equal (ECalComponent *a,
+ ECalComponent *b);
+
+icalcomponent*
+ecal_test_utils_cal_get_object (ECal *cal,
+ const char *uid);
+
+void
+ecal_test_utils_cal_remove_object (ECal *cal,
+ const char *uid);
+
icalcomponent*
ecal_test_utils_cal_get_default_object (ECal *cal);
+GList*
+ecal_test_utils_cal_get_objects_for_uid (ECal *cal,
+ const char *uid);
+
+char*
+ecal_test_utils_cal_create_object (ECal *cal,
+ icalcomponent *component);
+
void
ecal_test_utils_cal_set_mode (ECal *cal,
CalMode mode,
diff --git a/calendar/tests/ecal/test-ecal-create-object--2.c b/calendar/tests/ecal/test-ecal-create-object--2.c
new file mode 100644
index 0000000..539f38d
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-create-object--2.c
@@ -0,0 +1,73 @@
+/* -*- 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"
+
+static void
+create_test_component (ECal *cal,
+ ECalComponent **comp_out,
+ char **uid_out)
+{
+ ECalComponent *comp;
+ icalcomponent *icalcomp;
+ struct icaltimetype tt;
+ ECalComponentText text;
+ ECalComponentDateTime dt;
+ char *uid;
+
+ comp = e_cal_component_new ();
+ /* set fields */
+ e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT);
+ text.value = "Creation of new test event";
+ text.altrep = NULL;
+ e_cal_component_set_summary (comp, &text);
+ tt = icaltime_from_string ("20040109T090000Z");
+ dt.value = &tt;
+ dt.tzid ="UTC";
+ e_cal_component_set_dtstart (comp, &dt);
+ tt = icaltime_from_string ("20040109T103000");
+ dt.value = &tt;
+ dt.tzid ="UTC";
+ e_cal_component_set_dtend (comp, &dt);
+ e_cal_component_set_transparency (comp, E_CAL_COMPONENT_TRANSP_OPAQUE);
+
+ e_cal_component_commit_sequence (comp);
+ icalcomp = e_cal_component_get_icalcomponent (comp);
+
+ uid = ecal_test_utils_cal_create_object (cal, icalcomp);
+ e_cal_component_commit_sequence (comp);
+
+ *comp_out = comp;
+ *uid_out = uid;
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+ ECal *cal;
+ char *uri = NULL;
+ ECalComponent *comp, *comp_retrieved;
+ icalcomponent *icalcomp_retrieved;
+ char *uid;
+
+ cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+ ecal_test_utils_cal_open (cal, FALSE);
+ create_test_component (cal, &comp, &uid);
+
+ icalcomp_retrieved = ecal_test_utils_cal_get_object (cal, uid);
+ comp_retrieved = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp_retrieved, icalcomp_retrieved)) {
+ g_error ("Could not set icalcomponent\n");
+ }
+
+ ecal_test_utils_cal_assert_e_cal_components_equal (comp, comp_retrieved);
+
+ g_object_unref (comp_retrieved);
+ g_object_unref (comp);
+ g_free (uid);
+
+ return 0;
+}
diff --git a/calendar/tests/ecal/test-ecal-create-object.c b/calendar/tests/ecal/test-ecal-create-object.c
new file mode 100644
index 0000000..4d20482
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-create-object.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;
+ icalcomponent *component;
+ icalcomponent *component_final;
+ char *uid;
+
+ g_type_init ();
+
+ cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+ ecal_test_utils_cal_open (cal, FALSE);
+
+ component = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+ uid = ecal_test_utils_cal_create_object (cal, component);
+
+ component_final = ecal_test_utils_cal_get_object (cal, uid);
+ ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
+
+ ecal_test_utils_cal_remove (cal);
+
+ g_free (uid);
+ icalcomponent_free (component);
+ icalcomponent_free (component_final);
+
+ return 0;
+}
diff --git a/calendar/tests/ecal/test-ecal-get-objects-for-uid.c b/calendar/tests/ecal/test-ecal-get-objects-for-uid.c
new file mode 100644
index 0000000..cd5e7d1
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-get-objects-for-uid.c
@@ -0,0 +1,48 @@
+/* -*- 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;
+ icalcomponent *component;
+ icalcomponent *component_final;
+ ECalComponent *e_component_final;
+ char *uid;
+ GList *components;
+
+ g_type_init ();
+
+ cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+ ecal_test_utils_cal_open (cal, FALSE);
+
+ component = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+ uid = ecal_test_utils_cal_create_object (cal, component);
+
+ component_final = ecal_test_utils_cal_get_object (cal, uid);
+ ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
+ icalcomponent_free (component_final);
+
+ /* The list of component and all subcomponents should just contain the
+ * component itself (wrapped in an ECalComponent) */
+ components = ecal_test_utils_cal_get_objects_for_uid (cal, uid);
+ g_assert (g_list_length (components) == 1);
+ e_component_final = components->data;
+ component_final = e_cal_component_get_icalcomponent (e_component_final);
+ ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
+
+ ecal_test_utils_cal_remove (cal);
+
+ g_list_foreach (components, (GFunc) g_object_unref, NULL);
+ g_list_free (components);
+ g_free (uid);
+ icalcomponent_free (component);
+
+ return 0;
+}
diff --git a/calendar/tests/ecal/test-ecal-remove-object.c b/calendar/tests/ecal/test-ecal-remove-object.c
new file mode 100644
index 0000000..7e05731
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-remove-object.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;
+ icalcomponent *component;
+ icalcomponent *component_final;
+ char *uid;
+
+ g_type_init ();
+
+ cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+ ecal_test_utils_cal_open (cal, FALSE);
+
+ component = icalcomponent_new (ICAL_VEVENT_COMPONENT);
+ uid = ecal_test_utils_cal_create_object (cal, component);
+
+ component_final = ecal_test_utils_cal_get_object (cal, uid);
+ ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
+ ecal_test_utils_cal_remove_object (cal, uid);
+ ecal_test_utils_cal_remove (cal);
+
+ g_free (uid);
+ icalcomponent_free (component);
+ icalcomponent_free (component_final);
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]