tests: Add a test for g_content_type_guess() with no arguments

It should produce a generic result, but not crash. It was previously
crashing on macOS.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Fixes: #1729
This commit is contained in:
Philip Withnall 2019-03-19 11:18:48 +00:00
parent 4a0cb8f3a1
commit b73713d893

View File

@ -118,6 +118,14 @@ test_guess (void)
g_assert_false (uncertain);
g_free (res);
g_free (expected);
/* The data below would be detected as a valid content type, but shouldnt be read at all. */
res = g_content_type_guess (NULL, (guchar *)"%!PS-Adobe-2.0 EPSF-1.2", 0, &uncertain);
expected = g_content_type_from_mime_type ("application/x-zerosize");
g_assert_content_type_equals (expected, res);
g_assert_false (uncertain);
g_free (res);
g_free (expected);
}
static void