summaryrefslogtreecommitdiff
path: root/tests/testmisc.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-08 16:49:43 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-09-08 16:53:37 -0400
commit7db68865b7560ca5d74aa6cd15656b3656ea7f42 (patch)
tree6d34692fdda54a66d9282fa855d6fcd0f5310a2b /tests/testmisc.c
parent677db04fae0af875685a71e0cedd408578071bef (diff)
downloadpango-7db68865b7560ca5d74aa6cd15656b3656ea7f42.tar.gz
Don't assert in pango_language_get_scriptsavoid-script-lang-crash
The assertion in pango_language_get_scripts can actually be triggered since we last regenerated the pango_script_for_lang table. It now includes an entry for und-zsye which has no scripts. Handle this case without asserting. This commit includes a test.
Diffstat (limited to 'tests/testmisc.c')
-rw-r--r--tests/testmisc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/testmisc.c b/tests/testmisc.c
index 9f1f24da..2f6c148b 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -73,6 +73,20 @@ test_short_string_crash (void)
g_object_unref (context);
}
+static void
+test_language_emoji_crash (void)
+{
+ PangoLanguage *lang;
+ const PangoScript *scripts;
+ int num;
+
+ lang = pango_language_from_string ("und-zsye");
+ scripts = pango_language_get_scripts (lang, &num);
+
+ g_assert (num >= 0);
+ g_assert (scripts == NULL || num > 0);
+}
+
int
main (int argc, char *argv[])
{
@@ -81,6 +95,7 @@ main (int argc, char *argv[])
g_test_add_func ("/layout/shape-tab-crash", test_shape_tab_crash);
g_test_add_func ("/layout/itemize-empty-crash", test_itemize_empty_crash);
g_test_add_func ("/layout/short-string-crash", test_short_string_crash);
+ g_test_add_func ("/language/emoji-crash", test_language_emoji_crash);
return g_test_run ();
}