[pango: 3/4] Test more font sizes in the empty line height test
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango: 3/4] Test more font sizes in the empty line height test
- Date: Fri, 26 Nov 2021 14:34:22 +0000 (UTC)
commit 8c51a367c7bcaf8c84f04ddee7651aedbfd8909b
Author: Sebastian Keller <skeller gnome org>
Date: Mon Nov 22 02:12:04 2021 +0100
Test more font sizes in the empty line height test
This would have caught the issue fixed in the previous commit, because
the default font choice of "serif 12" happened to not be affected by it.
Most other fonts or font sizes however were.
tests/testmisc.c | 38 ++++++++++++++++++++++++--------------
1 file changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/tests/testmisc.c b/tests/testmisc.c
index 555f0dce..1aa90948 100644
--- a/tests/testmisc.c
+++ b/tests/testmisc.c
@@ -634,9 +634,11 @@ test_empty_line_height (void)
{
PangoContext *context;
PangoLayout *layout;
+ PangoFontDescription *description;
PangoRectangle ext1, ext2, ext3;
cairo_font_options_t *options;
int hint;
+ int size;
if (strcmp (G_OBJECT_TYPE_NAME (pango_cairo_font_map_get_default ()), "PangoCairoCoreTextFontMap") == 0)
{
@@ -645,33 +647,41 @@ test_empty_line_height (void)
}
context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+ description = pango_font_description_new ();
- for (hint = CAIRO_HINT_METRICS_OFF; hint <= CAIRO_HINT_METRICS_ON; hint++)
+ for (size = 10; size <= 20; size++)
{
- options = cairo_font_options_create ();
- cairo_font_options_set_hint_metrics (options, hint);
- pango_cairo_context_set_font_options (context, options);
- cairo_font_options_destroy (options);
+ pango_font_description_set_size (description, size);
- layout = pango_layout_new (context);
+ for (hint = CAIRO_HINT_METRICS_OFF; hint <= CAIRO_HINT_METRICS_ON; hint++)
+ {
+ options = cairo_font_options_create ();
+ cairo_font_options_set_hint_metrics (options, hint);
+ pango_cairo_context_set_font_options (context, options);
+ cairo_font_options_destroy (options);
- pango_layout_get_extents (layout, NULL, &ext1);
+ layout = pango_layout_new (context);
+ pango_layout_set_font_description (layout, description);
- pango_layout_set_text (layout, "a", 1);
+ pango_layout_get_extents (layout, NULL, &ext1);
- pango_layout_get_extents (layout, NULL, &ext2);
+ pango_layout_set_text (layout, "a", 1);
- g_assert_cmpint (ext1.height, ==, ext2.height);
+ pango_layout_get_extents (layout, NULL, &ext2);
- pango_layout_set_text (layout, "Pg", 1);
+ g_assert_cmpint (ext1.height, ==, ext2.height);
- pango_layout_get_extents (layout, NULL, &ext3);
+ pango_layout_set_text (layout, "Pg", 1);
- g_assert_cmpint (ext2.height, ==, ext3.height);
+ pango_layout_get_extents (layout, NULL, &ext3);
- g_object_unref (layout);
+ g_assert_cmpint (ext2.height, ==, ext3.height);
+
+ g_object_unref (layout);
+ }
}
+ pango_font_description_free (description);
g_object_unref (context);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]