[pango/line-breaker: 35/49] port testrandom




commit c63e91c8b35c3352efc9377eb44676c5cb728a6a
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 19 09:13:28 2022 -0500

    port testrandom

 tests/testrandom.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/tests/testrandom.c b/tests/testrandom.c
index 332376b6..8c0ef83f 100644
--- a/tests/testrandom.c
+++ b/tests/testrandom.c
@@ -92,13 +92,13 @@ compare_size (gconstpointer a,
 }
 
 static void
-layout_check_size (PangoLayout *layout,
-                   int          width,
-                   Size        *out_size)
+layout_check_size (PangoSimpleLayout *layout,
+                   int                width,
+                   Size              *out_size)
 {
   out_size->set_width = width;
-  pango_layout_set_width (layout, width);
-  pango_layout_get_size (layout, &out_size->width, &out_size->height);
+  pango_simple_layout_set_width (layout, width);
+  pango_lines_get_size (pango_simple_layout_get_lines (layout), &out_size->width, &out_size->height);
 }
 
 static void
@@ -107,7 +107,7 @@ test_wrap_char (gconstpointer data)
   PangoDirection dir = GPOINTER_TO_UINT (data);
   PangoFontDescription *desc;
   PangoContext *context;
-  PangoLayout *layout;
+  PangoSimpleLayout *layout;
   char *sentence;
   Size min, max;
   Size sizes[100];
@@ -115,15 +115,15 @@ test_wrap_char (gconstpointer data)
 
   context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
   desc = pango_font_description_from_string ("Sans 10");
-  layout = pango_layout_new (context);
-  pango_layout_set_font_description (layout, desc);
+  layout = pango_simple_layout_new (context);
+  pango_simple_layout_set_font_description (layout, desc);
   pango_font_description_free (desc);
-  pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
+  pango_simple_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
 
   for (j = 0; j < N_SENTENCES; j++)
     {
       sentence = create_random_sentence (dir);
-      pango_layout_set_text (layout, sentence, -1);
+      pango_simple_layout_set_text (layout, sentence, -1);
       g_test_message ("%s", sentence);
       g_free (sentence);
 
@@ -177,7 +177,7 @@ test_wrap_char_min_width (gconstpointer data)
   PangoDirection dir = GPOINTER_TO_UINT (data);
   PangoFontDescription *desc;
   PangoContext *context;
-  PangoLayout *test_layout, *ref_layout;
+  PangoSimpleLayout *test_layout, *ref_layout;
   char *sentence, *s;
   GString *ref_string;
   gsize j;
@@ -185,18 +185,18 @@ test_wrap_char_min_width (gconstpointer data)
 
   context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
   desc = pango_font_description_from_string ("Sans 10");
-  ref_layout = pango_layout_new (context);
-  pango_layout_set_font_description (ref_layout, desc);
-  test_layout = pango_layout_new (context);
-  pango_layout_set_font_description (test_layout, desc);
-  pango_layout_set_wrap (test_layout, PANGO_WRAP_WORD_CHAR);
-  pango_layout_set_width (test_layout, 0);
+  ref_layout = pango_simple_layout_new (context);
+  pango_simple_layout_set_font_description (ref_layout, desc);
+  test_layout = pango_simple_layout_new (context);
+  pango_simple_layout_set_font_description (test_layout, desc);
+  pango_simple_layout_set_wrap (test_layout, PANGO_WRAP_WORD_CHAR);
+  pango_simple_layout_set_width (test_layout, 0);
   pango_font_description_free (desc);
 
   for (j = 0; j < N_SENTENCES; j++)
     {
       sentence = create_random_sentence (dir);
-      pango_layout_set_text (test_layout, sentence, -1);
+      pango_simple_layout_set_text (test_layout, sentence, -1);
       g_test_message ("%s", sentence);
       ref_string = g_string_new ("");
       for (s = sentence; *s; s = g_utf8_next_char (s))
@@ -205,12 +205,12 @@ test_wrap_char_min_width (gconstpointer data)
           g_string_append_unichar (ref_string, g_test_rand_bit () ? 0x2010 : '-');
           g_string_append_c (ref_string, '\n');
         }
-      pango_layout_set_text (ref_layout, ref_string->str, ref_string->len);
+      pango_simple_layout_set_text (ref_layout, ref_string->str, ref_string->len);
       g_string_free (ref_string, TRUE);
       g_free (sentence);
 
-      pango_layout_get_size (test_layout, &test_width, NULL);
-      pango_layout_get_size (ref_layout, &ref_width, NULL);
+      pango_lines_get_size (pango_simple_layout_get_lines (test_layout), &test_width, NULL);
+      pango_lines_get_size (pango_simple_layout_get_lines (ref_layout), &ref_width, NULL);
 
       g_assert_cmpint (test_width, <=, ref_width);
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]