msvcrt/tests: Test .{O|A}CP locale string.

Used by Marvel's Avengers.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2020-09-18 15:53:06 +02:00 committed by Alexandre Julliard
parent dc11755390
commit e6a42874a2
1 changed files with 23 additions and 0 deletions

View File

@ -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");