mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-19 23:28:54 +02:00
gio/test/resources.c: Fix for Windows
We need to use g_content_type_get_mime_type() to look up the mime type of the file from the registry on the content type that was acquired on Windows, as g_file_info_get_content_type() does not acquire the file mime type (unlike on *NIX). g_content_type_get_mime_type() on *NIX is more or less an no-op as it simply returns the g_strdup()-ed version of the passed-in content type. This will enable the resources test to pass on Windows. https://bugzilla.gnome.org/show_bug.cgi?id=711047
This commit is contained in:
@@ -450,7 +450,7 @@ test_uri_query_info (void)
|
|||||||
GBytes *data;
|
GBytes *data;
|
||||||
GFile *file;
|
GFile *file;
|
||||||
GFileInfo *info;
|
GFileInfo *info;
|
||||||
const char *content_type;
|
const char *content_type, *mime_type;
|
||||||
|
|
||||||
loaded_file = g_file_get_contents (g_test_get_filename (G_TEST_BUILT, "test.gresource", NULL),
|
loaded_file = g_file_get_contents (g_test_get_filename (G_TEST_BUILT, "test.gresource", NULL),
|
||||||
&content, &content_size, NULL);
|
&content, &content_size, NULL);
|
||||||
@@ -471,7 +471,9 @@ test_uri_query_info (void)
|
|||||||
|
|
||||||
content_type = g_file_info_get_content_type (info);
|
content_type = g_file_info_get_content_type (info);
|
||||||
g_assert (content_type);
|
g_assert (content_type);
|
||||||
g_assert_cmpstr (content_type, ==, "text/plain");
|
mime_type = g_content_type_get_mime_type (content_type);
|
||||||
|
g_assert (mime_type);
|
||||||
|
g_assert_cmpstr (mime_type, ==, "text/plain");
|
||||||
|
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user