Update German translation
[glib.git] / gio / tests / mimeapps.c
blob8a9722fe54f8b76836cbd12eb2031e84dac29cad
1 #include <glib/gstdio.h>
2 #include <gio/gio.h>
3 #include <gio/gdesktopappinfo.h>
5 static gboolean
6 strv_equal (gchar **strv, ...)
8 gint count;
9 va_list list;
10 const gchar *str;
11 gboolean res;
13 res = TRUE;
14 count = 0;
15 va_start (list, strv);
16 while (1)
18 str = va_arg (list, const gchar *);
19 if (str == NULL)
20 break;
21 if (g_strcmp0 (str, strv[count]) != 0)
23 res = FALSE;
24 break;
26 count++;
28 va_end (list);
30 if (res)
31 res = g_strv_length (strv) == count;
33 return res;
36 const gchar *myapp_data =
37 "[Desktop Entry]\n"
38 "Encoding=UTF-8\n"
39 "Version=1.0\n"
40 "Type=Application\n"
41 "Exec=true %f\n"
42 "Name=my app\n";
44 const gchar *myapp2_data =
45 "[Desktop Entry]\n"
46 "Encoding=UTF-8\n"
47 "Version=1.0\n"
48 "Type=Application\n"
49 "Exec=sleep %f\n"
50 "Name=my app 2\n";
52 const gchar *myapp3_data =
53 "[Desktop Entry]\n"
54 "Encoding=UTF-8\n"
55 "Version=1.0\n"
56 "Type=Application\n"
57 "Exec=sleep 1\n"
58 "Name=my app 3\n"
59 "MimeType=image/png;";
61 const gchar *myapp4_data =
62 "[Desktop Entry]\n"
63 "Encoding=UTF-8\n"
64 "Version=1.0\n"
65 "Type=Application\n"
66 "Exec=echo %f\n"
67 "Name=my app 4\n"
68 "MimeType=image/bmp;";
70 const gchar *myapp5_data =
71 "[Desktop Entry]\n"
72 "Encoding=UTF-8\n"
73 "Version=1.0\n"
74 "Type=Application\n"
75 "Exec=true %f\n"
76 "Name=my app 5\n"
77 "MimeType=image/bmp;x-scheme-handler/ftp;";
79 const gchar *nosuchapp_data =
80 "[Desktop Entry]\n"
81 "Encoding=UTF-8\n"
82 "Version=1.0\n"
83 "Type=Application\n"
84 "Exec=no_such_application %f\n"
85 "Name=no such app\n";
87 const gchar *defaults_data =
88 "[Default Applications]\n"
89 "image/bmp=myapp4.desktop;\n"
90 "image/png=myapp3.desktop;\n"
91 "x-scheme-handler/ftp=myapp5.desktop;\n";
93 const gchar *mimecache_data =
94 "[MIME Cache]\n"
95 "image/bmp=myapp4.desktop;myapp5.desktop;\n"
96 "image/png=myapp3.desktop;\n";
98 /* Set up XDG_DATA_HOME and XDG_DATA_DIRS.
99 * XDG_DATA_DIRS/applications will contain mimeapps.list
100 * XDG_DATA_HOME/applications will contain myapp.desktop
101 * and myapp2.desktop, and no mimeapps.list
103 static void
104 setup (void)
106 gchar *dir;
107 gchar *xdgconfighome;
108 gchar *xdgdatahome;
109 gchar *xdgdatadir;
110 gchar *appdir;
111 gchar *apphome;
112 gchar *mimeapps;
113 gchar *name;
114 gboolean res;
115 GError *error = NULL;
117 dir = g_get_current_dir ();
118 xdgconfighome = g_build_filename (dir, "xdgconfighome", NULL);
119 xdgdatahome = g_build_filename (dir, "xdgdatahome", NULL);
120 xdgdatadir = g_build_filename (dir, "xdgdatadir", NULL);
121 g_test_message ("setting XDG_CONFIG_HOME to '%s'\n", xdgconfighome);
122 g_setenv ("XDG_CONFIG_HOME", xdgconfighome, TRUE);
123 g_test_message ("setting XDG_DATA_HOME to '%s'\n", xdgdatahome);
124 g_setenv ("XDG_DATA_HOME", xdgdatahome, TRUE);
125 g_test_message ("setting XDG_DATA_DIRS to '%s'\n", xdgdatadir);
126 g_setenv ("XDG_DATA_DIRS", xdgdatadir, TRUE);
128 appdir = g_build_filename (xdgdatadir, "applications", NULL);
129 g_test_message ("creating '%s'\n", appdir);
130 res = g_mkdir_with_parents (appdir, 0700);
131 g_assert (res == 0);
133 name = g_build_filename (appdir, "mimeapps.list", NULL);
134 g_test_message ("creating '%s'\n", name);
135 g_file_set_contents (name, defaults_data, -1, &error);
136 g_assert_no_error (error);
137 g_free (name);
139 apphome = g_build_filename (xdgdatahome, "applications", NULL);
140 g_test_message ("creating '%s'\n", apphome);
141 res = g_mkdir_with_parents (apphome, 0700);
142 g_assert (res == 0);
144 name = g_build_filename (apphome, "myapp.desktop", NULL);
145 g_test_message ("creating '%s'\n", name);
146 g_file_set_contents (name, myapp_data, -1, &error);
147 g_assert_no_error (error);
148 g_free (name);
150 name = g_build_filename (apphome, "myapp2.desktop", NULL);
151 g_test_message ("creating '%s'\n", name);
152 g_file_set_contents (name, myapp2_data, -1, &error);
153 g_assert_no_error (error);
154 g_free (name);
156 name = g_build_filename (apphome, "myapp3.desktop", NULL);
157 g_test_message ("creating '%s'\n", name);
158 g_file_set_contents (name, myapp3_data, -1, &error);
159 g_assert_no_error (error);
160 g_free (name);
162 name = g_build_filename (apphome, "myapp4.desktop", NULL);
163 g_test_message ("creating '%s'\n", name);
164 g_file_set_contents (name, myapp4_data, -1, &error);
165 g_assert_no_error (error);
166 g_free (name);
168 name = g_build_filename (apphome, "myapp5.desktop", NULL);
169 g_test_message ("creating '%s'\n", name);
170 g_file_set_contents (name, myapp5_data, -1, &error);
171 g_assert_no_error (error);
172 g_free (name);
174 name = g_build_filename (apphome, "nosuchapp.desktop", NULL);
175 g_test_message ("creating '%s'\n", name);
176 g_file_set_contents (name, nosuchapp_data, -1, &error);
177 g_assert_no_error (error);
178 g_free (name);
180 mimeapps = g_build_filename (apphome, "mimeapps.list", NULL);
181 g_test_message ("removing '%s'\n", mimeapps);
182 g_remove (mimeapps);
184 name = g_build_filename (apphome, "mimeinfo.cache", NULL);
185 g_test_message ("creating '%s'\n", name);
186 g_file_set_contents (name, mimecache_data, -1, &error);
187 g_assert_no_error (error);
188 g_free (name);
190 g_free (dir);
191 g_free (xdgconfighome);
192 g_free (xdgdatahome);
193 g_free (xdgdatadir);
194 g_free (apphome);
195 g_free (appdir);
196 g_free (mimeapps);
199 static void
200 test_mime_api (void)
202 GAppInfo *appinfo;
203 GAppInfo *appinfo2;
204 GError *error = NULL;
205 GAppInfo *def;
206 GList *list;
207 const gchar *contenttype = "application/pdf";
209 /* clear things out */
210 g_app_info_reset_type_associations (contenttype);
212 appinfo = (GAppInfo*)g_desktop_app_info_new ("myapp.desktop");
213 appinfo2 = (GAppInfo*)g_desktop_app_info_new ("myapp2.desktop");
215 def = g_app_info_get_default_for_type (contenttype, FALSE);
216 list = g_app_info_get_recommended_for_type (contenttype);
217 g_assert (def == NULL);
218 g_assert (list == NULL);
220 /* 1. add a non-default association */
221 g_app_info_add_supports_type (appinfo, contenttype, &error);
222 g_assert_no_error (error);
224 def = g_app_info_get_default_for_type (contenttype, FALSE);
225 list = g_app_info_get_recommended_for_type (contenttype);
226 g_assert (g_app_info_equal (def, appinfo));
227 g_assert_cmpint (g_list_length (list), ==, 1);
228 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo));
229 g_object_unref (def);
230 g_list_free_full (list, g_object_unref);
232 /* 2. add another non-default association */
233 g_app_info_add_supports_type (appinfo2, contenttype, &error);
234 g_assert_no_error (error);
236 def = g_app_info_get_default_for_type (contenttype, FALSE);
237 list = g_app_info_get_recommended_for_type (contenttype);
238 g_assert (g_app_info_equal (def, appinfo));
239 g_assert_cmpint (g_list_length (list), ==, 2);
240 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo));
241 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo2));
242 g_object_unref (def);
243 g_list_free_full (list, g_object_unref);
245 /* 3. make the first app the default */
246 g_app_info_set_as_default_for_type (appinfo, contenttype, &error);
247 g_assert_no_error (error);
249 def = g_app_info_get_default_for_type (contenttype, FALSE);
250 list = g_app_info_get_recommended_for_type (contenttype);
251 g_assert (g_app_info_equal (def, appinfo));
252 g_assert_cmpint (g_list_length (list), ==, 2);
253 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo));
254 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo2));
255 g_object_unref (def);
256 g_list_free_full (list, g_object_unref);
258 /* 4. make the second app the last used one */
259 g_app_info_set_as_last_used_for_type (appinfo2, contenttype, &error);
260 g_assert_no_error (error);
262 def = g_app_info_get_default_for_type (contenttype, FALSE);
263 list = g_app_info_get_recommended_for_type (contenttype);
264 g_assert (g_app_info_equal (def, appinfo));
265 g_assert_cmpint (g_list_length (list), ==, 2);
266 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo2));
267 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo));
268 g_object_unref (def);
269 g_list_free_full (list, g_object_unref);
271 /* 5. reset everything */
272 g_app_info_reset_type_associations (contenttype);
274 def = g_app_info_get_default_for_type (contenttype, FALSE);
275 list = g_app_info_get_recommended_for_type (contenttype);
276 g_assert (def == NULL);
277 g_assert (list == NULL);
279 g_object_unref (appinfo);
280 g_object_unref (appinfo2);
283 /* Repeat the same tests, this time checking that we handle
284 * mimeapps.list as expected. These tests are different from
285 * the ones in test_mime_api() in that we directly parse
286 * mimeapps.list to verify the results.
288 static void
289 test_mime_file (void)
291 gchar **assoc;
292 GAppInfo *appinfo;
293 GAppInfo *appinfo2;
294 GError *error = NULL;
295 GKeyFile *keyfile;
296 gchar *str;
297 gboolean res;
298 GAppInfo *def;
299 GList *list;
300 gchar *mimeapps;
301 gchar *dir;
302 const gchar *contenttype = "application/pdf";
304 dir = g_get_current_dir ();
305 mimeapps = g_build_filename (dir, "xdgconfighome", "mimeapps.list", NULL);
307 /* clear things out */
308 g_app_info_reset_type_associations (contenttype);
310 appinfo = (GAppInfo*)g_desktop_app_info_new ("myapp.desktop");
311 appinfo2 = (GAppInfo*)g_desktop_app_info_new ("myapp2.desktop");
313 def = g_app_info_get_default_for_type (contenttype, FALSE);
314 list = g_app_info_get_recommended_for_type (contenttype);
315 g_assert (def == NULL);
316 g_assert (list == NULL);
318 /* 1. add a non-default association */
319 g_app_info_add_supports_type (appinfo, contenttype, &error);
320 g_assert_no_error (error);
322 keyfile = g_key_file_new ();
323 g_key_file_load_from_file (keyfile, mimeapps, G_KEY_FILE_NONE, &error);
324 g_assert_no_error (error);
326 assoc = g_key_file_get_string_list (keyfile, "Added Associations", contenttype, NULL, &error);
327 g_assert_no_error (error);
328 g_assert (strv_equal (assoc, "myapp.desktop", NULL));
329 g_strfreev (assoc);
331 /* we've unset XDG_DATA_DIRS so there should be no default */
332 assoc = g_key_file_get_string_list (keyfile, "Default Applications", contenttype, NULL, &error);
333 g_assert (error != NULL);
334 g_clear_error (&error);
336 g_key_file_free (keyfile);
338 /* 2. add another non-default association */
339 g_app_info_add_supports_type (appinfo2, contenttype, &error);
340 g_assert_no_error (error);
342 keyfile = g_key_file_new ();
343 g_key_file_load_from_file (keyfile, mimeapps, G_KEY_FILE_NONE, &error);
344 g_assert_no_error (error);
346 assoc = g_key_file_get_string_list (keyfile, "Added Associations", contenttype, NULL, &error);
347 g_assert_no_error (error);
348 g_assert (strv_equal (assoc, "myapp.desktop", "myapp2.desktop", NULL));
349 g_strfreev (assoc);
351 assoc = g_key_file_get_string_list (keyfile, "Default Applications", contenttype, NULL, &error);
352 g_assert (error != NULL);
353 g_clear_error (&error);
355 g_key_file_free (keyfile);
357 /* 3. make the first app the default */
358 g_app_info_set_as_default_for_type (appinfo, contenttype, &error);
359 g_assert_no_error (error);
361 keyfile = g_key_file_new ();
362 g_key_file_load_from_file (keyfile, mimeapps, G_KEY_FILE_NONE, &error);
363 g_assert_no_error (error);
365 assoc = g_key_file_get_string_list (keyfile, "Added Associations", contenttype, NULL, &error);
366 g_assert_no_error (error);
367 g_assert (strv_equal (assoc, "myapp.desktop", "myapp2.desktop", NULL));
368 g_strfreev (assoc);
370 str = g_key_file_get_string (keyfile, "Default Applications", contenttype, &error);
371 g_assert_no_error (error);
372 g_assert_cmpstr (str, ==, "myapp.desktop");
373 g_free (str);
375 g_key_file_free (keyfile);
377 /* 4. make the second app the last used one */
378 g_app_info_set_as_last_used_for_type (appinfo2, contenttype, &error);
379 g_assert_no_error (error);
381 keyfile = g_key_file_new ();
382 g_key_file_load_from_file (keyfile, mimeapps, G_KEY_FILE_NONE, &error);
383 g_assert_no_error (error);
385 assoc = g_key_file_get_string_list (keyfile, "Added Associations", contenttype, NULL, &error);
386 g_assert_no_error (error);
387 g_assert (strv_equal (assoc, "myapp2.desktop", "myapp.desktop", NULL));
388 g_strfreev (assoc);
390 g_key_file_free (keyfile);
392 /* 5. reset everything */
393 g_app_info_reset_type_associations (contenttype);
395 keyfile = g_key_file_new ();
396 g_key_file_load_from_file (keyfile, mimeapps, G_KEY_FILE_NONE, &error);
397 g_assert_no_error (error);
399 res = g_key_file_has_key (keyfile, "Added Associations", contenttype, NULL);
400 g_assert (!res);
402 res = g_key_file_has_key (keyfile, "Default Applications", contenttype, NULL);
403 g_assert (!res);
405 g_key_file_free (keyfile);
407 g_object_unref (appinfo);
408 g_object_unref (appinfo2);
410 g_free (mimeapps);
411 g_free (dir);
414 /* test interaction between mimeapps.list at different levels */
415 static void
416 test_mime_default (void)
418 GAppInfo *appinfo;
419 GAppInfo *appinfo2;
420 GAppInfo *appinfo3;
421 GError *error = NULL;
422 GAppInfo *def;
423 GList *list;
424 const gchar *contenttype = "image/png";
426 /* clear things out */
427 g_app_info_reset_type_associations (contenttype);
429 appinfo = (GAppInfo*)g_desktop_app_info_new ("myapp.desktop");
430 appinfo2 = (GAppInfo*)g_desktop_app_info_new ("myapp2.desktop");
431 appinfo3 = (GAppInfo*)g_desktop_app_info_new ("myapp3.desktop");
433 /* myapp3 is set as the default in defaults.list */
434 def = g_app_info_get_default_for_type (contenttype, FALSE);
435 list = g_app_info_get_recommended_for_type (contenttype);
436 g_assert (g_app_info_equal (def, appinfo3));
437 g_assert_cmpint (g_list_length (list), ==, 1);
438 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo3));
439 g_object_unref (def);
440 g_list_free_full (list, g_object_unref);
442 /* 1. add a non-default association */
443 g_app_info_add_supports_type (appinfo, contenttype, &error);
444 g_assert_no_error (error);
446 def = g_app_info_get_default_for_type (contenttype, FALSE);
447 list = g_app_info_get_recommended_for_type (contenttype);
448 g_assert (g_app_info_equal (def, appinfo3)); /* default is unaffected */
449 g_assert_cmpint (g_list_length (list), ==, 2);
450 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo));
451 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo3));
452 g_object_unref (def);
453 g_list_free_full (list, g_object_unref);
455 /* 2. add another non-default association */
456 g_app_info_add_supports_type (appinfo2, contenttype, &error);
457 g_assert_no_error (error);
459 def = g_app_info_get_default_for_type (contenttype, FALSE);
460 list = g_app_info_get_recommended_for_type (contenttype);
461 g_assert (g_app_info_equal (def, appinfo3));
462 g_assert_cmpint (g_list_length (list), ==, 3);
463 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo));
464 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo2));
465 g_assert (g_app_info_equal ((GAppInfo*)list->next->next->data, appinfo3));
466 g_object_unref (def);
467 g_list_free_full (list, g_object_unref);
469 /* 3. make the first app the default */
470 g_app_info_set_as_default_for_type (appinfo, contenttype, &error);
471 g_assert_no_error (error);
473 def = g_app_info_get_default_for_type (contenttype, FALSE);
474 list = g_app_info_get_recommended_for_type (contenttype);
475 g_assert (g_app_info_equal (def, appinfo));
476 g_assert_cmpint (g_list_length (list), ==, 3);
477 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo));
478 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo2));
479 g_assert (g_app_info_equal ((GAppInfo*)list->next->next->data, appinfo3));
480 g_object_unref (def);
481 g_list_free_full (list, g_object_unref);
483 g_object_unref (appinfo);
484 g_object_unref (appinfo2);
485 g_object_unref (appinfo3);
488 /* test interaction between mimeinfo.cache, defaults.list and mimeapps.list
489 * to ensure g_app_info_set_as_last_used_for_type doesn't incorrectly
490 * change the default
492 static void
493 test_mime_default_last_used (void)
495 GAppInfo *appinfo4;
496 GAppInfo *appinfo5;
497 GError *error = NULL;
498 GAppInfo *def;
499 GList *list;
500 const gchar *contenttype = "image/bmp";
502 /* clear things out */
503 g_app_info_reset_type_associations (contenttype);
505 appinfo4 = (GAppInfo*)g_desktop_app_info_new ("myapp4.desktop");
506 appinfo5 = (GAppInfo*)g_desktop_app_info_new ("myapp5.desktop");
508 /* myapp4 is set as the default in defaults.list */
509 /* myapp4 and myapp5 can both handle image/bmp */
510 def = g_app_info_get_default_for_type (contenttype, FALSE);
511 list = g_app_info_get_recommended_for_type (contenttype);
512 g_assert (g_app_info_equal (def, appinfo4));
513 g_assert_cmpint (g_list_length (list), ==, 2);
514 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo4));
515 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo5));
516 g_object_unref (def);
517 g_list_free_full (list, g_object_unref);
519 /* 1. set default (myapp4) as last used */
520 g_app_info_set_as_last_used_for_type (appinfo4, contenttype, &error);
521 g_assert_no_error (error);
523 def = g_app_info_get_default_for_type (contenttype, FALSE);
524 list = g_app_info_get_recommended_for_type (contenttype);
525 g_assert (g_app_info_equal (def, appinfo4)); /* default is unaffected */
526 g_assert_cmpint (g_list_length (list), ==, 2);
527 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo4));
528 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo5));
529 g_object_unref (def);
530 g_list_free_full (list, g_object_unref);
532 /* 2. set other (myapp5) as last used */
533 g_app_info_set_as_last_used_for_type (appinfo5, contenttype, &error);
534 g_assert_no_error (error);
536 def = g_app_info_get_default_for_type (contenttype, FALSE);
537 list = g_app_info_get_recommended_for_type (contenttype);
538 g_assert (g_app_info_equal (def, appinfo4));
539 g_assert_cmpint (g_list_length (list), ==, 2);
540 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo5));
541 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo4));
542 g_object_unref (def);
543 g_list_free_full (list, g_object_unref);
545 /* 3. change the default to myapp5 */
546 g_app_info_set_as_default_for_type (appinfo5, contenttype, &error);
547 g_assert_no_error (error);
549 def = g_app_info_get_default_for_type (contenttype, FALSE);
550 list = g_app_info_get_recommended_for_type (contenttype);
551 g_assert (g_app_info_equal (def, appinfo5));
552 g_assert_cmpint (g_list_length (list), ==, 2);
553 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo5));
554 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo4));
555 g_object_unref (def);
556 g_list_free_full (list, g_object_unref);
558 /* 4. set myapp4 as last used */
559 g_app_info_set_as_last_used_for_type (appinfo4, contenttype, &error);
560 g_assert_no_error (error);
562 def = g_app_info_get_default_for_type (contenttype, FALSE);
563 list = g_app_info_get_recommended_for_type (contenttype);
564 g_assert (g_app_info_equal (def, appinfo5));
565 g_assert_cmpint (g_list_length (list), ==, 2);
566 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo4));
567 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo5));
568 g_object_unref (def);
569 g_list_free_full (list, g_object_unref);
571 /* 5. set myapp5 as last used again */
572 g_app_info_set_as_last_used_for_type (appinfo5, contenttype, &error);
573 g_assert_no_error (error);
575 def = g_app_info_get_default_for_type (contenttype, FALSE);
576 list = g_app_info_get_recommended_for_type (contenttype);
577 g_assert (g_app_info_equal (def, appinfo5));
578 g_assert_cmpint (g_list_length (list), ==, 2);
579 g_assert (g_app_info_equal ((GAppInfo*)list->data, appinfo5));
580 g_assert (g_app_info_equal ((GAppInfo*)list->next->data, appinfo4));
581 g_object_unref (def);
582 g_list_free_full (list, g_object_unref);
584 g_object_unref (appinfo4);
585 g_object_unref (appinfo5);
588 static void
589 test_scheme_handler (void)
591 GAppInfo *info, *info5;
593 info5 = (GAppInfo*)g_desktop_app_info_new ("myapp5.desktop");
594 info = g_app_info_get_default_for_uri_scheme ("ftp");
595 g_assert (g_app_info_equal (info, info5));
597 g_object_unref (info);
598 g_object_unref (info5);
601 /* test that g_app_info_* ignores desktop files with nonexisting executables
603 static void
604 test_mime_ignore_nonexisting (void)
606 GAppInfo *appinfo;
608 appinfo = (GAppInfo*)g_desktop_app_info_new ("nosuchapp.desktop");
609 g_assert (appinfo == NULL);
612 static void
613 test_all (void)
615 GList *all, *l;
617 all = g_app_info_get_all ();
619 for (l = all; l; l = l->next)
620 g_assert (G_IS_APP_INFO (l->data));
622 g_list_free_full (all, g_object_unref);
626 main (int argc, char *argv[])
628 g_test_init (&argc, &argv, NULL);
630 setup ();
632 g_test_add_func ("/appinfo/mime/api", test_mime_api);
633 g_test_add_func ("/appinfo/mime/default", test_mime_default);
634 g_test_add_func ("/appinfo/mime/file", test_mime_file);
635 g_test_add_func ("/appinfo/mime/scheme-handler", test_scheme_handler);
636 g_test_add_func ("/appinfo/mime/default-last-used", test_mime_default_last_used);
637 g_test_add_func ("/appinfo/mime/ignore-nonexisting", test_mime_ignore_nonexisting);
638 g_test_add_func ("/appinfo/all", test_all);
640 return g_test_run ();