diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-01-23 20:20:45 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-01-23 20:20:45 -0500 |
commit | 757489cc0298846a0b398d135ff5de81d18ced3f (patch) | |
tree | c1f859c2739b5a3a065247b2ecf8ae86fb1dc4ec /tests | |
parent | 7ac8f4890b104f166e2e00d61924ae1deaed1313 (diff) | |
download | pango-757489cc0298846a0b398d135ff5de81d18ced3f.tar.gz |
tests: Avoid locale dependencyfix-test-output
When producing output, use the C locale for formatting
floating point numbers, to avoid locale dependent output.
Fixes: #474
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-common.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/test-common.c b/tests/test-common.c index 60ecb7e1..514058cc 100644 --- a/tests/test-common.c +++ b/tests/test-common.c @@ -97,11 +97,11 @@ print_attribute (PangoAttribute *attr, GString *string) switch (attr->klass->type) { case PANGO_ATTR_LANGUAGE: - g_string_append_printf (string, "%s", pango_language_to_string (((PangoAttrLanguage *)attr)->value)); + g_string_append (string, pango_language_to_string (((PangoAttrLanguage *)attr)->value)); break; case PANGO_ATTR_FAMILY: case PANGO_ATTR_FONT_FEATURES: - g_string_append_printf (string, "%s", ((PangoAttrString *)attr)->value); + g_string_append (string, ((PangoAttrString *)attr)->value); break; case PANGO_ATTR_STYLE: case PANGO_ATTR_WEIGHT: @@ -127,7 +127,7 @@ print_attribute (PangoAttribute *attr, GString *string) case PANGO_ATTR_FONT_DESC: { char *text = pango_font_description_to_string (((PangoAttrFontDesc *)attr)->desc); - g_string_append_printf (string, "%s", text); + g_string_append (string, text); g_free (text); } break; @@ -138,7 +138,7 @@ print_attribute (PangoAttribute *attr, GString *string) case PANGO_ATTR_STRIKETHROUGH_COLOR: { char *text = pango_color_to_string (&((PangoAttrColor *)attr)->color); - g_string_append_printf (string, "%s", text); + g_string_append (string, text); g_free (text); } break; @@ -146,7 +146,12 @@ print_attribute (PangoAttribute *attr, GString *string) g_string_append_printf (string, "shape"); break; case PANGO_ATTR_SCALE: - g_string_append_printf (string,"%f", ((PangoAttrFloat *)attr)->value); + { + char val[20]; + + g_ascii_formatd (val, 20, "%f", ((PangoAttrFloat *)attr)->value); + g_string_append (string, val); + } break; default: g_assert_not_reached (); |