summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-30 10:04:58 -0400
committerMarco Trevisan (TreviƱo) <mail@3v1n0.net>2021-05-05 16:38:25 +0200
commit7aaba05f7b8d7739fff7006f2933b0316a618315 (patch)
treebd102ef12a1803ed78dbf237d18c531ce17729e6
parent4b93e64a4d23a6ced2dd146f10e5fb10a1000d93 (diff)
downloadpango-7aaba05f7b8d7739fff7006f2933b0316a618315.tar.gz
Add a reproducer for a pidgin crash
This test is reproducing the crash reported in #490. (cherry-picked from commit c2c97330)
-rw-r--r--tests/testmisc.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/testmisc.c b/tests/testmisc.c
index a2784f13..b2aac796 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -51,6 +51,25 @@ test_itemize_empty_crash (void)
g_object_unref (context);
}
+/* Test that pango_layout_set_text (layout, "short", 200)
+ * does not lead to a crash. (pidgin does this)
+ */
+static void
+test_short_string_crash (void)
+{
+ PangoContext *context;
+ PangoLayout *layout;
+ int width, height;
+
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ layout = pango_layout_new (context);
+ pango_layout_set_text (layout, "short text", 200);
+ pango_layout_get_pixel_size (layout, &width, &height);
+
+ g_object_unref (layout);
+ g_object_unref (context);
+}
+
int
main (int argc, char *argv[])
{
@@ -58,6 +77,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);
return g_test_run ();
}