[pango/fix-split-cursors-at-end: 2/4] Add an old testcase
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/fix-split-cursors-at-end: 2/4] Add an old testcase
- Date: Wed, 4 Aug 2021 22:09:50 +0000 (UTC)
commit 8f21cb3bab3a51de2460372f5d7094202a93d3f9
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 | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
---
diff --git a/tests/testmisc.c b/tests/testmisc.c
index fe2e9075..448d7e1d 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -301,6 +301,31 @@ 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);
+ }
+}
+
int
main (int argc, char *argv[])
{
@@ -320,6 +345,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]