1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2009 Intel Corporation
4  *
5  * This library is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
12  * for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library. If not, see <http://www.gnu.org/licenses/>.
16  *
17  * Authors: Travis Reitter (travis.reitter@collabora.co.uk)
18  */
19 
20 #ifndef _EBOOK_TEST_UTILS_H
21 #define _EBOOK_TEST_UTILS_H
22 
23 #include <libebook/libebook.h>
24 
25 typedef struct {
26         GSourceFunc  cb;
27         gpointer     user_data;
28 	EBookView   *view;
29 	EList       *list;
30 } EBookTestClosure;
31 
32 void
33 test_print (const gchar *format,
34 	    ...);
35 void
36 ebook_test_utils_read_args (gint argc,
37 			    gchar **argv);
38 
39 gboolean
40 ebook_test_utils_callback_quit (gpointer user_data);
41 
42 gchar *
43 ebook_test_utils_new_vcard_from_test_case (const gchar *case_name);
44 
45 gchar *
46 ebook_test_utils_book_add_contact_from_test_case_verify (EBook       *book,
47                                                          const gchar  *case_name,
48 							 EContact   **contact);
49 
50 gboolean
51 ebook_test_utils_contacts_are_equal_shallow (EContact *a,
52                                              EContact *b);
53 
54 const gchar *
55 ebook_test_utils_book_add_contact (EBook    *book,
56                                    EContact *contact);
57 void
58 ebook_test_utils_book_async_add_contact (EBook       *book,
59                                          EContact    *contact,
60                                          GSourceFunc  callback,
61                                          gpointer     user_data);
62 
63 void
64 ebook_test_utils_book_commit_contact (EBook    *book,
65                                       EContact *contact);
66 void
67 ebook_test_utils_book_async_commit_contact (EBook       *book,
68                                             EContact    *contact,
69                                             GSourceFunc  callback,
70                                             gpointer     user_data);
71 
72 EContact *
73 ebook_test_utils_book_get_contact (EBook      *book,
74                                    const gchar *uid);
75 void
76 ebook_test_utils_book_async_get_contact (EBook       *book,
77                                          const gchar  *uid,
78                                          GSourceFunc  callback,
79                                          gpointer     user_data);
80 
81 GList *
82 ebook_test_utils_book_get_required_fields (EBook *book);
83 void
84 ebook_test_utils_book_async_get_required_fields (EBook       *book,
85                                                  GSourceFunc  callback,
86                                                  gpointer     user_data);
87 
88 GList *
89 ebook_test_utils_book_get_supported_fields (EBook *book);
90 void
91 ebook_test_utils_book_async_get_supported_fields (EBook       *book,
92 						  GSourceFunc  callback,
93                                                   gpointer     user_data);
94 
95 GList *
96 ebook_test_utils_book_get_supported_auth_methods (EBook *book);
97 void
98 ebook_test_utils_book_async_get_supported_auth_methods (EBook       *book,
99 							GSourceFunc  callback,
100 							gpointer     user_data);
101 
102 const gchar *
103 ebook_test_utils_book_get_static_capabilities (EBook *book);
104 
105 void
106 ebook_test_utils_book_remove_contact (EBook      *book,
107                                       const gchar *uid);
108 void
109 ebook_test_utils_book_async_remove_contact (EBook       *book,
110 					    EContact    *contact,
111 					    GSourceFunc  callback,
112 					    gpointer     user_data);
113 void
114 ebook_test_utils_book_async_remove_contact_by_id (EBook       *book,
115                                                   const gchar  *uid,
116                                                   GSourceFunc  callback,
117                                                   gpointer     user_data);
118 
119 void
120 ebook_test_utils_book_remove_contacts (EBook *book,
121                                        GList *ids);
122 void
123 ebook_test_utils_book_async_remove_contacts (EBook       *book,
124                                              GList       *uids,
125                                              GSourceFunc  callback,
126                                              gpointer     user_data);
127 
128 void
129 ebook_test_utils_book_get_book_view (EBook       *book,
130                                      EBookQuery  *query,
131                                      EBookView  **view);
132 void
133 ebook_test_utils_book_async_get_book_view (EBook       *book,
134                                            EBookQuery  *query,
135                                            GSourceFunc  callback,
136                                            gpointer     user_data);
137 
138 #endif /* _EBOOK_TEST_UTILS_H */
139