diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am index a08159065..87e8dae7c 100644 --- a/gio/tests/Makefile.am +++ b/gio/tests/Makefile.am @@ -339,6 +339,7 @@ dist_test_data += \ dist_test_data += \ appinfo-test-actions.desktop \ + appinfo-test-static.desktop \ file.c \ org.gtk.test.dbusappinfo.desktop \ x-content/image-dcf/DCIM/Camera/20130831_203925.jpg \ diff --git a/gio/tests/appinfo-test-static.desktop b/gio/tests/appinfo-test-static.desktop new file mode 100644 index 000000000..f8a09f642 --- /dev/null +++ b/gio/tests/appinfo-test-static.desktop @@ -0,0 +1,19 @@ +[Desktop Entry] +Type=Application +GenericName=generic-appinfo-test +Name=appinfo-test +Name[de]=appinfo-test-de +X-GNOME-FullName=example +X-GNOME-FullName[de]=Beispiel +Comment=GAppInfo example +Comment[de]=GAppInfo Beispiel +Exec=true --option %U %i --name %c --filename %k %m %% +Icon=testicon.svg +Terminal=true +StartupNotify=true +StartupWMClass=appinfo-class +MimeType=image/png;image/jpeg; +Keywords=keyword1;test keyword; +Categories=GNOME;GTK; +X-JunkFood=Burger +X-JunkFood[de]=Bratwurst \ No newline at end of file diff --git a/gio/tests/appinfo.c b/gio/tests/appinfo.c index d21e5fef0..f13698d70 100644 --- a/gio/tests/appinfo.c +++ b/gio/tests/appinfo.c @@ -62,7 +62,12 @@ test_launch (void) path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); - g_assert_nonnull (appinfo); + + if (appinfo == NULL) + { + g_test_skip ("appinfo-test binary not installed"); + return; + } test_launch_for_app_info (appinfo); g_object_unref (appinfo); @@ -146,7 +151,7 @@ test_locale (const char *locale) g_setenv ("LANGUAGE", locale, TRUE); setlocale (LC_ALL, ""); - path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL); + path = g_test_get_filename (G_TEST_DIST, "appinfo-test-static.desktop", NULL); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); if (g_strcmp0 (locale, "C") == 0) @@ -192,12 +197,12 @@ test_basic (void) GIcon *icon, *icon2; const gchar *path; - path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL); + path = g_test_get_filename (G_TEST_DIST, "appinfo-test-static.desktop", NULL); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); g_assert_nonnull (appinfo); - g_assert_cmpstr (g_app_info_get_id (appinfo), ==, "appinfo-test.desktop"); - g_assert_nonnull (strstr (g_app_info_get_executable (appinfo), "appinfo-test")); + g_assert_cmpstr (g_app_info_get_id (appinfo), ==, "appinfo-test-static.desktop"); + g_assert_nonnull (strstr (g_app_info_get_executable (appinfo), "true")); icon = g_app_info_get_icon (appinfo); g_assert_true (G_IS_THEMED_ICON (icon)); @@ -221,6 +226,13 @@ test_show_in (void) path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL); appinfo = (GAppInfo*)g_desktop_app_info_new_from_filename (path); + + if (appinfo == NULL) + { + g_test_skip ("appinfo-test binary not installed"); + return; + } + g_assert_true (g_app_info_should_show (appinfo)); g_object_unref (appinfo); @@ -491,7 +503,7 @@ test_startup_wm_class (void) const char *wm_class; const gchar *path; - path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL); + path = g_test_get_filename (G_TEST_DIST, "appinfo-test-static.desktop", NULL); appinfo = g_desktop_app_info_new_from_filename (path); wm_class = g_desktop_app_info_get_startup_wm_class (appinfo); @@ -507,7 +519,7 @@ test_supported_types (void) const char * const *content_types; const gchar *path; - path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL); + path = g_test_get_filename (G_TEST_DIST, "appinfo-test-static.desktop", NULL); appinfo = G_APP_INFO (g_desktop_app_info_new_from_filename (path)); content_types = g_app_info_get_supported_types (appinfo); @@ -531,7 +543,7 @@ test_from_keyfile (void) const gchar *name; const gchar *path; - path = g_test_get_filename (G_TEST_BUILT, "appinfo-test.desktop", NULL); + path = g_test_get_filename (G_TEST_DIST, "appinfo-test-static.desktop", NULL); kf = g_key_file_new (); g_key_file_load_from_file (kf, path, G_KEY_FILE_NONE, &error); g_assert_no_error (error); diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c index bca902d32..10ba85338 100644 --- a/gio/tests/desktop-app-info.c +++ b/gio/tests/desktop-app-info.c @@ -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, diff --git a/gio/tests/meson.build b/gio/tests/meson.build index a07ddf807..c39d89803 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -424,6 +424,7 @@ if installed_tests_enabled 'contexts.c', 'g-icon.c', 'appinfo-test-actions.desktop', + 'appinfo-test-static.desktop', 'file.c', 'org.gtk.test.dbusappinfo.desktop', install_dir : installed_tests_execdir,