diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-07-09 19:11:01 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-07-09 19:11:01 +0000 |
commit | 4ecec6eff40a8ed3c6e3d5acbbdc01d00311668b (patch) | |
tree | 7594f164ba7f3d1b560f06bdc0cca0df7a173ee6 /tests/test-common.c | |
parent | cf7d2330339e54897ec1dd852bfead6ba023eb96 (diff) | |
parent | 7f0519b732369921f31a502784e89f9cf2a9b1c7 (diff) | |
download | pango-4ecec6eff40a8ed3c6e3d5acbbdc01d00311668b.tar.gz |
Merge branch 'matthiasc/for-master' into 'master'
win32: Don't export private symbol
See merge request GNOME/pango!369
Diffstat (limited to 'tests/test-common.c')
-rw-r--r-- | tests/test-common.c | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/tests/test-common.c b/tests/test-common.c index 3b8880e3..14e9941a 100644 --- a/tests/test-common.c +++ b/tests/test-common.c @@ -220,7 +220,9 @@ print_attributes (GSList *attrs, GString *string) } } -static PangoAttribute * +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +PangoAttribute * attribute_from_string (const char *string) { char *s, *p; @@ -229,6 +231,7 @@ attribute_from_string (const char *string) GEnumClass *class; int i; PangoColor color; + int val; s = string; g_assert (*s == '['); @@ -278,16 +281,32 @@ attribute_from_string (const char *string) attr = pango_attr_font_features_new (s); break; case PANGO_ATTR_STYLE: - attr = pango_attr_style_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_STYLE, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_style_new (val); + } break; case PANGO_ATTR_WEIGHT: - attr = pango_attr_weight_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_WEIGHT, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_weight_new (val); + } break; case PANGO_ATTR_VARIANT: - attr = pango_attr_variant_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_VARIANT, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_variant_new (val); + } break; case PANGO_ATTR_STRETCH: - attr = pango_attr_stretch_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_STRETCH, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_stretch_new (val); + } break; case PANGO_ATTR_SIZE: attr = pango_attr_size_new (strtol (s, &p, 10)); @@ -296,10 +315,18 @@ attribute_from_string (const char *string) attr = pango_attr_size_new_absolute (strtol (s, &p, 10)); break; case PANGO_ATTR_UNDERLINE: - attr = pango_attr_underline_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_UNDERLINE, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_underline_new (val); + } break; case PANGO_ATTR_OVERLINE: - attr = pango_attr_overline_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_OVERLINE, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_overline_new (val); + } break; case PANGO_ATTR_STRIKETHROUGH: attr = pango_attr_strikethrough_new (strtol (s, &p, 10)); @@ -314,10 +341,18 @@ attribute_from_string (const char *string) attr = pango_attr_letter_spacing_new (strtol (s, &p, 10)); break; case PANGO_ATTR_GRAVITY: - attr = pango_attr_gravity_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_GRAVITY, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_gravity_new (val); + } break; case PANGO_ATTR_GRAVITY_HINT: - attr = pango_attr_gravity_hint_new (strtol (s, &p, 10)); + { + if (!pango_parse_enum (PANGO_TYPE_GRAVITY_HINT, s, &val, FALSE, NULL)) + val = strtol (s, &p, 10); + attr = pango_attr_gravity_hint_new (val); + } break; case PANGO_ATTR_FOREGROUND_ALPHA: attr = pango_attr_foreground_alpha_new (strtol (s, &p, 10)); @@ -393,6 +428,8 @@ attribute_from_string (const char *string) return attr; } +G_GNUC_END_IGNORE_DEPRECATIONS + PangoAttrList * attributes_from_string (const char *string) { |