diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-18 22:34:39 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-01-24 10:58:17 -0500 |
commit | 2e89148c7545863d3d01498f0f0a43fe94c9b554 (patch) | |
tree | 4b904ae43873515737d98263b34ca852c08245bd | |
parent | 0226cedfd2717a960312ec5b2232afe298cecd36 (diff) | |
download | pango-2e89148c7545863d3d01498f0f0a43fe94c9b554.tar.gz |
Port test-break to simple layout
-rw-r--r-- | tests/test-break.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/tests/test-break.c b/tests/test-break.c index 127a3e71..570ba1a5 100644 --- a/tests/test-break.c +++ b/tests/test-break.c @@ -43,10 +43,8 @@ test_file (const gchar *filename, GString *string) gchar *contents; gsize length; GError *error = NULL; - PangoLogAttr *attrs; - const PangoLogAttr *attrs2; + const PangoLogAttr *attrs; int len; - int len2; char *p; int i; GString *s1, *s2, *s3, *s4, *s5, *s6; @@ -54,8 +52,7 @@ test_file (const gchar *filename, GString *string) char *test; char *text; PangoAttrList *attributes; - PangoLayout *layout; - PangoLayout *layout2; + PangoSimpleLayout *layout; g_file_get_contents (filename, &contents, &length, &error); g_assert_no_error (error); @@ -72,9 +69,9 @@ test_file (const gchar *filename, GString *string) pango_parse_markup (test, -1, 0, &attributes, &text, NULL, &error); g_assert_no_error (error); - layout = pango_layout_new (context); - pango_layout_set_text (layout, text, length); - pango_layout_set_attributes (layout, attributes); + layout = pango_simple_layout_new (context); + pango_simple_layout_set_text (layout, text, length); + pango_simple_layout_set_attributes (layout, attributes); #if 0 if (pango_layout_get_unknown_glyphs_count (layout) > 0) @@ -93,25 +90,14 @@ test_file (const gchar *filename, GString *string) } #endif - pango_layout_get_log_attrs (layout, &attrs, &len); - attrs2 = pango_layout_get_log_attrs_readonly (layout, &len2); + attrs = pango_simple_layout_get_log_attrs (layout, &len); - g_assert_cmpint (len, ==, len2); - g_assert_true (memcmp (attrs, attrs2, sizeof (PangoLogAttr) * len) == 0); if (!pango_validate_log_attrs (text, length, attrs, len, &error)) { g_warning ("%s: Log attrs invalid: %s", filename, error->message); // g_assert_not_reached (); } - layout2 = pango_layout_copy (layout); - attrs2 = pango_layout_get_log_attrs_readonly (layout2, &len2); - - g_assert_cmpint (len, ==, len2); - g_assert_true (memcmp (attrs, attrs2, sizeof (PangoLogAttr) * len) == 0); - - g_object_unref (layout2); - s1 = g_string_new ("Breaks: "); s2 = g_string_new ("Whitespace: "); s3 = g_string_new ("Sentences:"); @@ -291,7 +277,6 @@ test_file (const gchar *filename, GString *string) g_string_free (s6, TRUE); g_object_unref (layout); - g_free (attrs); g_free (contents); g_free (text); pango_attr_list_unref (attributes); |