Coding style and whitespace cleanups.
[platform/upstream/evolution-data-server.git] / tests / libecal / test-ecal-get-objects-for-uid.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 #include <stdlib.h>
4 #include <libecal/e-cal.h>
5 #include <libical/ical.h>
6
7 #include "ecal-test-utils.h"
8
9 gint
10 main (gint argc, gchar **argv)
11 {
12         ECal *cal;
13         gchar *uri = NULL;
14         icalcomponent *component;
15         icalcomponent *component_final;
16         ECalComponent *e_component_final;
17         gchar *uid;
18         GList *components;
19
20         g_type_init ();
21
22         cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
23         ecal_test_utils_cal_open (cal, FALSE);
24
25         component = icalcomponent_new (ICAL_VEVENT_COMPONENT);
26         uid = ecal_test_utils_cal_create_object (cal, component);
27
28         component_final = ecal_test_utils_cal_get_object (cal, uid);
29         ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
30         icalcomponent_free (component_final);
31
32         /* The list of component and all subcomponents should just contain the
33          * component itself (wrapped in an ECalComponent) */
34         components = ecal_test_utils_cal_get_objects_for_uid (cal, uid);
35         g_assert (g_list_length (components) == 1);
36         e_component_final = components->data;
37         component_final = e_cal_component_get_icalcomponent (e_component_final);
38         ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
39
40         ecal_test_utils_cal_remove (cal);
41
42         g_list_foreach (components, (GFunc) g_object_unref, NULL);
43         g_list_free (components);
44         g_free (uid);
45         icalcomponent_free (component);
46
47         return 0;
48 }