Merge branch 'improve-css-test' into 'main'

css: Propagate charset conversion errors

See merge request GNOME/gtk!4943
This commit is contained in:
Matthias Clasen 2022-08-11 11:58:04 +00:00
commit e5a47b5592
2 changed files with 13 additions and 3 deletions

View File

@ -152,13 +152,23 @@ gtk_css_data_url_parse (const char *url,
gsize read;
gsize written;
gpointer data;
GError *local_error = NULL;
data = g_convert_with_fallback (bdata, bsize,
"UTF-8", charset,
(char *) "*",
&read, &written, NULL);
&read, &written, &local_error);
g_free (bdata);
if (local_error)
{
g_propagate_error (error, local_error);
g_free (charset);
g_free (data);
return NULL;
}
bdata = data;
bsize = written;
}

View File

@ -81,8 +81,8 @@ test_parse (gconstpointer data)
if (test->contents)
{
g_assert_nonnull (bytes);
g_assert_no_error (error);
g_assert_nonnull (bytes);
if (test->mimetype == NULL)
g_assert_null (mimetype);
else
@ -94,8 +94,8 @@ test_parse (gconstpointer data)
}
else
{
g_assert_null (bytes);
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME);
g_assert_null (bytes);
g_error_free (error);
}
}