mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-08 02:16:17 +01:00
glib/tests: set Polish ThreadLocale on win32 to fix a test
Fixes /date/month_substring Bail out! GLib:ERROR:../glib/tests/date.c:1090:test_month_substring: 'g_date_valid (&date)' should be TRUE Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
051d000acd
commit
f7c66423a4
@ -1084,6 +1084,9 @@ static void
|
||||
test_month_substring (void)
|
||||
{
|
||||
GDate date;
|
||||
#ifdef G_OS_WIN32
|
||||
LCID old_lcid;
|
||||
#endif
|
||||
|
||||
g_test_bug ("https://bugzilla.gnome.org/show_bug.cgi?id=793550");
|
||||
|
||||
@ -1093,6 +1096,13 @@ test_month_substring (void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
/* after the crt, set also the win32 thread locale: */
|
||||
/* https://www.codeproject.com/Articles/9600/Windows-SetThreadLocale-and-CRT-setlocale */
|
||||
old_lcid = GetThreadLocale ();
|
||||
SetThreadLocale (MAKELCID (MAKELANGID (LANG_POLISH, SUBLANG_POLISH_POLAND), SORT_DEFAULT));
|
||||
#endif
|
||||
|
||||
/* In Polish language September is "wrzesień" and August is "sierpień"
|
||||
* abbreviated as "sie". The former used to be confused with the latter
|
||||
* because "sie" is a substring of "wrzesień" and was matched first. */
|
||||
@ -1109,6 +1119,9 @@ test_month_substring (void)
|
||||
g_assert_true (g_date_valid (&date));
|
||||
g_assert_cmpint (g_date_get_month (&date), ==, G_DATE_AUGUST);
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
SetThreadLocale (old_lcid);
|
||||
#endif
|
||||
setlocale (LC_ALL, "");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user