Update gupnp-av to 0.12.2 (1a991fe)
[profile/ivi/GUPnP-AV.git] / tests / gtest / test-media-collection.c
1 /*
2  * Copyright (C) 2012 Intel Corporation.
3  *
4  * Author: Jens Georg <jensg@openismus.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #include <string.h>
23
24 #include <libgupnp-av/gupnp-media-collection.h>
25
26 /* Flat DIDL_S playlist */
27 #define TEST_PARSE_COLLECTION_1 \
28 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
29 "<DIDL-Lite" \
30 "    xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" \
31 "    xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"" \
32 "    xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\"" \
33 "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" \
34 "    xsi:schemaLocation=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" \
35 "        http://www.upnp.org/schemas/av/didl-lite-v2-20060531.xsd" \
36 "      urn:schemas-upnp-org:metadata-1-0/upnp/" \
37 "        http://www.upnp.org/schemas/av/upnp-v2-20060531.xsd\">" \
38 "    <item id=\"\" parentID=\"0\" restricted=\"0\">" \
39 "        <dc:title>Song1</dc:title>" \
40 "        <upnp:class>object.item.audioItem</upnp:class>" \
41 "        <res protocolInfo=\"*:*:*:*\" />" \
42 "        <upnp:artist></upnp:artist>" \
43 "    </item>" \
44 "    <item id=\"\" parentID=\"0\" restricted=\"0\">" \
45 "        <dc:title>Song2</dc:title>" \
46 "        <upnp:class>object.item.audioItem</upnp:class>" \
47 "        <res protocolInfo=\"*:*:*:*\" />" \
48 "    </item>" \
49 "    <item id=\"\" parentID=\"0\" restricted=\"0\">" \
50 "        <dc:title>Song3</dc:title>" \
51 "        <upnp:class>object.item.audioItem</upnp:class>" \
52 "        <res protocolInfo=\"*:*:*:*\" />" \
53 "    </item>" \
54 "</DIDL-Lite>"
55
56 /* Nested DIDL_S playlist */
57 #define TEST_PARSE_COLLECTION_2 \
58 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
59 "<DIDL-Lite" \
60 "    xmlns:dc=\"http://purl.org/dc/elements/1.1/\"" \
61 "    xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\"" \
62 "    xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\"" \
63 "    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" \
64 "    xsi:schemaLocation=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" \
65 "        http://www.upnp.org/schemas/av/didl-lite-v2-20060531.xsd" \
66 "      urn:schemas-upnp-org:metadata-1-0/upnp/" \
67 "        http://www.upnp.org/schemas/av/upnp-v2-20060531.xsd\">" \
68 "    <container id=\"1\" parentID=\"0\" restricted=\"0\">" \
69 "        <dc:title>NonFlatCollection</dc:title>" \
70 "        <dc:creator>NonFlatCollection Author</dc:creator>" \
71 "        <item id=\"\" parentID=\"1\" restricted=\"0\">" \
72 "            <dc:title>Song1</dc:title>" \
73 "            <upnp:class>object.item.audioItem</upnp:class>" \
74 "            <res protocolInfo=\"*:*:*:*\" />" \
75 "            <upnp:artist></upnp:artist>" \
76 "        </item>" \
77 "        <item id=\"\" parentID=\"1\" restricted=\"0\">" \
78 "            <dc:title>Song2</dc:title>" \
79 "            <upnp:class>object.item.audioItem</upnp:class>" \
80 "            <res protocolInfo=\"*:*:*:*\" />" \
81 "        </item>" \
82 "        <item id=\"\" parentID=\"1\" restricted=\"0\">" \
83 "            <dc:title>Song3</dc:title>" \
84 "            <upnp:class>object.item.audioItem</upnp:class>" \
85 "        <res protocolInfo=\"*:*:*:*\" />" \
86 "    </item>" \
87 "    </container>" \
88 "</DIDL-Lite>"
89
90 #define TEST_CREATE_FLAT \
91 "<DIDL-Lite " \
92         "xmlns:dc=\"http://purl.org/dc/elements/1.1/\" " \
93         "xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" " \
94         "xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\" " \
95         "xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\">" \
96     "<item restricted=\"1\">" \
97       "<dc:title>Song1</dc:title>" \
98       "<upnp:class>object.item.audioItem</upnp:class>" \
99       "<res>http://example.com/song1.mp3</res>" \
100     "</item>" \
101     "<item restricted=\"1\">" \
102       "<dc:title>Song2</dc:title>" \
103       "<upnp:class>object.item.audioItem</upnp:class>" \
104       "<res>http://example.com/song2.mp3</res>" \
105     "</item>" \
106     "<item restricted=\"1\">" \
107       "<dc:title>Song3</dc:title>" \
108       "<upnp:class>object.item.audioItem</upnp:class>" \
109       "<res>http://example.com/song3.mp3</res>" \
110     "</item>" \
111 "</DIDL-Lite>"
112
113 #define TEST_CREATE_FULL \
114 "<DIDL-Lite " \
115         "xmlns:dc=\"http://purl.org/dc/elements/1.1/\" " \
116         "xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" " \
117         "xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\" " \
118         "xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\">" \
119     "<container>" \
120       "<dc:title>TestCollection1</dc:title>" \
121       "<dc:creator>TestCollection1Author</dc:creator>" \
122       "<item restricted=\"1\">" \
123         "<dc:title>Song1</dc:title>" \
124         "<upnp:class>object.item.audioItem</upnp:class>" \
125         "<res>http://example.com/song1.mp3</res>" \
126       "</item>" \
127       "<item restricted=\"1\">" \
128         "<dc:title>Song2</dc:title>" \
129         "<upnp:class>object.item.audioItem</upnp:class>" \
130         "<res>http://example.com/song2.mp3</res>" \
131       "</item>" \
132       "<item restricted=\"1\">" \
133         "<dc:title>Song3</dc:title>" \
134         "<upnp:class>object.item.audioItem</upnp:class>" \
135         "<res>http://example.com/song3.mp3</res>" \
136       "</item>" \
137     "</container>" \
138 "</DIDL-Lite>"
139
140 #define TEST_CREATE_FULL_REPARENT \
141 "<DIDL-Lite " \
142         "xmlns:dc=\"http://purl.org/dc/elements/1.1/\" " \
143         "xmlns:upnp=\"urn:schemas-upnp-org:metadata-1-0/upnp/\" " \
144         "xmlns:dlna=\"urn:schemas-dlna-org:metadata-1-0/\" " \
145         "xmlns=\"urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/\">" \
146     "<container>" \
147       "<item restricted=\"1\">" \
148         "<dc:title>Song1</dc:title>" \
149         "<upnp:class>object.item.audioItem</upnp:class>" \
150         "<res>http://example.com/song1.mp3</res>" \
151       "</item>" \
152       "<item restricted=\"1\">" \
153         "<dc:title>Song2</dc:title>" \
154         "<upnp:class>object.item.audioItem</upnp:class>" \
155         "<res>http://example.com/song2.mp3</res>" \
156       "</item>" \
157       "<item restricted=\"1\">" \
158         "<dc:title>Song3</dc:title>" \
159         "<upnp:class>object.item.audioItem</upnp:class>" \
160         "<res>http://example.com/song3.mp3</res>" \
161       "</item>" \
162       "<dc:title>TestCollection1</dc:title>" \
163       "<dc:creator>TestCollection1Author</dc:creator>" \
164     "</container>" \
165 "</DIDL-Lite>"
166
167 #define TEST_PARSE_NO_XML "This is just some random text"
168
169 void
170 test_didl_collection_construction ()
171 {
172         GUPnPMediaCollection *collection;
173
174         /* Check that a collection created via auxillary function is mutable */
175         collection = gupnp_media_collection_new ();
176         g_assert (gupnp_media_collection_get_mutable (collection));
177         g_object_unref (collection);
178
179         /* Check that a collection created via auxillary parse function is
180          * not mutable */
181         collection = gupnp_media_collection_new_from_string
182                                         (TEST_PARSE_COLLECTION_1);
183         g_assert (!gupnp_media_collection_get_mutable (collection));
184         g_object_unref (collection);
185
186         /* Check that creating a collection via g_object_new and title/author
187          * properties set is mutable */
188         collection = g_object_new (GUPNP_TYPE_MEDIA_COLLECTION,
189                                    "title", "test01collection",
190                                    "author", "test01author",
191                                    NULL);
192         g_assert (gupnp_media_collection_get_mutable (collection));
193         g_object_unref (collection);
194
195         /* Check that creating a collection via g_object_new and data is not
196          * mutable */
197         collection = g_object_new (GUPNP_TYPE_MEDIA_COLLECTION,
198                                    "data", TEST_PARSE_COLLECTION_1,
199                                    NULL);
200         g_assert (!gupnp_media_collection_get_mutable (collection));
201         g_object_unref (collection);
202
203         /* Check that creating a collection with all properties set will result
204          * in a collection that ignored "title" and "author" properties.
205          */
206         collection = g_object_new (GUPNP_TYPE_MEDIA_COLLECTION,
207                                    "title", "test01collection",
208                                    "author", "test01author",
209                                    "data", TEST_PARSE_COLLECTION_1,
210                                    NULL);
211         g_assert (!gupnp_media_collection_get_mutable (collection));
212         g_assert_cmpstr (gupnp_media_collection_get_author (collection), ==,
213                          NULL);
214         g_assert_cmpstr (gupnp_media_collection_get_title (collection), ==,
215                          NULL);
216         g_assert_cmpstr (gupnp_media_collection_get_string (collection), ==,
217                          TEST_PARSE_COLLECTION_1);
218         g_object_unref (collection);
219 }
220
221 void
222 test_didl_collection_parse_flat ()
223 {
224         GUPnPMediaCollection *collection;
225         GList *items, *it;
226
227         collection = gupnp_media_collection_new_from_string
228                                         (TEST_PARSE_COLLECTION_1);
229         g_assert_cmpstr (gupnp_media_collection_get_author (collection), ==,
230                          NULL);
231         g_assert_cmpstr (gupnp_media_collection_get_title (collection), ==,
232                          NULL);
233         g_assert_cmpstr (gupnp_media_collection_get_string (collection), ==,
234                          TEST_PARSE_COLLECTION_1);
235
236         it = items = gupnp_media_collection_get_items (collection);
237         g_assert_cmpint (g_list_length (items), ==, 3);
238         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
239                          "Song1");
240         it = it->next;
241         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
242                          "Song2");
243         it = it->next;
244         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
245                          "Song3");
246         g_list_free_full (items, (GDestroyNotify) g_object_unref);
247 }
248
249 void
250 test_didl_collection_parse_full ()
251 {
252         GUPnPMediaCollection *collection;
253         GList *items, *it;
254
255         collection = gupnp_media_collection_new_from_string
256                                         (TEST_PARSE_COLLECTION_2);
257         g_assert_cmpstr (gupnp_media_collection_get_author (collection), ==,
258                          "NonFlatCollection Author");
259         g_assert_cmpstr (gupnp_media_collection_get_title (collection), ==,
260                          "NonFlatCollection");
261         g_assert_cmpstr (gupnp_media_collection_get_string (collection), ==,
262                          TEST_PARSE_COLLECTION_2);
263
264         it = items = gupnp_media_collection_get_items (collection);
265         g_assert_cmpint (g_list_length (items), ==, 3);
266         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
267                          "Song1");
268         it = it->next;
269         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
270                          "Song2");
271         it = it->next;
272         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
273                          "Song3");
274         g_list_free_full (items, (GDestroyNotify) g_object_unref);
275 }
276
277 #define ERROR_MESSAGE "Failed to parse DIDL-Lite: No 'DIDL-Lite' node in the DIDL-Lite XML:"
278
279 static gboolean
280 ignore_xml_parse_error (G_GNUC_UNUSED const gchar   *log_domain,
281                         G_GNUC_UNUSED GLogLevelFlags log_level,
282                         const gchar                 *message,
283                         G_GNUC_UNUSED gpointer       user_data)
284 {
285         if (strncmp (message,
286                      ERROR_MESSAGE,
287                      g_utf8_strlen (ERROR_MESSAGE, -1) - 1) == 0) {
288                 return FALSE;
289         }
290
291         return TRUE;
292 }
293
294 void
295 test_didl_collection_parse_invalid ()
296 {
297         GUPnPMediaCollection *collection;
298         GList *items;
299
300         g_test_log_set_fatal_handler (ignore_xml_parse_error, NULL);
301         collection = gupnp_media_collection_new_from_string (TEST_PARSE_NO_XML);
302         items = gupnp_media_collection_get_items (collection);
303
304         g_assert (items == NULL);
305         g_object_unref (collection);
306 }
307
308 void
309 test_didl_collection_create_flat ()
310 {
311         GUPnPMediaCollection *collection;
312         GUPnPDIDLLiteItem *item;
313         GList *items, *it;
314         GUPnPDIDLLiteResource *res;
315
316         collection = gupnp_media_collection_new ();
317         item = gupnp_media_collection_add_item (collection);
318         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
319                                           "Song1");
320         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
321                                                "object.item.audioItem");
322         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
323         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song1.mp3");
324         g_object_unref (res);
325         g_object_unref (item);
326         item = gupnp_media_collection_add_item (collection);
327         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
328                                           "Song2");
329         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
330                                                "object.item.audioItem");
331         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
332         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song2.mp3");
333         g_object_unref (res);
334         g_object_unref (item);
335         item = gupnp_media_collection_add_item (collection);
336         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
337                                           "Song3");
338         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
339                                                "object.item.audioItem");
340         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
341         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song3.mp3");
342         g_object_unref (res);
343         g_object_unref (item);
344         it = items = gupnp_media_collection_get_items (collection);
345         g_assert_cmpint (g_list_length (items), ==, 3);
346         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
347                          "Song1");
348         it = it->next;
349         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
350                          "Song2");
351         it = it->next;
352         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
353                          "Song3");
354         g_list_free_full (items, (GDestroyNotify) g_object_unref);
355         g_assert_cmpstr (gupnp_media_collection_get_string (collection), ==,
356                          TEST_CREATE_FLAT);
357 }
358
359 void
360 test_didl_collection_create_full ()
361 {
362         GUPnPMediaCollection *collection;
363         GUPnPDIDLLiteItem *item;
364         GList *items, *it;
365         GUPnPDIDLLiteResource *res;
366
367         collection = gupnp_media_collection_new ();
368         gupnp_media_collection_set_title (collection, "TestCollection1");
369         gupnp_media_collection_set_author (collection, "TestCollection1Author");
370
371         item = gupnp_media_collection_add_item (collection);
372         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
373                                           "Song1");
374         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
375                                                "object.item.audioItem");
376         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
377         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song1.mp3");
378         g_object_unref (res);
379         g_object_unref (item);
380         item = gupnp_media_collection_add_item (collection);
381         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
382                                           "Song2");
383         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
384                                                "object.item.audioItem");
385         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
386         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song2.mp3");
387         g_object_unref (res);
388         g_object_unref (item);
389         item = gupnp_media_collection_add_item (collection);
390         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
391                                           "Song3");
392         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
393                                                "object.item.audioItem");
394         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
395         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song3.mp3");
396         g_object_unref (res);
397         g_object_unref (item);
398         it = items = gupnp_media_collection_get_items (collection);
399         g_assert_cmpint (g_list_length (items), ==, 3);
400         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
401                          "Song1");
402         it = it->next;
403         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
404                          "Song2");
405         it = it->next;
406         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
407                          "Song3");
408         g_list_free_full (items, (GDestroyNotify) g_object_unref);
409         g_assert_cmpstr (gupnp_media_collection_get_string (collection), ==,
410                          TEST_CREATE_FULL);
411 }
412
413 void
414 test_didl_collection_create_reparent ()
415 {
416         GUPnPMediaCollection *collection;
417         GUPnPDIDLLiteItem *item;
418         GList *items, *it;
419         GUPnPDIDLLiteResource *res;
420
421         collection = gupnp_media_collection_new ();
422
423         item = gupnp_media_collection_add_item (collection);
424         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
425                                           "Song1");
426         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
427                                                "object.item.audioItem");
428         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
429         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song1.mp3");
430         g_object_unref (res);
431         g_object_unref (item);
432         item = gupnp_media_collection_add_item (collection);
433         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
434                                           "Song2");
435         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
436                                                "object.item.audioItem");
437         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
438         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song2.mp3");
439         g_object_unref (res);
440         g_object_unref (item);
441         item = gupnp_media_collection_add_item (collection);
442         gupnp_didl_lite_object_set_title (GUPNP_DIDL_LITE_OBJECT (item),
443                                           "Song3");
444         gupnp_didl_lite_object_set_upnp_class (GUPNP_DIDL_LITE_OBJECT (item),
445                                                "object.item.audioItem");
446         res = gupnp_didl_lite_object_add_resource (GUPNP_DIDL_LITE_OBJECT (item));
447         gupnp_didl_lite_resource_set_uri (res, "http://example.com/song3.mp3");
448         g_object_unref (res);
449         g_object_unref (item);
450         it = items = gupnp_media_collection_get_items (collection);
451
452         /* Force reparenting of the items in the XML */
453         gupnp_media_collection_set_title (collection, "TestCollection1");
454         gupnp_media_collection_set_author (collection, "TestCollection1Author");
455
456         g_assert_cmpint (g_list_length (items), ==, 3);
457         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
458                          "Song1");
459         it = it->next;
460         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
461                          "Song2");
462         it = it->next;
463         g_assert_cmpstr (gupnp_didl_lite_object_get_title (GUPNP_DIDL_LITE_OBJECT (it->data)), ==,
464                          "Song3");
465         g_list_free_full (items, (GDestroyNotify) g_object_unref);
466
467         g_assert_cmpstr (gupnp_media_collection_get_string (collection), ==,
468                          TEST_CREATE_FULL_REPARENT);
469 }
470
471 int main (int argc, char *argv[])
472 {
473 #if !GLIB_CHECK_VERSION (2, 35, 0)
474         g_type_init ();
475 #endif
476         g_test_init (&argc, &argv, NULL);
477
478         g_test_add_func ("/didl/collection/construction",
479                          test_didl_collection_construction);
480         g_test_add_func ("/didl/collection/parse_flat",
481                          test_didl_collection_parse_flat);
482         g_test_add_func ("/didl/collection/parse_full",
483                          test_didl_collection_parse_full);
484         g_test_add_func ("/didl/collection/parse_invalid",
485                          test_didl_collection_parse_invalid);
486
487         g_test_add_func ("/didl/collection/create_flat",
488                          test_didl_collection_create_flat);
489         g_test_add_func ("/didl/collection/create_full",
490                          test_didl_collection_create_full);
491         g_test_add_func ("/didl/collection/create_reparent",
492                          test_didl_collection_create_reparent);
493
494         return g_test_run ();
495 }