mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-27 20:52:12 +01:00
Merge branch 'wip/lantw/freebsd-gettext-tests' into 'master'
tests: Set both environment variable and locale when running tests See merge request GNOME/glib!69
This commit is contained in:
commit
379e8fd22d
@ -972,6 +972,8 @@ test_api (void)
|
|||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
g_setenv ("LC_ALL", "C", TRUE);
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
|
||||||
g_test_dbus_unset ();
|
g_test_dbus_unset ();
|
||||||
|
@ -1085,6 +1085,7 @@ int
|
|||||||
main (int argc,
|
main (int argc,
|
||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
|
g_setenv ("LC_ALL", "C", TRUE);
|
||||||
setlocale (LC_ALL, "C");
|
setlocale (LC_ALL, "C");
|
||||||
|
|
||||||
g_test_init (&argc, &argv, NULL);
|
g_test_init (&argc, &argv, NULL);
|
||||||
|
@ -741,15 +741,18 @@ test_l10n (void)
|
|||||||
|
|
||||||
settings = g_settings_new ("org.gtk.test.localized");
|
settings = g_settings_new ("org.gtk.test.localized");
|
||||||
|
|
||||||
|
g_setenv ("LC_MESSAGES", "C", TRUE);
|
||||||
setlocale (LC_MESSAGES, "C");
|
setlocale (LC_MESSAGES, "C");
|
||||||
str = g_settings_get_string (settings, "error-message");
|
str = g_settings_get_string (settings, "error-message");
|
||||||
|
g_setenv ("LC_MESSAGES", locale, TRUE);
|
||||||
setlocale (LC_MESSAGES, locale);
|
setlocale (LC_MESSAGES, locale);
|
||||||
|
|
||||||
g_assert_cmpstr (str, ==, "Unnamed");
|
g_assert_cmpstr (str, ==, "Unnamed");
|
||||||
g_free (str);
|
g_free (str);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
|
|
||||||
setlocale (LC_MESSAGES, "de_DE");
|
g_setenv ("LC_MESSAGES", "de_DE.UTF-8", TRUE);
|
||||||
|
setlocale (LC_MESSAGES, "de_DE.UTF-8");
|
||||||
/* Only do the test if translation is actually working... */
|
/* Only do the test if translation is actually working... */
|
||||||
if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\""))
|
if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\""))
|
||||||
{
|
{
|
||||||
@ -762,6 +765,7 @@ test_l10n (void)
|
|||||||
else
|
else
|
||||||
g_printerr ("warning: translation is not working... skipping test. ");
|
g_printerr ("warning: translation is not working... skipping test. ");
|
||||||
|
|
||||||
|
g_setenv ("LC_MESSAGES", locale, TRUE);
|
||||||
setlocale (LC_MESSAGES, locale);
|
setlocale (LC_MESSAGES, locale);
|
||||||
g_free (locale);
|
g_free (locale);
|
||||||
g_object_unref (settings);
|
g_object_unref (settings);
|
||||||
@ -788,15 +792,18 @@ test_l10n_context (void)
|
|||||||
|
|
||||||
settings = g_settings_new ("org.gtk.test.localized");
|
settings = g_settings_new ("org.gtk.test.localized");
|
||||||
|
|
||||||
|
g_setenv ("LC_MESSAGES", "C", TRUE);
|
||||||
setlocale (LC_MESSAGES, "C");
|
setlocale (LC_MESSAGES, "C");
|
||||||
g_settings_get (settings, "backspace", "s", &str);
|
g_settings_get (settings, "backspace", "s", &str);
|
||||||
|
g_setenv ("LC_MESSAGES", locale, TRUE);
|
||||||
setlocale (LC_MESSAGES, locale);
|
setlocale (LC_MESSAGES, locale);
|
||||||
|
|
||||||
g_assert_cmpstr (str, ==, "BackSpace");
|
g_assert_cmpstr (str, ==, "BackSpace");
|
||||||
g_free (str);
|
g_free (str);
|
||||||
str = NULL;
|
str = NULL;
|
||||||
|
|
||||||
setlocale (LC_MESSAGES, "de_DE");
|
g_setenv ("LC_MESSAGES", "de_DE.UTF-8", TRUE);
|
||||||
|
setlocale (LC_MESSAGES, "de_DE.UTF-8");
|
||||||
/* Only do the test if translation is actually working... */
|
/* Only do the test if translation is actually working... */
|
||||||
if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\""))
|
if (g_str_equal (dgettext ("test", "\"Unnamed\""), "\"Unbenannt\""))
|
||||||
{
|
{
|
||||||
@ -809,6 +816,7 @@ test_l10n_context (void)
|
|||||||
else
|
else
|
||||||
g_printerr ("warning: translation is not working... skipping test. ");
|
g_printerr ("warning: translation is not working... skipping test. ");
|
||||||
|
|
||||||
|
g_setenv ("LC_MESSAGES", locale, TRUE);
|
||||||
setlocale (LC_MESSAGES, locale);
|
setlocale (LC_MESSAGES, locale);
|
||||||
g_free (locale);
|
g_free (locale);
|
||||||
g_object_unref (settings);
|
g_object_unref (settings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user