mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
macos: Add test case for invalid scheme
You may not always know which schemes are available. The library should not bail out, but only show an informal message. It's the responsibility of the application to deal with invalid URI schemes.
This commit is contained in:
parent
fac8a8c8d8
commit
1053c016d9
@ -800,7 +800,7 @@ g_app_info_get_default_for_uri_scheme_impl (const char *uri_scheme)
|
|||||||
|
|
||||||
if (!bundle_id)
|
if (!bundle_id)
|
||||||
{
|
{
|
||||||
g_warning ("No default handler found for url scheme '%s'.", uri_scheme);
|
g_info ("No default handler found for url scheme '%s'.", uri_scheme);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,13 +62,23 @@ test_launch_async (void)
|
|||||||
g_clear_object (&app_info);
|
g_clear_object (&app_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_invalid_uri_scheme (void)
|
||||||
|
{
|
||||||
|
GAppInfo *app_info;
|
||||||
|
|
||||||
|
app_info = g_app_info_get_default_for_uri_scheme("thisisnotanurlscheme");
|
||||||
|
g_assert_null (app_info);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);
|
g_test_init (&argc, &argv, NULL, NULL);
|
||||||
|
|
||||||
g_test_add_func ("/osx-app-info/launch-async", test_launch_async);
|
g_test_add_func ("/osx-app-info/launch-async", test_launch_async);
|
||||||
|
g_test_add_func ("/osx-app-info/invalid-uri-scheme", test_invalid_uri_scheme);
|
||||||
|
|
||||||
return g_test_run ();
|
return g_test_run ();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user