summaryrefslogtreecommitdiff
path: root/tests/testmisc.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-08-04 17:57:54 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-04 18:13:02 -0400
commiteeff7bb783e1fd44fd8c54e6be8ace267b4521c9 (patch)
tree5fa00dcdd2a1cc890e8dc4c7a68a1b4e28565f8d /tests/testmisc.c
parentaa69d8a62b1afb5eaee63f32cde6e4f00d9702d1 (diff)
downloadpango-eeff7bb783e1fd44fd8c54e6be8ace267b4521c9.tar.gz
Add an old testcase
This was quite an odyssee: - Identify commit from 2008 that caused a regression - Spot the commit message alluding to a crash - Identify bug number in NEWS for releases from 2008 - Find the bug in the no longer searchable bugzilla.gnome.org
Diffstat (limited to 'tests/testmisc.c')
-rw-r--r--tests/testmisc.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/testmisc.c b/tests/testmisc.c
index fe2e9075..c305a168 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -301,6 +301,34 @@ test_fallback_shape (void)
g_object_unref (context);
}
+/* https://bugzilla.gnome.org/show_bug.cgi?id=547303 */
+static void
+test_get_cursor_crash (void)
+{
+ PangoContext *context;
+ PangoLayout *layout;
+ int i;
+
+ char *string = "foo\n\rbar\r\nbaz\n\nqux\n\n..";
+
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+
+ layout = pango_layout_new (context);
+
+ pango_layout_set_text (layout, string, -1);
+
+ for (i = 0; string[i]; i++)
+ {
+ PangoRectangle rectA, rectB;
+
+ pango_layout_get_cursor_pos (layout, i, &rectA, &rectB);
+ g_assert_cmpint (rectA.x, ==, rectB.x);
+ }
+
+ g_object_unref (layout);
+ g_object_unref (context);
+}
+
int
main (int argc, char *argv[])
{
@@ -320,6 +348,7 @@ main (int argc, char *argv[])
g_test_add_func ("/gravity/for-script", test_gravity_for_script);
g_test_add_func ("/layout/fallback-shape", test_fallback_shape);
g_test_add_func ("/language/to-tag", test_language_to_tag);
+ g_test_add_func ("/bidi/get-cursor-crash", test_get_cursor_crash);
return g_test_run ();
}