Paul Gofman : msvcrt/tests: Test .{O|A}CP locale string.
Alexandre Julliard
julliard at winehq.org
Fri Sep 18 15:52:50 CDT 2020
Module: wine
Branch: master
Commit: e6a42874a2bf345c41f94a5c78c5b81510e667d3
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e6a42874a2bf345c41f94a5c78c5b81510e667d3
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Fri Sep 18 15:53:06 2020 +0200
msvcrt/tests: Test .{O|A}CP locale string.
Used by Marvel's Avengers.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/tests/locale.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/dlls/msvcrt/tests/locale.c b/dlls/msvcrt/tests/locale.c
index 08abac00be..e0bafe3a0d 100644
--- a/dlls/msvcrt/tests/locale.c
+++ b/dlls/msvcrt/tests/locale.c
@@ -45,6 +45,8 @@ static void test_setlocale(void)
"LC_MONETARY=Greek_Greece.1253;LC_NUMERIC=Polish_Poland.1250;LC_TIME=C";
char *ret, buf[100];
+ char *ptr;
+ int len;
ret = setlocale(20, "C");
ok(ret == NULL, "ret = %s\n", ret);
@@ -612,6 +614,27 @@ static void test_setlocale(void)
ok(!strcmp(ret, buf), "ret = %s, expected %s\n", ret, buf);
}
+ GetLocaleInfoA(GetUserDefaultLCID(), LOCALE_IDEFAULTCODEPAGE, buf, sizeof(buf));
+ if(IsValidCodePage(atoi(buf))) {
+ ret = setlocale(LC_ALL, ".OCP");
+ ok(ret != NULL, "ret == NULL\n");
+ ptr = strchr(ret, '.');
+ ok(ptr && !strcmp(ptr + 1, buf), "ret %s, buf %s.\n", ret, buf);
+ }
+
+ len = GetLocaleInfoA(GetUserDefaultLCID(), LOCALE_IDEFAULTANSICODEPAGE, buf, sizeof(buf)) - 1;
+ if(buf[0] == '0' && !buf[1])
+ len = sprintf(buf, "%d", GetACP());
+ ret = setlocale(LC_ALL, ".ACP");
+ ok(ret != NULL, "ret == NULL\n");
+ ptr = strchr(ret, '.');
+ ok(ptr && !strncmp(ptr + 1, buf, len), "ret %s, buf %s.\n", ret, buf);
+
+ ret = setlocale(LC_ALL, ".1250");
+ ok(ret != NULL, "ret == NULL\n");
+ ptr = strchr(ret, '.');
+ ok(ptr && !strcmp(ptr, ".1250"), "ret %s, buf %s.\n", ret, buf);
+
ret = setlocale(LC_ALL, "English_United States.UTF8");
ok(ret == NULL, "ret != NULL\n");
More information about the wine-cvs
mailing list