summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-01-23 20:20:45 -0500
committerMatthias Clasen <mclasen@redhat.com>2021-01-23 20:20:45 -0500
commit757489cc0298846a0b398d135ff5de81d18ced3f (patch)
treec1f859c2739b5a3a065247b2ecf8ae86fb1dc4ec
parent7ac8f4890b104f166e2e00d61924ae1deaed1313 (diff)
downloadpango-fix-test-output.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
-rw-r--r--tests/test-common.c15
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 ();