[pango/matthiasc/for-master: 2/2] tests: Fix an assertion




commit 7b3743d29b0084af1ad763ea3260e3712c490abe
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 67f0be85..76d9e0bb 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]