diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-07-14 22:03:57 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-07-14 22:19:51 -0400 |
commit | f57d23986d2b510d15a86a5e9553463b053a44e7 (patch) | |
tree | cda53bf4950c2a48cd957fc47ae6023e5eb39125 /tests/test-layout.c | |
parent | 2e499aa93b70d14bae605b65755d7c49fa44a61b (diff) | |
download | pango-f57d23986d2b510d15a86a5e9553463b053a44e7.tar.gz |
test-layout: Be robust against odd runs
This causes some changes in the output.
Update expected output.
Diffstat (limited to 'tests/test-layout.c')
-rw-r--r-- | tests/test-layout.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c index 1ad3498c..cbbffd2c 100644 --- a/tests/test-layout.c +++ b/tests/test-layout.c @@ -133,7 +133,7 @@ dump_runs (PangoLayout *layout, GString *string) PangoLayoutRun *run; PangoItem *item; const gchar *text; - gint index, index2; + gint index; gboolean has_more; gchar *char_str; gint i; @@ -143,28 +143,18 @@ dump_runs (PangoLayout *layout, GString *string) iter = pango_layout_get_iter (layout); has_more = TRUE; - index = pango_layout_iter_get_index (iter); - index2 = 0; i = 0; while (has_more) { run = pango_layout_iter_get_run (iter); + index = pango_layout_iter_get_index (iter); has_more = pango_layout_iter_next_run (iter); i++; - if (has_more) - { - index2 = pango_layout_iter_get_index (iter); - char_str = g_strndup (text + index, index2 - index); - } - else - { - char_str = g_strdup (text + index); - } - if (run) { item = ((PangoGlyphItem*)run)->item; + char_str = g_strndup (text + item->offset, item->length); font = font_name (item->analysis.font); g_string_append_printf (string, "i=%d, index=%d, chars=%d, level=%d, gravity=%s, flags=%d, font=%s, script=%s, language=%s, '%s'\n", i, index, item->num_chars, item->analysis.level, @@ -176,15 +166,13 @@ dump_runs (PangoLayout *layout, GString *string) char_str); print_attributes (item->analysis.extra_attrs, string); g_free (font); + g_free (char_str); } else { g_string_append_printf (string, "i=%d, index=%d, no run, line end\n", i, index); } - - g_free (char_str); - index = index2; } pango_layout_iter_free (iter); } |