1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
4 #include <libecal/e-cal.h>
5 #include <libical/ical.h>
7 #include "ecal-test-utils.h"
9 #define EVENT_SUMMARY "Creation of new test event"
10 #define INITIAL_BEGIN_TIME "20040109T090000Z"
11 #define INITIAL_BEGIN_TIMEZONE "UTC"
12 #define INITIAL_END_TIME "20040109T103000"
13 #define INITIAL_END_TIMEZONE "UTC"
14 #define FINAL_BEGIN_TIME "20091221T090000Z"
15 #define FINAL_BEGIN_TIMEZONE "UTC"
23 ECalComponent *e_component;
24 ECalComponent *e_component_final;
25 icalcomponent *component;
26 icalcomponent *component_final;
27 struct icaltimetype icaltime;
32 cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
33 ecal_test_utils_cal_open (cal, FALSE);
35 ecal_test_utils_create_component (cal, INITIAL_BEGIN_TIME,
36 INITIAL_BEGIN_TIMEZONE, INITIAL_END_TIME,
37 INITIAL_END_TIMEZONE, EVENT_SUMMARY, &e_component,
39 component = e_cal_component_get_icalcomponent (e_component);
41 component_final = ecal_test_utils_cal_get_object (cal, uid);
42 ecal_test_utils_cal_assert_objects_equal_shallow (component,
44 icalcomponent_free (component_final);
46 /* make and commit changes */
47 icaltime = icaltime_from_string (FINAL_BEGIN_TIME);
48 icalcomponent_set_dtstart (component, icaltime);
49 ecal_test_utils_cal_component_set_icalcomponent (e_component,
51 ecal_test_utils_cal_modify_object (cal, component, CALOBJ_MOD_ALL);
54 component_final = ecal_test_utils_cal_get_object (cal, uid);
55 e_component_final = e_cal_component_new ();
56 ecal_test_utils_cal_component_set_icalcomponent (e_component_final,
59 ecal_test_utils_cal_assert_e_cal_components_equal (e_component,
62 g_object_unref (e_component_final);
64 icalcomponent_free (component);