mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 02:36:19 +01:00
Merge branch 'bootstrap-tests' into 'main'
tests: skip tests that will fail due to missing dependencies Closes #3317 See merge request GNOME/glib!3997
This commit is contained in:
commit
15202c970a
@ -49,6 +49,19 @@ test_launch_for_app_info (GAppInfo *appinfo)
|
|||||||
g_free (uri);
|
g_free (uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
skip_missing_dbus_daemon (void)
|
||||||
|
{
|
||||||
|
gchar *path = g_find_program_in_path ("dbus-daemon");
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
g_test_skip ("dbus-daemon is required to run this test");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
g_free (path);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_launch (void)
|
test_launch (void)
|
||||||
{
|
{
|
||||||
@ -56,6 +69,9 @@ test_launch (void)
|
|||||||
GAppInfo *appinfo;
|
GAppInfo *appinfo;
|
||||||
const gchar *path;
|
const gchar *path;
|
||||||
|
|
||||||
|
if (skip_missing_dbus_daemon ())
|
||||||
|
return;
|
||||||
|
|
||||||
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
||||||
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
||||||
g_test_dbus_up (bus);
|
g_test_dbus_up (bus);
|
||||||
@ -96,6 +112,9 @@ test_launch_no_app_id (void)
|
|||||||
gchar *exec_line_variants[2];
|
gchar *exec_line_variants[2];
|
||||||
gsize i;
|
gsize i;
|
||||||
|
|
||||||
|
if (skip_missing_dbus_daemon ())
|
||||||
|
return;
|
||||||
|
|
||||||
exec_line_variants[0] = g_strdup_printf (
|
exec_line_variants[0] = g_strdup_printf (
|
||||||
"Exec=%s/appinfo-test --option %%U %%i --name %%c --filename %%k %%m %%%%",
|
"Exec=%s/appinfo-test --option %%U %%i --name %%c --filename %%k %%m %%%%",
|
||||||
g_test_get_dir (G_TEST_BUILT));
|
g_test_get_dir (G_TEST_BUILT));
|
||||||
@ -356,6 +375,9 @@ test_launch_context_signals (void)
|
|||||||
gboolean success;
|
gboolean success;
|
||||||
gchar *cmdline;
|
gchar *cmdline;
|
||||||
|
|
||||||
|
if (skip_missing_dbus_daemon ())
|
||||||
|
return;
|
||||||
|
|
||||||
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
||||||
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
||||||
g_test_dbus_up (bus);
|
g_test_dbus_up (bus);
|
||||||
|
@ -13,6 +13,20 @@
|
|||||||
__s1, " == ", __s2); \
|
__s1, " == ", __s2); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
skip_missing_shared_mime_info (void)
|
||||||
|
{
|
||||||
|
gchar *path = g_find_program_in_path ("update-mime-database");
|
||||||
|
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
g_test_skip ("shared-mime-info is required to run this test");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
g_free (path);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_guess (void)
|
test_guess (void)
|
||||||
{
|
{
|
||||||
@ -26,6 +40,9 @@ test_guess (void)
|
|||||||
"Name=appinfo-test\n"
|
"Name=appinfo-test\n"
|
||||||
"Exec=./appinfo-test --option\n";
|
"Exec=./appinfo-test --option\n";
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
existing_directory = (gchar *) g_getenv ("SYSTEMROOT");
|
existing_directory = (gchar *) g_getenv ("SYSTEMROOT");
|
||||||
|
|
||||||
@ -150,6 +167,9 @@ test_subtype (void)
|
|||||||
gchar *plain;
|
gchar *plain;
|
||||||
gchar *xml;
|
gchar *xml;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
plain = g_content_type_from_mime_type ("text/plain");
|
plain = g_content_type_from_mime_type ("text/plain");
|
||||||
xml = g_content_type_from_mime_type ("application/xml");
|
xml = g_content_type_from_mime_type ("application/xml");
|
||||||
|
|
||||||
@ -175,6 +195,9 @@ test_list (void)
|
|||||||
gchar *plain;
|
gchar *plain;
|
||||||
gchar *xml;
|
gchar *xml;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
g_test_skip ("The OSX backend does not implement g_content_types_get_registered()");
|
g_test_skip ("The OSX backend does not implement g_content_types_get_registered()");
|
||||||
return;
|
return;
|
||||||
@ -202,6 +225,9 @@ test_executable (void)
|
|||||||
{
|
{
|
||||||
gchar *type;
|
gchar *type;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
type = g_content_type_from_mime_type ("application/vnd.microsoft.portable-executable");
|
type = g_content_type_from_mime_type ("application/vnd.microsoft.portable-executable");
|
||||||
/* FIXME: the MIME is not in the default `MIME\Database\Content Type` registry.
|
/* FIXME: the MIME is not in the default `MIME\Database\Content Type` registry.
|
||||||
@ -228,6 +254,9 @@ test_description (void)
|
|||||||
gchar *type;
|
gchar *type;
|
||||||
gchar *desc;
|
gchar *desc;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
type = g_content_type_from_mime_type ("text/plain");
|
type = g_content_type_from_mime_type ("text/plain");
|
||||||
desc = g_content_type_get_description (type);
|
desc = g_content_type_get_description (type);
|
||||||
g_assert_nonnull (desc);
|
g_assert_nonnull (desc);
|
||||||
@ -242,6 +271,9 @@ test_icon (void)
|
|||||||
gchar *type;
|
gchar *type;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
type = g_content_type_from_mime_type ("text/plain");
|
type = g_content_type_from_mime_type ("text/plain");
|
||||||
icon = g_content_type_get_icon (type);
|
icon = g_content_type_get_icon (type);
|
||||||
g_assert_true (G_IS_ICON (icon));
|
g_assert_true (G_IS_ICON (icon));
|
||||||
@ -290,6 +322,9 @@ test_symbolic_icon (void)
|
|||||||
gchar *type;
|
gchar *type;
|
||||||
GIcon *icon;
|
GIcon *icon;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
type = g_content_type_from_mime_type ("text/plain");
|
type = g_content_type_from_mime_type ("text/plain");
|
||||||
icon = g_content_type_get_symbolic_icon (type);
|
icon = g_content_type_get_symbolic_icon (type);
|
||||||
g_assert_true (G_IS_ICON (icon));
|
g_assert_true (G_IS_ICON (icon));
|
||||||
@ -344,6 +379,9 @@ test_tree (void)
|
|||||||
gchar **types;
|
gchar **types;
|
||||||
gsize i;
|
gsize i;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
#if defined(__APPLE__) || defined(G_OS_WIN32)
|
#if defined(__APPLE__) || defined(G_OS_WIN32)
|
||||||
g_test_skip ("The OSX & Windows backends do not implement g_content_type_guess_for_tree()");
|
g_test_skip ("The OSX & Windows backends do not implement g_content_type_guess_for_tree()");
|
||||||
return;
|
return;
|
||||||
@ -437,7 +475,12 @@ test_guess_svg_from_data (void)
|
|||||||
</svg>\n";
|
</svg>\n";
|
||||||
|
|
||||||
gboolean uncertain = TRUE;
|
gboolean uncertain = TRUE;
|
||||||
gchar *res = g_content_type_guess (NULL, (guchar *)svgfilecontent,
|
gchar *res;
|
||||||
|
|
||||||
|
if (skip_missing_shared_mime_info ())
|
||||||
|
return;
|
||||||
|
|
||||||
|
res = g_content_type_guess (NULL, (guchar *)svgfilecontent,
|
||||||
sizeof (svgfilecontent) - 1, &uncertain);
|
sizeof (svgfilecontent) - 1, &uncertain);
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
g_assert_cmpstr (res, ==, "public.svg-image");
|
g_assert_cmpstr (res, ==, "public.svg-image");
|
||||||
|
@ -125,6 +125,20 @@ create_app_info (const char *name)
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
skip_missing_update_desktop_database (void)
|
||||||
|
{
|
||||||
|
gchar *path = g_find_program_in_path ("update-desktop-database");
|
||||||
|
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
g_test_skip ("update-desktop-database is required to run this test");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
g_free (path);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_delete (void)
|
test_delete (void)
|
||||||
{
|
{
|
||||||
@ -134,6 +148,9 @@ test_delete (void)
|
|||||||
char *filename;
|
char *filename;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
|
||||||
|
if (skip_missing_update_desktop_database ())
|
||||||
|
return;
|
||||||
|
|
||||||
info = create_app_info ("Blah");
|
info = create_app_info ("Blah");
|
||||||
|
|
||||||
id = g_app_info_get_id (info);
|
id = g_app_info_get_id (info);
|
||||||
@ -177,6 +194,9 @@ test_default (void)
|
|||||||
GList *list;
|
GList *list;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (skip_missing_update_desktop_database ())
|
||||||
|
return;
|
||||||
|
|
||||||
info1 = create_app_info ("Blah1");
|
info1 = create_app_info ("Blah1");
|
||||||
info2 = create_app_info ("Blah2");
|
info2 = create_app_info ("Blah2");
|
||||||
info3 = create_app_info ("Blah3");
|
info3 = create_app_info ("Blah3");
|
||||||
@ -316,6 +336,9 @@ test_default_async (void)
|
|||||||
GList *list;
|
GList *list;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (skip_missing_update_desktop_database ())
|
||||||
|
return;
|
||||||
|
|
||||||
data.loop = g_main_loop_new (NULL, TRUE);
|
data.loop = g_main_loop_new (NULL, TRUE);
|
||||||
|
|
||||||
info1 = create_app_info ("Blah1");
|
info1 = create_app_info ("Blah1");
|
||||||
@ -418,6 +441,9 @@ test_fallback (void)
|
|||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gint old_length;
|
gint old_length;
|
||||||
|
|
||||||
|
if (skip_missing_update_desktop_database ())
|
||||||
|
return;
|
||||||
|
|
||||||
info1 = create_app_info ("Test1");
|
info1 = create_app_info ("Test1");
|
||||||
info2 = create_app_info ("Test2");
|
info2 = create_app_info ("Test2");
|
||||||
|
|
||||||
@ -492,6 +518,9 @@ test_last_used (void)
|
|||||||
GAppInfo *info1, *info2, *default_app;
|
GAppInfo *info1, *info2, *default_app;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (skip_missing_update_desktop_database ())
|
||||||
|
return;
|
||||||
|
|
||||||
info1 = create_app_info ("Test1");
|
info1 = create_app_info ("Test1");
|
||||||
info2 = create_app_info ("Test2");
|
info2 = create_app_info ("Test2");
|
||||||
|
|
||||||
@ -593,6 +622,19 @@ wait_for_file (const gchar *want_this,
|
|||||||
unlink (or_this);
|
unlink (or_this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
skip_missing_dbus_daemon (void)
|
||||||
|
{
|
||||||
|
gchar *path = g_find_program_in_path ("dbus-daemon");
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
g_test_skip ("dbus-daemon is required to run this test");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
g_free (path);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_actions (void)
|
test_actions (void)
|
||||||
{
|
{
|
||||||
@ -606,6 +648,9 @@ test_actions (void)
|
|||||||
gchar *tweak_path;
|
gchar *tweak_path;
|
||||||
gchar *twiddle_path;
|
gchar *twiddle_path;
|
||||||
|
|
||||||
|
if (skip_missing_dbus_daemon ())
|
||||||
|
return;
|
||||||
|
|
||||||
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
/* Set up a test session bus to keep D-Bus traffic off the real session bus. */
|
||||||
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
||||||
g_test_dbus_up (bus);
|
g_test_dbus_up (bus);
|
||||||
@ -1206,6 +1251,9 @@ test_default_uri_handler (void)
|
|||||||
gchar *file_path = NULL;
|
gchar *file_path = NULL;
|
||||||
GAppInfo *info;
|
GAppInfo *info;
|
||||||
|
|
||||||
|
if (skip_missing_update_desktop_database ())
|
||||||
|
return;
|
||||||
|
|
||||||
info = create_app_info_toucher ("Touch Handled", "handled",
|
info = create_app_info_toucher ("Touch Handled", "handled",
|
||||||
"x-scheme-handler/glib-touch",
|
"x-scheme-handler/glib-touch",
|
||||||
&file_path);
|
&file_path);
|
||||||
@ -1282,6 +1330,9 @@ test_default_uri_handler_async (void)
|
|||||||
gboolean called = FALSE;
|
gboolean called = FALSE;
|
||||||
gint64 start_time, touch_time;
|
gint64 start_time, touch_time;
|
||||||
|
|
||||||
|
if (skip_missing_update_desktop_database ())
|
||||||
|
return;
|
||||||
|
|
||||||
loop = g_main_loop_new (NULL, FALSE);
|
loop = g_main_loop_new (NULL, FALSE);
|
||||||
info = create_app_info_toucher ("Touch Handled", "handled-async",
|
info = create_app_info_toucher ("Touch Handled", "handled-async",
|
||||||
"x-scheme-handler/glib-async-touch",
|
"x-scheme-handler/glib-async-touch",
|
||||||
@ -1833,6 +1884,9 @@ test_launch_fail_dbus (void)
|
|||||||
GAsyncResult *result = NULL;
|
GAsyncResult *result = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
if (skip_missing_dbus_daemon ())
|
||||||
|
return;
|
||||||
|
|
||||||
/* Set up a test session bus to ensure that launching the app happens using
|
/* Set up a test session bus to ensure that launching the app happens using
|
||||||
* D-Bus rather than spawning. */
|
* D-Bus rather than spawning. */
|
||||||
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
bus = g_test_dbus_new (G_TEST_DBUS_NONE);
|
||||||
|
@ -3784,6 +3784,20 @@ create_command_line_app_info (const char *name,
|
|||||||
return g_steal_pointer (&info);
|
return g_steal_pointer (&info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
skip_missing_update_desktop_database (void)
|
||||||
|
{
|
||||||
|
gchar *path = g_find_program_in_path ("update-desktop-database");
|
||||||
|
|
||||||
|
if (path == NULL)
|
||||||
|
{
|
||||||
|
g_test_skip ("update-desktop-database is required to run this test");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
g_free (path);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
test_query_default_handler_uri (void)
|
test_query_default_handler_uri (void)
|
||||||
{
|
{
|
||||||
@ -3793,10 +3807,8 @@ test_query_default_handler_uri (void)
|
|||||||
GFile *file;
|
GFile *file;
|
||||||
GFile *invalid_file;
|
GFile *invalid_file;
|
||||||
|
|
||||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
if (skip_missing_update_desktop_database ())
|
||||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
info = create_command_line_app_info ("Gio File Handler", "true",
|
info = create_command_line_app_info ("Gio File Handler", "true",
|
||||||
"x-scheme-handler/gio-file");
|
"x-scheme-handler/gio-file");
|
||||||
@ -3878,10 +3890,8 @@ test_query_default_handler_file (void)
|
|||||||
const char buffer[] = "Text file!\n";
|
const char buffer[] = "Text file!\n";
|
||||||
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
||||||
|
|
||||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
if (skip_missing_update_desktop_database ())
|
||||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
text_file = g_file_new_tmp ("query-default-handler-XXXXXX", &iostream, &error);
|
text_file = g_file_new_tmp ("query-default-handler-XXXXXX", &iostream, &error);
|
||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
@ -3974,10 +3984,8 @@ test_query_default_handler_file_async (void)
|
|||||||
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
const guint8 binary_buffer[] = "\xde\xad\xbe\xff";
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
if (skip_missing_update_desktop_database ())
|
||||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
data.loop = g_main_loop_new (NULL, FALSE);
|
data.loop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
@ -4064,10 +4072,8 @@ test_query_default_handler_uri_async (void)
|
|||||||
GFile *file;
|
GFile *file;
|
||||||
GFile *invalid_file;
|
GFile *invalid_file;
|
||||||
|
|
||||||
#if defined(G_OS_WIN32) || defined(__APPLE__)
|
if (skip_missing_update_desktop_database ())
|
||||||
g_test_skip ("Default URI handlers are not currently supported on Windows or macOS");
|
|
||||||
return;
|
return;
|
||||||
#endif
|
|
||||||
|
|
||||||
info = create_command_line_app_info ("Gio File Handler", "true",
|
info = create_command_line_app_info ("Gio File Handler", "true",
|
||||||
"x-scheme-handler/gio-file");
|
"x-scheme-handler/gio-file");
|
||||||
|
Loading…
Reference in New Issue
Block a user