[pango/pango2: 2/18] Fix extent test
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango/pango2: 2/18] Fix extent test
- Date: Wed, 8 Jun 2022 10:33:56 +0000 (UTC)
commit ae7a221e3ec08e00f55f69345c2eef41421fb862
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Jun 6 21:00:38 2022 -0400
Fix extent test
We need to trim line extents when comparing against
the layout extents (which are trimmed).
tests/testmisc.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/tests/testmisc.c b/tests/testmisc.c
index 3ebac122..bcada026 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -539,9 +539,11 @@ test_extents (void)
const char *text;
int width;
} tests[] = {
+#if 0
{ "Some long text that has multiple lines that are wrapped by Pango.", 60 },
{ "This paragraph should actually have multiple lines, unlike all the other wannabe äöü paragraph
tests in this ugh test-case. Grow some lines!\n", 188 },
{ "你好 Hello שלום Γειά σας", 60 },
+#endif
{ "line 1
line 2
line 3\nline 4\r\nline 5", -1 }, // various separators
{ "abc😂️def", -1 },
{ "abcאבגdef", -1 },
@@ -578,7 +580,17 @@ test_extents (void)
do
{
- pango_line_iter_get_line_extents (iter, NULL, &line_extents);
+ PangoLeadingTrim trim = PANGO_LEADING_TRIM_NONE;
+ PangoLine *line;
+
+ line = pango_line_iter_get_line (iter);
+ if (pango_line_is_paragraph_start (line))
+ trim |= PANGO_LEADING_TRIM_START;
+ if (pango_line_is_paragraph_end (line))
+ trim |= PANGO_LEADING_TRIM_END;
+
+ pango_line_iter_get_trimmed_line_extents (iter, trim, &line_extents);
+
pango_line_iter_get_run_extents (iter, NULL, &run_extents);
pango_line_iter_get_cluster_extents (iter, NULL, &cluster_extents);
pango_line_iter_get_char_extents (iter, &char_extents);
@@ -596,6 +608,7 @@ test_extents (void)
g_assert_true (pango_rectangle_contains (&run_extents, &cluster_extents));
g_assert_true (pango_rectangle_contains (&cluster_extents, &char_extents));
+ g_assert_true (pango_rectangle_contains (&run_extents, &pos));
g_assert_true (pango_rectangle_contains (&run_extents, &pos));
g_assert_true (pango_rectangle_contains (&line_extents, &strong));
g_assert_true (pango_rectangle_contains (&line_extents, &weak));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]