diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-11-10 19:33:09 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-11-10 19:39:12 -0500 |
commit | ce4ee3e41cc40c7ec5678474daf7ef37ce65d87e (patch) | |
tree | 7329e766f4d24e05c7498560c01d9e124e3b3fae /tests | |
parent | c03ca7de6c6001251684f7a3a071b38b3d35317e (diff) | |
download | pango-ce4ee3e41cc40c7ec5678474daf7ef37ce65d87e.tar.gz |
Add a test for layout width
This checks behavior that is required by GTK.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testmisc.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/testmisc.c b/tests/testmisc.c index 355e8ed0..a91dcbb3 100644 --- a/tests/testmisc.c +++ b/tests/testmisc.c @@ -754,6 +754,31 @@ test_transform_rectangle (void) g_assert_cmpint (rect2.height, ==, rect.width); } +static void +test_wrap_char (void) +{ + PangoContext *context; + PangoLayout *layout; + int w, h, w0, h0; + + context = pango_font_map_create_context (pango_cairo_font_map_get_default ()); + layout = pango_layout_new (context); + pango_layout_set_text (layout, "Rows can have suffix widgets", -1); + pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR); + + pango_layout_set_width (layout, 0); + pango_layout_get_size (layout, &w0, &h0); + + pango_layout_set_width (layout, w0); + pango_layout_get_size (layout, &w, &h); + + g_assert_cmpint (w0, ==, w); + g_assert_cmpint (h0, >=, h); + + g_object_unref (layout); + g_object_unref (context); +} + int main (int argc, char *argv[]) { @@ -786,6 +811,7 @@ main (int argc, char *argv[]) g_test_add_func ("/layout/extents", test_extents); g_test_add_func ("/layout/empty-line-height", test_empty_line_height); g_test_add_func ("/layout/gravity-metrics", test_gravity_metrics); + g_test_add_func ("/layout/wrap-char", test_wrap_char); g_test_add_func ("/matrix/transform-rectangle", test_transform_rectangle); return g_test_run (); |