Commit 8d0b3b08 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll/tests: Add tests for high Unicode planes.

parent d2c22552
......@@ -342,7 +342,7 @@ static void test_RtlQueryRegistryValues(void)
static void test_NtOpenKey(void)
{
HANDLE key;
HANDLE key, subkey;
NTSTATUS status;
OBJECT_ATTRIBUTES attr;
ACCESS_MASK am = KEY_READ;
......@@ -456,6 +456,27 @@ static void test_NtOpenKey(void)
ok( status == STATUS_OBJECT_TYPE_MISMATCH, "NtOpenKey failed: 0x%08lx\n", status );
pRtlFreeUnicodeString( &str );
InitializeObjectAttributes(&attr, &winetestpath, 0, 0, 0);
status = pNtOpenKey(&key, KEY_WRITE|KEY_READ, &attr);
ok(status == STATUS_SUCCESS, "NtOpenKey failed: 0x%08lx\n", status);
/* keys are case insensitive even without OBJ_CASE_INSENSITIVE */
InitializeObjectAttributes( &attr, &str, 0, key, 0 );
pRtlInitUnicodeString( &str, L"\xf6\xf3\x14d\x371\xd801\xdc00" );
status = pNtCreateKey( &subkey, KEY_ALL_ACCESS, &attr, 0, 0, 0, 0);
ok(status == STATUS_SUCCESS, "NtCreateKey failed: 0x%08lx\n", status);
pNtClose( subkey );
pRtlInitUnicodeString( &str, L"\xd6\xd3\x14c\x370\xd801\xdc28" ); /* surrogates not supported */
status = pNtOpenKeyEx(&subkey, KEY_ALL_ACCESS, &attr, 0);
ok(status == STATUS_OBJECT_NAME_NOT_FOUND, "NtOpenKeyEx failed: 0x%08lx\n", status);
pRtlInitUnicodeString( &str, L"\xd6\xd3\x14c\x370\xd801\xdc00" );
status = pNtOpenKeyEx(&subkey, KEY_ALL_ACCESS, &attr, 0);
ok(status == STATUS_SUCCESS, "NtOpenKeyEx failed: 0x%08lx\n", status);
pNtDeleteKey( subkey );
pNtClose( subkey );
pNtClose( key );
if (!pNtOpenKeyEx)
{
win_skip("NtOpenKeyEx not available\n");
......
......@@ -608,7 +608,7 @@ static void test_RtlUpcaseUnicodeChar(void)
static void test_RtlUpcaseUnicodeString(void)
{
int i;
int i, j;
WCHAR ch;
WCHAR upper_ch;
WCHAR ascii_buf[257];
......@@ -654,6 +654,25 @@ static void test_RtlUpcaseUnicodeString(void)
result_str.Buffer[i], result_str.Buffer[i],
upper_str.Buffer[i], upper_str.Buffer[i]);
}
/* test surrogates */
for (i = 0x100; i < 0x1100; i++)
{
WCHAR src[512], dst[512];
for (j = 0; j < 256; j++)
{
unsigned int ch = ((i << 8) + j) - 0x10000;
src[2 * j] = 0xd800 | (ch >> 10);
src[2 * j + 1] = 0xdc00 | (ch & 0x3ff);
}
upper_str.Length = upper_str.MaximumLength = 512 * sizeof(WCHAR);
upper_str.Buffer = src;
result_str.Length = result_str.MaximumLength = 512 * sizeof(WCHAR);
result_str.Buffer = dst;
pRtlUpcaseUnicodeString(&result_str, &upper_str, 0);
ok( !memcmp(src, dst, sizeof(dst)),
"string compare mismatch in %04x-%04x\n", i << 8, (i << 8) + 255 );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment