[pango] tests: Fix an assertion
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] tests: Fix an assertion
- Date: Wed, 21 Jul 2021 12:20:57 +0000 (UTC)
commit 26fa82a51cd6d123f3af1cb9b7e3514549eca922
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 10 18:19:38 2021 -0400
tests: Fix an assertion
We were rounding things differently, giving
us off-by-one errors on MacOs.
tests/test-layout.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 502bc98a..1e531031 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -461,17 +461,18 @@ test_file (const char *filename, GString *string)
/* Some checks on extents - we have to be careful here, since we
* don't want to depend on font metrics.
*/
+ pango_layout_get_size (layout, &width, &height);
pango_layout_get_extents (layout, &ink_rect, &logical_rect);
+ g_assert_cmpint (width, ==, logical_rect.width);
+ g_assert_cmpint (height, ==, logical_rect.height);
+
pango_extents_to_pixels (&ink_rect, NULL);
pango_extents_to_pixels (&logical_rect, NULL);
pango_layout_get_pixel_extents (layout, &ink_rect1, &logical_rect1);
- pango_layout_get_size (layout, &width, &height);
pango_layout_get_pixel_size (layout, &width1, &height1);
assert_rectangle_equal (&ink_rect, &ink_rect1);
assert_rectangle_equal (&logical_rect, &logical_rect1);
- g_assert_cmpint (PANGO_PIXELS (width), ==, logical_rect.width);
- g_assert_cmpint (PANGO_PIXELS (height), ==, logical_rect.height);
g_assert_cmpint (width1, ==, logical_rect1.width);
g_assert_cmpint (height1, ==, logical_rect1.height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]