[pango/fix-split-cursors-at-end: 1/3] Add an old testcase
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-split-cursors-at-end: 1/3] Add an old testcase
- Date: Wed, 4 Aug 2021 22:13:10 +0000 (UTC)
commit eeff7bb783e1fd44fd8c54e6be8ace267b4521c9
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Aug 4 17:57:54 2021 -0400
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
tests/testmisc.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
---
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 ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]