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