2 * Copyright (C) 2008 Red Hat, Inc
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General
15 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 * Author: Matthias Clasen
22 #include <glib/glib.h>
23 #include <glib/gstdio.h>
25 #include <gio/gdesktopappinfo.h>
31 create_app_info (const char *name)
37 info = g_app_info_create_from_commandline ("true blah",
39 G_APP_INFO_CREATE_NONE,
41 g_assert_no_error (error);
43 /* this is necessary to ensure that the info is saved */
44 g_app_info_set_as_default_for_type (info, "application/x-blah", &error);
45 g_assert_no_error (error);
46 g_app_info_remove_supports_type (info, "application/x-blah", &error);
47 g_assert_no_error (error);
48 g_app_info_reset_type_associations ("application/x-blah");
62 info = create_app_info ("Blah");
64 id = g_app_info_get_id (info);
65 g_assert_nonnull (id);
67 filename = g_build_filename (g_get_user_data_dir (), "applications", id, NULL);
69 res = g_file_test (filename, G_FILE_TEST_EXISTS);
72 res = g_app_info_can_delete (info);
75 res = g_app_info_delete (info);
78 res = g_file_test (filename, G_FILE_TEST_EXISTS);
81 g_object_unref (info);
83 if (g_file_test ("/usr/share/applications/gedit.desktop", G_FILE_TEST_EXISTS))
85 info = (GAppInfo*)g_desktop_app_info_new_from_filename ("/usr/share/applications/gedit.desktop");
86 g_assert_nonnull (info);
88 res = g_app_info_can_delete (info);
91 res = g_app_info_delete (info);
101 GAppInfo *info, *info1, *info2, *info3;
103 GError *error = NULL;
105 info1 = create_app_info ("Blah1");
106 info2 = create_app_info ("Blah2");
107 info3 = create_app_info ("Blah3");
109 g_app_info_set_as_default_for_type (info1, "application/x-test", &error);
110 g_assert_no_error (error);
112 g_app_info_set_as_default_for_type (info2, "application/x-test", &error);
113 g_assert_no_error (error);
115 info = g_app_info_get_default_for_type ("application/x-test", FALSE);
116 g_assert_nonnull (info);
117 g_assert_cmpstr (g_app_info_get_id (info), ==, g_app_info_get_id (info2));
118 g_object_unref (info);
120 /* now try adding something, but not setting as default */
121 g_app_info_add_supports_type (info3, "application/x-test", &error);
122 g_assert_no_error (error);
124 /* check that info2 is still default */
125 info = g_app_info_get_default_for_type ("application/x-test", FALSE);
126 g_assert_nonnull (info);
127 g_assert_cmpstr (g_app_info_get_id (info), ==, g_app_info_get_id (info2));
128 g_object_unref (info);
130 /* now remove info1 again */
131 g_app_info_remove_supports_type (info1, "application/x-test", &error);
132 g_assert_no_error (error);
134 /* and make sure info2 is still default */
135 info = g_app_info_get_default_for_type ("application/x-test", FALSE);
136 g_assert_nonnull (info);
137 g_assert_cmpstr (g_app_info_get_id (info), ==, g_app_info_get_id (info2));
138 g_object_unref (info);
140 /* now clean it all up */
141 g_app_info_reset_type_associations ("application/x-test");
143 list = g_app_info_get_all_for_type ("application/x-test");
144 g_assert_null (list);
146 g_app_info_delete (info1);
147 g_app_info_delete (info2);
148 g_app_info_delete (info3);
150 g_object_unref (info1);
151 g_object_unref (info2);
152 g_object_unref (info3);
158 GAppInfo *info1, *info2, *app = NULL;
159 GList *apps, *recomm, *fallback, *list, *l, *m;
160 GError *error = NULL;
163 info1 = create_app_info ("Test1");
164 info2 = create_app_info ("Test2");
166 g_assert_true (g_content_type_is_a ("text/x-python", "text/plain"));
168 apps = g_app_info_get_all_for_type ("text/x-python");
169 old_length = g_list_length (apps);
170 g_list_free_full (apps, g_object_unref);
172 g_app_info_add_supports_type (info1, "text/x-python", &error);
173 g_assert_no_error (error);
175 g_app_info_add_supports_type (info2, "text/plain", &error);
176 g_assert_no_error (error);
178 /* check that both apps are registered */
179 apps = g_app_info_get_all_for_type ("text/x-python");
180 g_assert_cmpint (g_list_length (apps), ==, old_length + 2);
182 /* check that Test1 is among the recommended apps */
183 recomm = g_app_info_get_recommended_for_type ("text/x-python");
184 g_assert_nonnull (recomm);
185 for (l = recomm; l; l = l->next)
188 if (g_app_info_equal (info1, app))
191 g_assert_nonnull (app);
192 g_assert_true (g_app_info_equal (info1, app));
194 /* and that Test2 is among the fallback apps */
195 fallback = g_app_info_get_fallback_for_type ("text/x-python");
196 g_assert_nonnull (fallback);
197 for (l = fallback; l; l = l->next)
200 if (g_app_info_equal (info2, app))
203 g_assert_cmpstr (g_app_info_get_name (app), ==, "Test2");
205 /* check that recomm + fallback = all applications */
206 list = g_list_concat (g_list_copy (recomm), g_list_copy (fallback));
207 g_assert_cmpuint (g_list_length (list), ==, g_list_length (apps));
209 for (l = list, m = apps; l != NULL && m != NULL; l = l->next, m = m->next)
211 g_assert_true (g_app_info_equal (l->data, m->data));
216 g_list_free_full (apps, g_object_unref);
217 g_list_free_full (recomm, g_object_unref);
218 g_list_free_full (fallback, g_object_unref);
220 g_app_info_reset_type_associations ("text/x-python");
221 g_app_info_reset_type_associations ("text/plain");
223 g_app_info_delete (info1);
224 g_app_info_delete (info2);
226 g_object_unref (info1);
227 g_object_unref (info2);
231 test_last_used (void)
234 GAppInfo *info1, *info2, *default_app;
235 GError *error = NULL;
237 info1 = create_app_info ("Test1");
238 info2 = create_app_info ("Test2");
240 g_app_info_set_as_default_for_type (info1, "application/x-test", &error);
241 g_assert_no_error (error);
243 g_app_info_add_supports_type (info2, "application/x-test", &error);
244 g_assert_no_error (error);
246 applications = g_app_info_get_recommended_for_type ("application/x-test");
247 g_assert_cmpuint (g_list_length (applications), ==, 2);
249 /* the first should be the default app now */
250 g_assert_true (g_app_info_equal (g_list_nth_data (applications, 0), info1));
251 g_assert_true (g_app_info_equal (g_list_nth_data (applications, 1), info2));
253 g_list_free_full (applications, g_object_unref);
255 g_app_info_set_as_last_used_for_type (info2, "application/x-test", &error);
256 g_assert_no_error (error);
258 applications = g_app_info_get_recommended_for_type ("application/x-test");
259 g_assert_cmpuint (g_list_length (applications), ==, 2);
261 default_app = g_app_info_get_default_for_type ("application/x-test", FALSE);
262 g_assert_true (g_app_info_equal (default_app, info1));
264 /* the first should be the other app now */
265 g_assert_true (g_app_info_equal (g_list_nth_data (applications, 0), info2));
266 g_assert_true (g_app_info_equal (g_list_nth_data (applications, 1), info1));
268 g_list_free_full (applications, g_object_unref);
270 g_app_info_reset_type_associations ("application/x-test");
272 g_app_info_delete (info1);
273 g_app_info_delete (info2);
275 g_object_unref (info1);
276 g_object_unref (info2);
277 g_object_unref (default_app);
281 test_extra_getters (void)
283 GDesktopAppInfo *appinfo;
288 lang = setlocale (LC_ALL, NULL);
289 g_setenv ("LANGUAGE", "de_DE.UTF8", TRUE);
290 setlocale (LC_ALL, "");
292 appinfo = g_desktop_app_info_new_from_filename (g_test_get_filename (G_TEST_DIST, "appinfo-test-static.desktop", NULL));
293 g_assert_nonnull (appinfo);
295 g_assert_true (g_desktop_app_info_has_key (appinfo, "Terminal"));
296 g_assert_false (g_desktop_app_info_has_key (appinfo, "Bratwurst"));
298 s = g_desktop_app_info_get_string (appinfo, "StartupWMClass");
299 g_assert_cmpstr (s, ==, "appinfo-class");
302 s = g_desktop_app_info_get_locale_string (appinfo, "X-JunkFood");
303 g_assert_cmpstr (s, ==, "Bratwurst");
306 g_setenv ("LANGUAGE", "sv_SE.UTF8", TRUE);
307 setlocale (LC_ALL, "");
309 s = g_desktop_app_info_get_locale_string (appinfo, "X-JunkFood");
310 g_assert_cmpstr (s, ==, "Burger"); /* fallback */
313 b = g_desktop_app_info_get_boolean (appinfo, "Terminal");
316 g_object_unref (appinfo);
318 g_setenv ("LANGUAGE", lang, TRUE);
319 setlocale (LC_ALL, "");
323 wait_for_file (const gchar *want_this,
324 const gchar *but_not_this,
325 const gchar *or_this)
329 /* I hate time-based conditions in tests, but this will wait up to one
330 * whole minute for "touch file" to finish running. I think it should
333 * 600 * 100ms = 60 seconds.
335 while (access (want_this, F_OK) != 0)
337 g_usleep (100000); /* 100ms */
338 g_assert_cmpuint (retries, >, 0);
342 g_assert_cmpuint (access (but_not_this, F_OK), !=, 0);
343 g_assert_cmpuint (access (or_this, F_OK), !=, 0);
346 unlink (but_not_this);
353 const char *expected[] = { "frob", "tweak", "twiddle", "broken", NULL };
354 const gchar * const *actions;
355 GDesktopAppInfo *appinfo;
358 appinfo = g_desktop_app_info_new_from_filename (g_test_get_filename (G_TEST_DIST, "appinfo-test-actions.desktop", NULL));
359 g_assert_nonnull (appinfo);
361 actions = g_desktop_app_info_list_actions (appinfo);
362 g_assert_cmpstrv (actions, expected);
364 name = g_desktop_app_info_get_action_name (appinfo, "frob");
365 g_assert_cmpstr (name, ==, "Frobnicate");
368 name = g_desktop_app_info_get_action_name (appinfo, "tweak");
369 g_assert_cmpstr (name, ==, "Tweak");
372 name = g_desktop_app_info_get_action_name (appinfo, "twiddle");
373 g_assert_cmpstr (name, ==, "Twiddle");
376 name = g_desktop_app_info_get_action_name (appinfo, "broken");
377 g_assert_nonnull (name);
378 g_assert_true (g_utf8_validate (name, -1, NULL));
381 unlink ("frob"); unlink ("tweak"); unlink ("twiddle");
383 g_desktop_app_info_launch_action (appinfo, "frob", NULL);
384 wait_for_file ("frob", "tweak", "twiddle");
386 g_desktop_app_info_launch_action (appinfo, "tweak", NULL);
387 wait_for_file ("tweak", "frob", "twiddle");
389 g_desktop_app_info_launch_action (appinfo, "twiddle", NULL);
390 wait_for_file ("twiddle", "frob", "tweak");
392 g_object_unref (appinfo);
396 run_apps (const gchar *command,
400 const gchar *locale_name,
401 const gchar *language,
402 const gchar *xdg_current_desktop)
409 gchar *argv_str = NULL;
411 argv = g_new (gchar *, 4);
412 argv[0] = g_test_build_filename (G_TEST_BUILT, "apps", NULL);
413 argv[1] = g_strdup (command);
414 argv[2] = g_strdup (arg);
417 envp = g_get_environ ();
421 gchar *tmp = g_test_build_filename (G_TEST_DIST, "desktop-files", "usr", NULL);
422 envp = g_environ_setenv (envp, "XDG_DATA_DIRS", tmp, TRUE);
426 envp = g_environ_setenv (envp, "XDG_DATA_DIRS", "/does-not-exist", TRUE);
430 gchar *tmp = g_test_build_filename (G_TEST_DIST, "desktop-files", "home", NULL);
431 envp = g_environ_setenv (envp, "XDG_DATA_HOME", tmp, TRUE);
435 envp = g_environ_setenv (envp, "XDG_DATA_HOME", "/does-not-exist", TRUE);
438 envp = g_environ_setenv (envp, "LC_ALL", locale_name, TRUE);
440 envp = g_environ_setenv (envp, "LC_ALL", "C", TRUE);
443 envp = g_environ_setenv (envp, "LANGUAGE", language, TRUE);
445 envp = g_environ_unsetenv (envp, "LANGUAGE");
447 if (xdg_current_desktop)
448 envp = g_environ_setenv (envp, "XDG_CURRENT_DESKTOP", xdg_current_desktop, TRUE);
450 envp = g_environ_unsetenv (envp, "XDG_CURRENT_DESKTOP");
452 envp = g_environ_setenv (envp, "G_MESSAGES_DEBUG", "", TRUE);
454 success = g_spawn_sync (NULL, argv, envp, 0, NULL, NULL, &out, NULL, &status, NULL);
455 g_assert_true (success);
456 g_assert_cmpuint (status, ==, 0);
458 argv_str = g_strjoinv (" ", argv);
459 g_test_message ("%s: `%s` returned: %s", G_STRFUNC, argv_str, out);
469 assert_strings_equivalent (const gchar *expected,
472 gchar **expected_words;
473 gchar **result_words;
476 expected_words = g_strsplit (expected, " ", 0);
477 result_words = g_strsplit_set (result, " \n", 0);
479 for (i = 0; expected_words[i]; i++)
481 for (j = 0; result_words[j]; j++)
482 if (g_str_equal (expected_words[i], result_words[j]))
485 g_test_message ("Unable to find expected string '%s' in result '%s'", expected_words[i], result);
492 g_assert_cmpint (g_strv_length (expected_words), ==, g_strv_length (result_words));
493 g_strfreev (expected_words);
494 g_strfreev (result_words);
498 assert_list (const gchar *expected,
501 const gchar *locale_name,
502 const gchar *language)
506 result = run_apps ("list", NULL, with_usr, with_home, locale_name, language, NULL);
508 assert_strings_equivalent (expected, result);
513 assert_info (const gchar *desktop_id,
514 const gchar *expected,
517 const gchar *locale_name,
518 const gchar *language)
522 result = run_apps ("show-info", desktop_id, with_usr, with_home, locale_name, language, NULL);
523 g_assert_cmpstr (result, ==, expected);
528 assert_search (const gchar *search_string,
529 const gchar *expected,
532 const gchar *locale_name,
533 const gchar *language)
535 gchar **expected_lines;
536 gchar **result_lines;
540 expected_lines = g_strsplit (expected, "\n", -1);
541 result = run_apps ("search", search_string, with_usr, with_home, locale_name, language, NULL);
542 result_lines = g_strsplit (result, "\n", -1);
543 g_assert_cmpint (g_strv_length (expected_lines), ==, g_strv_length (result_lines));
544 for (i = 0; expected_lines[i]; i++)
545 assert_strings_equivalent (expected_lines[i], result_lines[i]);
546 g_strfreev (expected_lines);
547 g_strfreev (result_lines);
552 assert_implementations (const gchar *interface,
553 const gchar *expected,
559 result = run_apps ("implementations", interface, with_usr, with_home, NULL, NULL, NULL);
561 assert_strings_equivalent (expected, result);
565 #define ALL_USR_APPS "evince-previewer.desktop nautilus-classic.desktop gnome-font-viewer.desktop " \
566 "baobab.desktop yelp.desktop eog.desktop cheese.desktop org.gnome.clocks.desktop " \
567 "gnome-contacts.desktop kde4-kate.desktop gcr-prompter.desktop totem.desktop " \
568 "gnome-terminal.desktop nautilus-autorun-software.desktop gcr-viewer.desktop " \
569 "nautilus-connect-server.desktop kde4-dolphin.desktop gnome-music.desktop " \
570 "kde4-konqbrowser.desktop gucharmap.desktop kde4-okular.desktop nautilus.desktop " \
571 "gedit.desktop evince.desktop file-roller.desktop dconf-editor.desktop glade.desktop " \
572 "invalid-desktop.desktop"
573 #define HOME_APPS "epiphany-weather-for-toronto-island-9c6a4e022b17686306243dada811d550d25eb1fb.desktop"
574 #define ALL_HOME_APPS HOME_APPS " eog.desktop"
579 assert_list ("", FALSE, FALSE, NULL, NULL);
580 assert_list (ALL_USR_APPS, TRUE, FALSE, NULL, NULL);
581 assert_list (ALL_HOME_APPS, FALSE, TRUE, NULL, NULL);
582 assert_list (ALL_USR_APPS " " HOME_APPS, TRUE, TRUE, NULL, NULL);
584 /* The user has "installed" their own version of eog.desktop which
585 * calls it "Eye of GNOME". Do some testing based on that.
587 * We should always find "Pictures" keyword no matter where we look.
589 assert_search ("Picture", "eog.desktop\n", TRUE, TRUE, NULL, NULL);
590 assert_search ("Picture", "eog.desktop\n", TRUE, FALSE, NULL, NULL);
591 assert_search ("Picture", "eog.desktop\n", FALSE, TRUE, NULL, NULL);
592 assert_search ("Picture", "", FALSE, FALSE, NULL, NULL);
594 /* We should only find it called "eye of gnome" when using the user's
597 assert_search ("eye gnome", "", TRUE, FALSE, NULL, NULL);
598 assert_search ("eye gnome", "eog.desktop\n", FALSE, TRUE, NULL, NULL);
599 assert_search ("eye gnome", "eog.desktop\n", TRUE, TRUE, NULL, NULL);
601 /* We should only find it called "image viewer" when _not_ using the
604 assert_search ("image viewer", "eog.desktop\n", TRUE, FALSE, NULL, NULL);
605 assert_search ("image viewer", "", FALSE, TRUE, NULL, NULL);
606 assert_search ("image viewer", "", TRUE, TRUE, NULL, NULL);
608 /* There're "flatpak" apps (clocks) installed as well - they should *not*
609 * match the prefix command ("/bin/sh") in the Exec= line though.
611 assert_search ("sh", "gnome-terminal.desktop\n", TRUE, FALSE, NULL, NULL);
613 /* "frobnicator.desktop" is ignored by get_all() because the binary is
614 * missing, but search should still find it (to avoid either stale results
615 * from the cache or expensive stat() calls for each potential result)
617 assert_search ("frobni", "frobnicator.desktop\n", TRUE, FALSE, NULL, NULL);
619 /* Obvious multi-word search */
620 assert_search ("gno hel", "yelp.desktop\n", TRUE, TRUE, NULL, NULL);
622 /* Repeated search terms should do nothing... */
623 assert_search ("files file fil fi f", "nautilus.desktop\n"
624 "gedit.desktop\n", TRUE, TRUE, NULL, NULL);
626 /* "con" will match "connect" and "contacts" on name but dconf only on
627 * the "config" keyword
629 assert_search ("con", "nautilus-connect-server.desktop gnome-contacts.desktop\n"
630 "dconf-editor.desktop\n", TRUE, TRUE, NULL, NULL);
632 /* "gnome" will match "eye of gnome" from the user's directory, plus
633 * matching "GNOME Clocks" X-GNOME-FullName. It's only a comment on
634 * yelp and gnome-contacts, though.
636 assert_search ("gnome", "eog.desktop\n"
637 "org.gnome.clocks.desktop\n"
638 "yelp.desktop gnome-contacts.desktop\n", TRUE, TRUE, NULL, NULL);
640 /* eog has exec name 'false' in usr only */
641 assert_search ("false", "eog.desktop\n", TRUE, FALSE, NULL, NULL);
642 assert_search ("false", "", FALSE, TRUE, NULL, NULL);
643 assert_search ("false", "", TRUE, TRUE, NULL, NULL);
644 assert_search ("false", "", FALSE, FALSE, NULL, NULL);
646 /* make sure we only search the first component */
647 assert_search ("nonsearchable", "", TRUE, FALSE, NULL, NULL);
649 /* "gnome con" will match only gnome contacts; via the name for
650 * "contacts" and the comment for "gnome"
652 assert_search ("gnome con", "gnome-contacts.desktop\n", TRUE, TRUE, NULL, NULL);
654 /* make sure we get the correct kde4- prefix on the application IDs
655 * from subdirectories
657 assert_search ("konq", "kde4-konqbrowser.desktop\n", TRUE, TRUE, NULL, NULL);
658 assert_search ("kate", "kde4-kate.desktop\n", TRUE, TRUE, NULL, NULL);
660 /* make sure we can look up apps by name properly */
661 assert_info ("kde4-kate.desktop",
662 "kde4-kate.desktop\n"
665 "nil\n", TRUE, TRUE, NULL, NULL);
667 assert_info ("nautilus.desktop",
671 "Access and organize files\n", TRUE, TRUE, NULL, NULL);
673 /* make sure localised searching works properly */
674 assert_search ("foliumi", "nautilus.desktop\n"
675 "kde4-konqbrowser.desktop\n"
676 "eog.desktop\n", TRUE, FALSE, "en_US.UTF-8", "eo");
677 /* the user's eog.desktop has no translations... */
678 assert_search ("foliumi", "nautilus.desktop\n"
679 "kde4-konqbrowser.desktop\n", TRUE, TRUE, "en_US.UTF-8", "eo");
683 test_implements (void)
685 /* Make sure we can find our search providers... */
686 assert_implementations ("org.gnome.Shell.SearchProvider2",
687 "gnome-music.desktop gnome-contacts.desktop eog.desktop",
690 /* And our image acquisition possibilities... */
691 assert_implementations ("org.freedesktop.ImageProvider",
695 /* Make sure the user's eog is properly masking the system one */
696 assert_implementations ("org.gnome.Shell.SearchProvider2",
697 "gnome-music.desktop gnome-contacts.desktop",
700 /* Make sure we get nothing if we have nothing */
701 assert_implementations ("org.gnome.Shell.SearchProvider2", "", FALSE, FALSE);
705 assert_shown (const gchar *desktop_id,
707 const gchar *xdg_current_desktop)
711 result = run_apps ("should-show", desktop_id, TRUE, TRUE, NULL, NULL, xdg_current_desktop);
712 g_assert_cmpstr (result, ==, expected ? "true\n" : "false\n");
719 assert_shown ("gcr-prompter.desktop", FALSE, NULL);
720 assert_shown ("gcr-prompter.desktop", FALSE, "GNOME");
721 assert_shown ("gcr-prompter.desktop", FALSE, "KDE");
722 assert_shown ("gcr-prompter.desktop", FALSE, "GNOME:GNOME-Classic");
723 assert_shown ("gcr-prompter.desktop", TRUE, "GNOME-Classic:GNOME");
724 assert_shown ("gcr-prompter.desktop", TRUE, "GNOME-Classic");
725 assert_shown ("gcr-prompter.desktop", TRUE, "GNOME-Classic:KDE");
726 assert_shown ("gcr-prompter.desktop", TRUE, "KDE:GNOME-Classic");
727 assert_shown ("invalid-desktop.desktop", TRUE, "GNOME");
728 assert_shown ("invalid-desktop.desktop", FALSE, "../invalid/desktop");
729 assert_shown ("invalid-desktop.desktop", FALSE, "../invalid/desktop:../invalid/desktop");
732 /* Test g_desktop_app_info_launch_uris_as_manager() and
733 * g_desktop_app_info_launch_uris_as_manager_with_fds()
736 test_launch_as_manager (void)
738 GDesktopAppInfo *appinfo;
739 GError *error = NULL;
743 if (g_getenv ("DISPLAY") == NULL || g_getenv ("DISPLAY")[0] == '\0')
745 g_test_skip ("No DISPLAY. Skipping test.");
749 path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL);
750 appinfo = g_desktop_app_info_new_from_filename (path);
754 g_test_skip ("appinfo-test binary not installed");
758 retval = g_desktop_app_info_launch_uris_as_manager (appinfo, NULL, NULL, 0,
762 g_assert_no_error (error);
763 g_assert_true (retval);
765 retval = g_desktop_app_info_launch_uris_as_manager_with_fds (appinfo,
771 g_assert_no_error (error);
772 g_assert_true (retval);
774 g_object_unref (appinfo);
781 /* While we use %G_TEST_OPTION_ISOLATE_DIRS to create temporary directories
782 * for each of the tests, we want to use the system MIME registry, assuming
783 * that it exists and correctly has shared-mime-info installed. */
784 g_content_type_set_mime_dirs (NULL);
786 g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
788 g_test_add_func ("/desktop-app-info/delete", test_delete);
789 g_test_add_func ("/desktop-app-info/default", test_default);
790 g_test_add_func ("/desktop-app-info/fallback", test_fallback);
791 g_test_add_func ("/desktop-app-info/lastused", test_last_used);
792 g_test_add_func ("/desktop-app-info/extra-getters", test_extra_getters);
793 g_test_add_func ("/desktop-app-info/actions", test_actions);
794 g_test_add_func ("/desktop-app-info/search", test_search);
795 g_test_add_func ("/desktop-app-info/implements", test_implements);
796 g_test_add_func ("/desktop-app-info/show-in", test_show_in);
797 g_test_add_func ("/desktop-app-info/launch-as-manager", test_launch_as_manager);
799 return g_test_run ();