kernel32/tests: Add a test for undefined byte character conversion.
This commit is contained in:
parent
5c57185060
commit
79d7cd76f9
|
@ -354,6 +354,57 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar)
|
||||||
ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError());
|
ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_undefined_byte_char(void)
|
||||||
|
{
|
||||||
|
struct tag_testset {
|
||||||
|
INT codepage;
|
||||||
|
LPCSTR str;
|
||||||
|
BOOL is_error;
|
||||||
|
} testset[] = {
|
||||||
|
{ 874, "\xdd", TRUE },
|
||||||
|
{ 932, "\xfe", TRUE },
|
||||||
|
{ 932, "\x80", FALSE },
|
||||||
|
{ 936, "\xff", TRUE },
|
||||||
|
{ 949, "\xff", TRUE },
|
||||||
|
{ 950, "\xff", TRUE },
|
||||||
|
{ 1252, "\x90", FALSE },
|
||||||
|
{ 1253, "\xaa", TRUE },
|
||||||
|
{ 1255, "\xff", TRUE },
|
||||||
|
{ 1257, "\xa5", TRUE },
|
||||||
|
};
|
||||||
|
INT i, ret;
|
||||||
|
|
||||||
|
for (i = 0; i < (sizeof(testset) / sizeof(testset[0])); i++) {
|
||||||
|
if (! IsValidCodePage(testset[i].codepage))
|
||||||
|
{
|
||||||
|
skip("Codepage %d not available\n", testset[i].codepage);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = MultiByteToWideChar(testset[i].codepage, MB_ERR_INVALID_CHARS,
|
||||||
|
testset[i].str, -1, NULL, 0);
|
||||||
|
if (testset[i].is_error) {
|
||||||
|
todo_wine
|
||||||
|
ok(ret == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION,
|
||||||
|
"ret is %d, GetLastError is %u (cp %d)\n",
|
||||||
|
ret, GetLastError(), testset[i].codepage);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ok(ret == strlen(testset[i].str)+1 && GetLastError() == 0xdeadbeef,
|
||||||
|
"ret is %d, GetLastError is %u (cp %d)\n",
|
||||||
|
ret, GetLastError(), testset[i].codepage);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = MultiByteToWideChar(testset[i].codepage, 0,
|
||||||
|
testset[i].str, -1, NULL, 0);
|
||||||
|
ok(ret == strlen(testset[i].str)+1 && GetLastError() == 0xdeadbeef,
|
||||||
|
"ret is %d, GetLastError is %u (cp %d)\n",
|
||||||
|
ret, GetLastError(), testset[i].codepage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(codepage)
|
START_TEST(codepage)
|
||||||
{
|
{
|
||||||
BOOL bUsedDefaultChar;
|
BOOL bUsedDefaultChar;
|
||||||
|
@ -367,4 +418,6 @@ START_TEST(codepage)
|
||||||
/* WideCharToMultiByte has two code paths, test both here */
|
/* WideCharToMultiByte has two code paths, test both here */
|
||||||
test_string_conversion(NULL);
|
test_string_conversion(NULL);
|
||||||
test_string_conversion(&bUsedDefaultChar);
|
test_string_conversion(&bUsedDefaultChar);
|
||||||
|
|
||||||
|
test_undefined_byte_char();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue