gosxcontenttype: Fix various tests

https://bugzilla.gnome.org/show_bug.cgi?id=780384
This commit is contained in:
Patrick Griffis
2017-03-22 01:37:43 -04:00
parent 03c88daa73
commit 206c54c80b
2 changed files with 51 additions and 11 deletions

View File

@@ -49,13 +49,6 @@ test_guess (void)
g_free (res);
g_free (expected);
res = g_content_type_guess ("foo.desktop", data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("application/x-desktop");
g_assert_content_type_equals (expected, res);
g_assert (!uncertain);
g_free (res);
g_free (expected);
res = g_content_type_guess ("foo.txt", data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("text/plain");
g_assert_content_type_equals (expected, res);
@@ -70,6 +63,15 @@ test_guess (void)
g_free (res);
g_free (expected);
/* Sadly OSX just doesn't have as large and robust of a mime type database as Linux */
#ifndef __APPLE__
res = g_content_type_guess ("foo.desktop", data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("application/x-desktop");
g_assert_content_type_equals (expected, res);
g_assert (!uncertain);
g_free (res);
g_free (expected);
res = g_content_type_guess (NULL, data, sizeof (data) - 1, &uncertain);
expected = g_content_type_from_mime_type ("application/x-desktop");
g_assert_content_type_equals (expected, res);
@@ -115,6 +117,7 @@ test_guess (void)
g_assert (!uncertain);
g_free (res);
g_free (expected);
#endif
}
static void
@@ -161,6 +164,11 @@ test_list (void)
gchar *plain;
gchar *xml;
#ifdef __APPLE__
g_test_skip ("The OSX backend does not implement g_content_types_get_registered()");
return;
#endif
plain = g_content_type_from_mime_type ("text/plain");
xml = g_content_type_from_mime_type ("application/xml");
@@ -299,6 +307,11 @@ test_tree (void)
gchar **types;
gint i;
#ifdef __APPLE__
g_test_skip ("The OSX backend does not implement g_content_type_guess_for_tree()");
return;
#endif
for (i = 0; i < G_N_ELEMENTS (tests); i++)
{
path = g_test_get_filename (G_TEST_DIST, tests[i], NULL);