mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
tests: Use static appinfo .desktop file when not launching
The appinfo-test.desktop file is set up with an Exec= path which points to the compiled and installed appinfo-test utility. When running the tests uninstalled, however, this might not be present, which causes loading appinfo-test.desktop to fail. Split appinfo-test.desktop in two: keep the existing appinfo-test.desktop for tests which need to launch appinfo-test, and add a new appinfo-test-static.desktop for tests which don’t launch anything (and, for example, just inspect GAppInfo properties). appinfo-test-static.desktop uses an Exec= line which should always be present (`true`) so it should never fail to load. Allow the tests using appinfo-test-static.desktop to be run uninstalled or installed. Allow the tests using appinfo-test.desktop to be skipped if loading appinfo-test.desktop fails, which is an indicator that the test is running uninstalled. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
@@ -288,7 +288,7 @@ test_extra_getters (void)
|
||||
g_setenv ("LANGUAGE", "de_DE.UTF8", TRUE);
|
||||
setlocale (LC_ALL, "");
|
||||
|
||||
appinfo = g_desktop_app_info_new_from_filename (g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL));
|
||||
appinfo = g_desktop_app_info_new_from_filename (g_test_get_filename (G_TEST_DIST, "appinfo-test-static.desktop", NULL));
|
||||
g_assert_nonnull (appinfo);
|
||||
|
||||
g_assert_true (g_desktop_app_info_has_key (appinfo, "Terminal"));
|
||||
@@ -739,7 +739,12 @@ test_launch_as_manager (void)
|
||||
|
||||
path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL);
|
||||
appinfo = g_desktop_app_info_new_from_filename (path);
|
||||
g_assert_nonnull (appinfo);
|
||||
|
||||
if (appinfo == NULL)
|
||||
{
|
||||
g_test_skip ("appinfo-test binary not installed");
|
||||
return;
|
||||
}
|
||||
|
||||
retval = g_desktop_app_info_launch_uris_as_manager (appinfo, NULL, NULL, 0,
|
||||
NULL, NULL,
|
||||
|
Reference in New Issue
Block a user