summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-13 08:15:12 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-11-13 08:53:48 -0500
commit60f8171f062b4653a41cce02a582caa25331c68f (patch)
treee19b8d96b8b86a99c3a08ba0a8907446f550abf4 /tests
parent6101f21df7e260e25a18bc8918a7429378cd85f3 (diff)
downloadpango-60f8171f062b4653a41cce02a582caa25331c68f.tar.gz
Fix a bug in Small Caps handling
We were not passing the correct split_offset to pango_item_split(). Testcase included. Fixes: #627
Diffstat (limited to 'tests')
-rw-r--r--tests/testmisc.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/testmisc.c b/tests/testmisc.c
index a91dcbb3..4861c3d0 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -779,6 +779,29 @@ test_wrap_char (void)
g_object_unref (context);
}
+/* Test the crash with Small Caps in itemization from #627 */
+static void
+test_small_caps_crash (void)
+{
+ PangoContext *context;
+ PangoLayout *layout;
+ PangoFontDescription *desc;
+ int w, h;
+
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ layout = pango_layout_new (context);
+ desc = pango_font_description_from_string ("Cantarell Small-Caps 11");
+ pango_layout_set_font_description (layout, desc);
+
+ pango_layout_set_text (layout, "Pere Ràfols Soler\nEqualiser, LV2\nAudio: 1, 1\nMidi: 0, 0\nControls: 53, 2\nCV: 0, 0", -1);
+
+ pango_layout_get_size (layout, &w, &h);
+
+ pango_font_description_free (desc);
+ g_object_unref (layout);
+ g_object_unref (context);
+}
+
int
main (int argc, char *argv[])
{
@@ -813,6 +836,7 @@ main (int argc, char *argv[])
g_test_add_func ("/layout/gravity-metrics", test_gravity_metrics);
g_test_add_func ("/layout/wrap-char", test_wrap_char);
g_test_add_func ("/matrix/transform-rectangle", test_transform_rectangle);
+ g_test_add_func ("/itemize/small-caps-crash", test_small_caps_crash);
return g_test_run ();
}