summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-06-10 11:36:24 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-06-10 11:38:26 -0400
commit279bd5256b17ed68d50fbaaf7df60f189de33c96 (patch)
tree090904356e9751bda50b9d93577a4acb38ab8caa /tests
parentb6dc6e05d694bb5a0bd396b5847291ead3a431ea (diff)
downloadpango-279bd5256b17ed68d50fbaaf7df60f189de33c96.tar.gz
itemize: Work around gtk2 brokenness
GTK 2 apparently manages to call pango_itemize_with_base_dir with a non-zero length for a string that contains 0 characters. That in turn causes pango_log2vis_get_embedding_levels to return NULL, and things go downhill from there. A test is included. Fixes: #480
Diffstat (limited to 'tests')
-rw-r--r--tests/testmisc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/testmisc.c b/tests/testmisc.c
index a078944d..f5583cab 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -41,12 +41,26 @@ test_shape_tab_crash (void)
g_object_unref (context);
}
+/* Test that itemizing a string with 0 characters works
+ */
+static void
+test_itemize_empty_crash (void)
+{
+ PangoContext *context;
+
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ pango_itemize_with_base_dir (context, PANGO_DIRECTION_LTR, "", 0, 1, NULL, NULL);
+
+ g_object_unref (context);
+}
+
int
main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/layout/shape-tab-crash", test_shape_tab_crash);
+ g_test_add_func ("/layout/itemize-empty-crash", test_itemize_empty_crash);
return g_test_run ();
}