Adapt libecal to the new ESource API.
[platform/upstream/evolution-data-server.git] / tests / libecal / ecal-test-utils.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2009 Intel Corporation
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU Lesser General Public
7  * License as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  *
19  * Author: Travis Reitter (travis.reitter@collabora.co.uk)
20  */
21
22 #ifndef _ECAL_TEST_UTILS_H
23 #define _ECAL_TEST_UTILS_H
24
25 #include <libecal/e-cal.h>
26
27 typedef struct {
28         GSourceFunc  cb;
29         gpointer     user_data;
30         CalMode      mode;
31         ECal        *cal;
32 } ECalTestClosure;
33
34 void
35 test_print (const gchar *format,
36             ...);
37
38 ECal *
39 ecal_test_utils_cal_new_temp (gchar           **uri,
40                               ECalSourceType   type);
41
42 void
43 ecal_test_utils_cal_open (ECal     *cal,
44                           gboolean  only_if_exists);
45
46 void
47 ecal_test_utils_cal_async_open (ECal        *cal,
48                                 gboolean     only_if_exists,
49                                 GSourceFunc  callback,
50                                 gpointer     user_data);
51
52 gchar *
53 ecal_test_utils_cal_get_alarm_email_address (ECal *cal);
54
55 gchar *
56 ecal_test_utils_cal_get_cal_address (ECal *cal);
57
58 gchar *
59 ecal_test_utils_cal_get_ldap_attribute (ECal *cal);
60
61 void
62 ecal_test_utils_cal_get_capabilities (ECal *cal);
63
64 GList *
65 ecal_test_utils_cal_get_free_busy (ECal   *cal,
66                                    GList  *users,
67                                    time_t  start,
68                                    time_t  end);
69
70 void
71 ecal_test_utils_cal_assert_objects_equal_shallow (icalcomponent *a,
72                                                   icalcomponent *b);
73
74 void
75 ecal_test_utils_cal_assert_e_cal_components_equal (ECalComponent *a,
76                                                    ECalComponent *b);
77
78 icalcomponent *
79 ecal_test_utils_cal_get_object (ECal       *cal,
80                                 const gchar *uid);
81
82 void
83 ecal_test_utils_cal_modify_object (ECal          *cal,
84                                    icalcomponent *component,
85                                    CalObjModType  mod_type);
86
87 void
88 ecal_test_utils_cal_remove_object (ECal       *cal,
89                                    const gchar *uid);
90
91 icalcomponent *
92 ecal_test_utils_cal_get_default_object (ECal *cal);
93
94 GList *
95 ecal_test_utils_cal_get_object_list (ECal       *cal,
96                                      const gchar *query);
97
98 GList *
99 ecal_test_utils_cal_get_objects_for_uid (ECal       *cal,
100                                          const gchar *uid);
101
102 gchar *
103 ecal_test_utils_cal_create_object (ECal          *cal,
104                                    icalcomponent *component);
105
106 void
107 ecal_test_utils_cal_set_mode (ECal        *cal,
108                               CalMode      mode,
109                               GSourceFunc  callback,
110                               gpointer     user_data);
111
112 void
113 ecal_test_utils_create_component (ECal           *cal,
114                                   const gchar     *dtstart,
115                                   const gchar     *dtstart_tzid,
116                                   const gchar     *dtend,
117                                   const gchar     *dtend_tzid,
118                                   const gchar     *summary,
119                                   ECalComponent **comp_out,
120                                   gchar          **uid_out);
121
122 void
123 ecal_test_utils_cal_component_set_icalcomponent (ECalComponent *e_component,
124                                                  icalcomponent *component);
125
126 icaltimezone *
127 ecal_test_utils_cal_get_timezone (ECal       *cal,
128                                   const gchar *tzid);
129
130 void
131 ecal_test_utils_cal_add_timezone (ECal         *cal,
132                                   icaltimezone *zone);
133
134 void
135 ecal_test_utils_cal_set_default_timezone (ECal         *cal,
136                                           icaltimezone *zone);
137
138 void
139 ecal_test_utils_cal_send_objects (ECal           *cal,
140                                   icalcomponent  *component,
141                                   GList         **users,
142                                   icalcomponent **component_final);
143
144 void
145 ecal_test_utils_cal_receive_objects (ECal          *cal,
146                                      icalcomponent *component);
147
148 ECalView *
149 ecal_test_utils_get_query (ECal       *cal,
150                            const gchar *sexp);
151
152 #endif /* _ECAL_TEST_UTILS_H */