mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
tests: skip test that requires shared-mime-info when its missing
shared-mime-info required glib to build and will not be there during bootstrap. Skip the test if it is missing. ref: https://gitlab.gnome.org/GNOME/glib/-/issues/3317 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
This commit is contained in:
parent
5fdd6507b4
commit
6a262b0c03
@ -13,6 +13,20 @@
|
||||
__s1, " == ", __s2); \
|
||||
} 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
|
||||
test_guess (void)
|
||||
{
|
||||
@ -26,6 +40,9 @@ test_guess (void)
|
||||
"Name=appinfo-test\n"
|
||||
"Exec=./appinfo-test --option\n";
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
existing_directory = (gchar *) g_getenv ("SYSTEMROOT");
|
||||
|
||||
@ -150,6 +167,9 @@ test_subtype (void)
|
||||
gchar *plain;
|
||||
gchar *xml;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
plain = g_content_type_from_mime_type ("text/plain");
|
||||
xml = g_content_type_from_mime_type ("application/xml");
|
||||
|
||||
@ -175,6 +195,9 @@ test_list (void)
|
||||
gchar *plain;
|
||||
gchar *xml;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
#ifdef __APPLE__
|
||||
g_test_skip ("The OSX backend does not implement g_content_types_get_registered()");
|
||||
return;
|
||||
@ -202,6 +225,9 @@ test_executable (void)
|
||||
{
|
||||
gchar *type;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
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.
|
||||
@ -228,6 +254,9 @@ test_description (void)
|
||||
gchar *type;
|
||||
gchar *desc;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
type = g_content_type_from_mime_type ("text/plain");
|
||||
desc = g_content_type_get_description (type);
|
||||
g_assert_nonnull (desc);
|
||||
@ -242,6 +271,9 @@ test_icon (void)
|
||||
gchar *type;
|
||||
GIcon *icon;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
type = g_content_type_from_mime_type ("text/plain");
|
||||
icon = g_content_type_get_icon (type);
|
||||
g_assert_true (G_IS_ICON (icon));
|
||||
@ -290,6 +322,9 @@ test_symbolic_icon (void)
|
||||
gchar *type;
|
||||
GIcon *icon;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
type = g_content_type_from_mime_type ("text/plain");
|
||||
icon = g_content_type_get_symbolic_icon (type);
|
||||
g_assert_true (G_IS_ICON (icon));
|
||||
@ -344,6 +379,9 @@ test_tree (void)
|
||||
gchar **types;
|
||||
gsize i;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
#if defined(__APPLE__) || defined(G_OS_WIN32)
|
||||
g_test_skip ("The OSX & Windows backends do not implement g_content_type_guess_for_tree()");
|
||||
return;
|
||||
@ -437,8 +475,13 @@ test_guess_svg_from_data (void)
|
||||
</svg>\n";
|
||||
|
||||
gboolean uncertain = TRUE;
|
||||
gchar *res = g_content_type_guess (NULL, (guchar *)svgfilecontent,
|
||||
sizeof (svgfilecontent) - 1, &uncertain);
|
||||
gchar *res;
|
||||
|
||||
if (skip_missing_shared_mime_info ())
|
||||
return;
|
||||
|
||||
res = g_content_type_guess (NULL, (guchar *)svgfilecontent,
|
||||
sizeof (svgfilecontent) - 1, &uncertain);
|
||||
#ifdef __APPLE__
|
||||
g_assert_cmpstr (res, ==, "public.svg-image");
|
||||
#elif defined(G_OS_WIN32)
|
||||
|
Loading…
Reference in New Issue
Block a user