[glib] glib/tests/date.c: Fix the tests on non-English Windows
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] glib/tests/date.c: Fix the tests on non-English Windows
- Date: Tue, 7 Jan 2014 05:36:47 +0000 (UTC)
commit 8bb81e7024db1f3e88cde20459ed62981cf372af
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Sat Jan 4 10:52:15 2014 +0800
glib/tests/date.c: Fix the tests on non-English Windows
The names of the month (and abbreviations) are specific to the Windows
system locale, so we need to use SetThreadLocale() to set the locale of
the running program to en-US so that it will parse "March" and "Sept" etc.
correctly.
https://bugzilla.gnome.org/show_bug.cgi?id=719344
glib/tests/date.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/date.c b/glib/tests/date.c
index 0d674c9..6239d51 100644
--- a/glib/tests/date.c
+++ b/glib/tests/date.c
@@ -12,6 +12,11 @@
#include <locale.h>
#include <time.h>
+#ifdef G_OS_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
static void
test_basic (void)
{
@@ -376,6 +381,9 @@ main (int argc, char** argv)
g_setenv ("LANG", "en_US.utf-8", TRUE);
setlocale (LC_ALL, "");
+#ifdef G_OS_WIN32
+ SetThreadLocale (MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT));
+#endif
g_test_init (&argc, &argv, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]