summaryrefslogtreecommitdiff
path: root/tests/test-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-08 00:49:56 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-07-08 00:49:56 +0000
commitf3aec778e817f685498e949663c67b72f27e0308 (patch)
treedba40945c71b083a96f23eaa3665020c11ecf452 /tests/test-layout.c
parentcfbf6dc53a61e1665b69149bcc1e003760a49499 (diff)
parent21a90c02c40889e619c11101442d33ccf6f91e9a (diff)
downloadpango-f3aec778e817f685498e949663c67b72f27e0308.tar.gz
Merge branch 'tests-and-fixes' into 'master'
tests: Dump grapheme boundaries too See merge request GNOME/pango!362
Diffstat (limited to 'tests/test-layout.c')
-rw-r--r--tests/test-layout.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 0d71ab54..4c27585e 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -545,6 +545,13 @@ test_file (const char *filename, GString *string)
prev_index = run->item->offset;
next_index = run->item->offset + run->item->length;
+ {
+ PangoGlyphItem *run2 = pango_glyph_item_copy (run);
+ g_assert_cmpint (run2->item->offset, ==, run->item->offset);
+ g_assert_cmpint (run2->item->length, ==, run->item->length);
+ pango_glyph_item_free (run2);
+ }
+
pango_layout_line_get_x_ranges (line, prev_index, next_index, &ranges, &n_ranges);
/* The index is within the run, so the x should be in one of the ranges */
@@ -580,6 +587,7 @@ test_file (const char *filename, GString *string)
PangoRectangle line_ink, line_logical;
int baseline;
PangoLayoutLine *line;
+ PangoLayoutRun *run;
line = pango_layout_iter_get_line (iter);
@@ -602,6 +610,28 @@ test_file (const char *filename, GString *string)
{
g_assert_cmpint (line->start_index + line->length, <=, strlen (pango_layout_get_text (layout)));
}
+
+ run = pango_layout_iter_get_run (iter);
+
+ if (run)
+ {
+ const char *text;
+ int *widths;
+ int *widths2;
+
+ text = pango_layout_get_text (layout);
+
+ widths = g_new (int, run->item->num_chars);
+ pango_glyph_item_get_logical_widths (run, text, widths);
+
+ widths2 = g_new (int, run->item->num_chars);
+ pango_glyph_string_get_logical_widths (run->glyphs, text + run->item->offset, run->item->length, run->item->analysis.level, widths2);
+
+ g_assert_true (memcmp (widths, widths2, sizeof (int) * run->item->num_chars) == 0);
+
+ g_free (widths);
+ g_free (widths2);
+ }
}
while (pango_layout_iter_next_line (iter));