summaryrefslogtreecommitdiff
path: root/tests/testmisc.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-11-11 03:59:30 +0000
committerMatthias Clasen <mclasen@redhat.com>2021-11-11 03:59:30 +0000
commit907b6e21fcb846995cc5b03d2cb1b68fbbc2a2b5 (patch)
tree3a68163dde9e6008456756fd489185d02e7142f4 /tests/testmisc.c
parentffdc738e9057b9202dc889dd87829dcd90f4d87a (diff)
parent9a275af8c4cc950a8c277005c99b2282fdf00f79 (diff)
downloadpango-907b6e21fcb846995cc5b03d2cb1b68fbbc2a2b5.tar.gz
Merge branch 'fix-hyphen-width' into 'main'
layout: Fix a poblem with hyphen width See merge request GNOME/pango!500
Diffstat (limited to 'tests/testmisc.c')
-rw-r--r--tests/testmisc.c26
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 ();