summaryrefslogtreecommitdiff
path: root/tests/test-ellipsize.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-11-03 12:30:21 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-11-03 12:30:21 +0000
commite9b44ac0959ea01b2248c887b9f3fecf22112f7e (patch)
tree2edc158603c3a6c4778a5788a5d8b315d8aff083 /tests/test-ellipsize.c
parent5b7b3684e18b636bce901688085226694d44adf4 (diff)
downloadpango-e9b44ac0959ea01b2248c887b9f3fecf22112f7e.tar.gz
Add a test for ellipsis shaping
Diffstat (limited to 'tests/test-ellipsize.c')
-rw-r--r--tests/test-ellipsize.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test-ellipsize.c b/tests/test-ellipsize.c
index 20819d0b..a9441d5a 100644
--- a/tests/test-ellipsize.c
+++ b/tests/test-ellipsize.c
@@ -78,6 +78,34 @@ test_ellipsize_crash (void)
g_object_unref (layout);
}
+/* Check that the width of a fully ellipsized paragraph
+ * is the same as that of an explicit ellipsis.
+ */
+static void
+test_ellipsize_fully (void)
+{
+ PangoLayout *layout;
+ PangoRectangle ink, logical;
+ PangoRectangle ink2, logical2;
+
+ layout = pango_layout_new (context);
+
+ pango_layout_set_text (layout, "…", -1);
+ pango_layout_get_extents (layout, &ink, &logical);
+
+ pango_layout_set_text (layout, "ellipsized", -1);
+
+ pango_layout_set_width (layout, 10 * PANGO_SCALE);
+ pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
+
+ pango_layout_get_extents (layout, &ink2, &logical2);
+
+ g_assert_cmpint (ink.width, ==, ink2.width);
+ g_assert_cmpint (logical.width, ==, logical2.width);
+
+ g_object_unref (layout);
+}
+
int
main (int argc, char *argv[])
{
@@ -90,6 +118,7 @@ main (int argc, char *argv[])
g_test_add_func ("/layout/ellipsize/height", test_ellipsize_height);
g_test_add_func ("/layout/ellipsize/crash", test_ellipsize_crash);
+ g_test_add_func ("/layout/ellipsize/fully", test_ellipsize_fully);
return g_test_run ();
}