summaryrefslogtreecommitdiff
path: root/tests/testmisc.c
diff options
context:
space:
mode:
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 ();
}