Adapt libecal to the new ESource API.
[platform/upstream/evolution-data-server.git] / tests / libecal / test-ecal-get-free-busy.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 <libecal/e-cal-time-util.h>
6 #include <libical/ical.h>
7
8 #include "ecal-test-utils.h"
9
10 gint
11 main (gint argc,
12       gchar **argv)
13 {
14         ECal *cal;
15         gchar *uri = NULL;
16         GList *users = NULL;
17         icaltimezone *utc;
18         time_t start, end;
19         GList *free_busy;
20
21         g_type_init ();
22
23         cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
24         ecal_test_utils_cal_open (cal, FALSE);
25
26         utc = icaltimezone_get_utc_timezone ();
27         start = time_from_isodate ("20040212T000000Z");
28         end = time_add_day_with_zone (start, 2, utc);
29         users = g_list_prepend (users, (gpointer) "user@example.com");
30
31         free_busy = ecal_test_utils_cal_get_free_busy (cal, users, start, end);
32
33         g_list_foreach (free_busy, (GFunc) g_object_unref, NULL);
34         g_list_free (free_busy);
35
36         return 0;
37 }