Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/kernel32/tests/locale.c | 182 +++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+)
diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 9ed8fb82e2..7deb82c92b 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -2708,6 +2708,187 @@ static INT LCMapStringEx_wrapper(DWORD flags, LPCWSTR src, INT srclen, LPWSTR ds return pLCMapStringEx(LOCALE_NAME_USER_DEFAULT, flags, src, srclen, dst, dstlen, NULL, NULL, 0); }
+BYTE sortkey_results_win7_default[] = { 14, 2, 14, 9, 14, 10, 170, 133, 2, 14, 2, 1, 2, 2, 2, 14, 1, 2, 2, 2, 2, 18, 1, 1, 0 }; +BYTE sortkey_results_win7_type1[] = { 1, 214, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_symbols1[] = { 14, 2, 14, 9, 7, 47, 8, 28, 9, 56, 10, 130, 11, 57, 12, 165, 14, 167, 14, 169, 1, 2, 2, 2, 21, 102, 2, 21, 1, 2, 2, 3, 1, 1, 0 }; +BYTE sortkey_results_win7_symbols2[] = { 14, 2, 14, 9, 14, 167, 14, 169, 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_punctuation1[] = { 14, 2, 14, 9, 14, 167, 14, 169, 1, 1, 1, 1, 255, 253, 131, 20, 255, 253, 132, 170, 0 }; +BYTE sortkey_results_win7_punctuation2[] = { 14, 2, 14, 9, 6, 131, 6, 132, 14, 167, 14, 169, 1, 2, 2, 2, 21, 1, 2, 2, 4, 1, 1, 0 }; +BYTE sortkey_results_win7_punctuation3[] = { 14, 2, 14, 9, 14, 167, 14, 169, 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_type5[] = { 253, 255, 168, 110, 16, 201, 14, 2, 1, 2, 68, 1, 2, 18, 18, 1, 1, 0 }; +BYTE sortkey_results_win7_jamo[] = { 220, 63, 16, 201, 14, 2, 1, 2, 68, 1, 4, 18, 18, 1, 1, 0 }; +BYTE sortkey_results_win7_japanese1[] = { 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 14, 2, 16, 201, 14, 2, 1, 2, 2, 2, 2, 2, 2, 238, 2, 68, 1, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 1, 196, 196, 198, 198, 196, 255, 2, 196, 196, 196, 196, 228, 228, 196, 255, 196, 197, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese2[] = { 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 14, 2, 16, 201, 14, 2, 1, 2, 2, 2, 2, 2, 2, 238, 2, 68, 1, 1, 196, 196, 198, 198, 196, 255, 2, 196, 196, 196, 196, 228, 228, 196, 255, 196, 197, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese3[] = { 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 14, 2, 16, 201, 14, 2, 1, 2, 2, 2, 2, 2, 2, 238, 2, 68, 1, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 1, 196, 196, 198, 198, 196, 255, 2, 196, 196, 196, 196, 228, 228, 196, 255, 196, 196, 196, 196, 196, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese4[] = { 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 14, 2, 16, 201, 14, 2, 1, 2, 2, 2, 2, 2, 2, 238, 2, 68, 1, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 1, 196, 196, 198, 198, 196, 255, 2, 196, 196, 196, 196, 196, 196, 196, 255, 196, 197, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese5[] = { 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 34, 62, 14, 2, 16, 201, 14, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 18, 18, 18, 1, 255, 2, 196, 196, 196, 196, 196, 196, 196, 255, 196, 196, 196, 196, 196, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special1[] = { 255, 255, 255, 255, 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_japanese_special2[] = { 34, 2, 34, 2, 1, 1, 1, 196, 196, 255, 3, 5, 2, 196, 196, 255, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special3[] = { 34, 2, 34, 2, 1, 1, 1, 196, 196, 255, 3, 5, 2, 196, 196, 255, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special4[] = { 34, 2, 14, 2, 14, 2, 1, 1, 1, 196, 255, 2, 196, 255, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special5[] = { 255, 255, 14, 2, 34, 2, 34, 2, 1, 1, 1, 196, 196, 255, 3, 5, 2, 196, 196, 255, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special6[] = { 34, 2, 14, 2, 14, 2, 14, 2, 34, 2, 34, 2, 1, 1, 1, 196, 196, 196, 255, 3, 3, 5, 2, 196, 196, 196, 255, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special7[] = { 34, 2, 34, 2, 34, 2, 1, 1, 1, 196, 196, 196, 255, 3, 5, 5, 2, 196, 196, 196, 255, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special8[] = { 34, 2, 14, 2, 14, 2, 14, 2, 14, 2, 14, 2, 34, 2, 34, 2, 1, 1, 1, 196, 196, 196, 255, 3, 3, 5, 2, 196, 196, 196, 255, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special9[] = { 34, 2, 34, 2, 34, 2, 1, 1, 1, 196, 196, 196, 255, 3, 5, 2, 196, 196, 196, 255, 196, 197, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special10[] = { 34, 2, 14, 2, 34, 2, 34, 2, 1, 1, 1, 196, 196, 196, 255, 3, 3, 5, 2, 196, 196, 196, 255, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special11[] = { 34, 2, 14, 2, 34, 2, 34, 2, 14, 2, 14, 2, 1, 1, 1, 196, 196, 196, 255, 3, 3, 5, 2, 196, 196, 196, 255, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special12[] = { 34, 13, 34, 5, 1, 1, 1, 255, 3, 5, 2, 196, 196, 255, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special13[] = { 34, 74, 34, 74, 1, 1, 1, 255, 2, 196, 196, 255, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special14[] = { 34, 58, 34, 58, 1, 1, 1, 196, 196, 255, 3, 4, 2, 196, 196, 255, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special15[] = { 14, 2, 14, 2, 14, 2, 34, 2, 34, 2, 34, 2, 14, 2, 13, 3, 13, 25, 13, 29, 14, 2, 13, 3, 13, 25, 13, 29, 13, 29, 13, 29, 14, 2, 34, 2, 34, 2, 1, 2, 2, 2, 2, 2, 7, 1, 1, 196, 196, 196, 196, 196, 255, 3, 3, 4, 3, 5, 2, 196, 196, 196, 196, 196, 255, 196, 196, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special16[] = { 34, 44, 14, 53, 14, 53, 34, 74, 34, 52, 34, 52, 34, 52, 14, 9, 34, 78, 34, 50, 14, 138, 14, 138, 14, 145, 34, 78, 34, 6, 34, 6, 14, 112, 34, 6, 34, 38, 14, 159, 1, 238, 2, 7, 2, 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 5, 2, 2, 238, 1, 1, 198, 198, 196, 196, 196, 255, 3, 3, 3, 4, 4, 3, 3, 3, 3, 4, 2, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 255, 197, 196, 197, 197, 197, 197, 196, 197, 196, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special17[] = { 34, 44, 14, 53, 14, 53, 34, 74, 34, 52, 34, 52, 34, 52, 14, 9, 34, 78, 34, 50, 14, 138, 14, 138, 14, 145, 34, 78, 34, 6, 34, 6, 14, 112, 34, 6, 34, 38, 14, 159, 1, 1, 1, 255, 2, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 255, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_missing_characters[] = { 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_expansion1[] = { 14, 2, 14, 33, 1, 1, 18, 18, 1, 1, 0 }; +BYTE sortkey_results_win7_compatibility1[] = { 1, 12, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_expansion2[] = { 14, 2, 7, 83, 1, 0, 41, 110, 41, 167, 41, 212, 1, 14, 2, 12, 1, 2, 2, 0, 2, 2, 5, 1, 1, 0 }; +BYTE sortkey_results_win7_null_character[] = { 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_japanese_special_with_missing_characters1[] = { 253, 255, 128, 119, 5, 128, 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_japanese_special_with_expansion1[] = { 253, 255, 128, 119, 41, 32, 41, 65, 255, 255, 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_japanese_special_with_unsortable[] = { 34, 2, 34, 2, 1, 1, 1, 196, 196, 255, 3, 5, 2, 196, 196, 255, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special_with_missing_characters2[] = { 34, 2, 34, 2, 1, 1, 1, 196, 196, 255, 3, 5, 2, 196, 196, 255, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_japanese_special_with_expansion2[] = { 34, 2, 14, 2, 14, 33, 255, 255, 1, 1, 2, 18, 18, 1, 196, 255, 2, 196, 255, 196, 255, 1, 0 }; +BYTE sortkey_results_win7_punctuation_with_cjk[] = { 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 171, 122, 132, 1, 1, 1, 1, 255, 236, 25, 18, 0 }; +BYTE sortkey_results_win7_compatibility_to_expansion[] = { 7, 83, 1, 0, 1, 2, 12, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_compatibility2[] = { 41, 68, 253, 255, 77, 101, 181, 251, 1, 2, 2, 63, 1, 2, 2, 63, 1, 1, 0 }; +BYTE sortkey_results_win7_compatibility3[] = { 253, 255, 63, 216, 5, 63, 8, 227, 1, 1, 1, 1, 0 }; +BYTE sortkey_results_win7_japanese_special_type1[] = { 34, 60, 34, 60, 1, 42, 5, 1, 1, 255, 3, 4, 2, 196, 196, 255, 255, 1, 0 }; +BYTE sortkey_results_win7_language_jap1[] = { 176, 55, 253, 255, 85, 45, 208, 223, 1, 63, 1, 63, 1, 1, 0 }; + +#define run_sortkey_test(locale, str, result, flags) \ + _run_sortkey_test(locale, str, ARRAY_SIZE(str), result, ARRAY_SIZE(result), flags, __FILE__, __LINE__) + +static void _run_sortkey_test(unsigned int locale, const WCHAR* str, int str_len, BYTE* result, int result_len, int flags, const char* file, int line) +{ + int i; + BYTE buffer[1000]; + int test_len = LCMapStringW(locale, 0x00000400 | flags /* LCMAP_SORTKEY */, str, -1, (void *)buffer, sizeof(buffer)); + int difference = -1; + for (i = 0; i < result_len && i < test_len; i++) + { + if (buffer[i] != result[i]) + { + difference = i; + break; + } + } + ok_(file, line)(difference == -1, "Difference at %d\n", difference); +} + +static void test_LCMapString_sortkey(void) +{ + OSVERSIONINFOA osversion; + + osversion.dwOSVersionInfoSize = sizeof(osversion); + GetVersionExA(&osversion); + + if (broken(osversion.dwMajorVersion != 6 || osversion.dwMinorVersion != 1)) + { + skip("Unicode sorting table tests only implemented for win7. Current version is %d.%d\n", osversion.dwMajorVersion, osversion.dwMinorVersion); + return; + } + + /* Tests against the Win7 sorting tables */ + + /* en-US */ + todo_wine + run_sortkey_test(0x0409, L"abc\ue604\u00c1", sortkey_results_win7_default, 0); /* Default case */ + todo_wine + run_sortkey_test(0x0409, L"\u02f4\u02f4\u02f4", sortkey_results_win7_type1, 0); /* Type 1 */ + todo_wine + run_sortkey_test(0x0409, L"ab\uff0c\u2a74\u2364\u265f\u29d8\u2ff3yz", sortkey_results_win7_symbols1, 0); /* Symbols */ + todo_wine + run_sortkey_test(0x0409, L"ab\uff0c\u2a74\u2364\u265f\u29d8\u2ff3yz", sortkey_results_win7_symbols2, NORM_IGNORESYMBOLS); /* Symbols */ + todo_wine + run_sortkey_test(0x0409, L"ab\u208b\u058ayz", sortkey_results_win7_punctuation1, 0); /* Punctuation */ + todo_wine + run_sortkey_test(0x0409, L"ab\u208b\u058ayz", sortkey_results_win7_punctuation2, SORT_STRINGSORT); /* Punctuation */ + todo_wine + run_sortkey_test(0x0409, L"ab\u208b\u058ayz", sortkey_results_win7_punctuation3, NORM_IGNORESYMBOLS); /* Punctuation */ + todo_wine + run_sortkey_test(0x0409, L"\u4d3a\u0476A", sortkey_results_win7_type5, 0); /* Type 5 */ + todo_wine + run_sortkey_test(0x0409, L"\u11ee\u0476A", sortkey_results_win7_jamo, 0); /* Jamo */ + todo_wine + run_sortkey_test(0x0409, L"\uff6e\u30e7\uff96\u30e8\u3087\u3088\u32f5A\u0476A", sortkey_results_win7_japanese1, 0); /* Japanese */ + todo_wine + run_sortkey_test(0x0409, L"\uff6e\u30e7\uff96\u30e8\u3087\u3088\u32f5A\u0476A", sortkey_results_win7_japanese2, NORM_IGNORECASE); /* Japanese */ + todo_wine + run_sortkey_test(0x0409, L"\uff6e\u30e7\uff96\u30e8\u3087\u3088\u32f5A\u0476A", sortkey_results_win7_japanese3, NORM_IGNOREWIDTH); /* Japanese */ + todo_wine + run_sortkey_test(0x0409, L"\uff6e\u30e7\uff96\u30e8\u3087\u3088\u32f5A\u0476A", sortkey_results_win7_japanese4, NORM_IGNOREKANATYPE); /* Japanese */ + todo_wine + run_sortkey_test(0x0409, L"\uff6e\u30e7\uff96\u30e8\u3087\u3088\u32f5A\u0476A", sortkey_results_win7_japanese5, NORM_IGNORENONSPACE | NORM_IGNOREWIDTH | NORM_IGNOREKANATYPE); /* Japanese */ + todo_wine + run_sortkey_test(0x0409, L"\u30fc\u30fc", sortkey_results_win7_japanese_special1, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67\u30fc", sortkey_results_win7_japanese_special2, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67\u30fc", sortkey_results_win7_japanese_special3, NORM_IGNOREWIDTH); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67a\u30fc", sortkey_results_win7_japanese_special4, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\u30fca\uff67\u30fc", sortkey_results_win7_japanese_special5, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67a\u30fca\uff67\u30fc", sortkey_results_win7_japanese_special6, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67\u30fc\u30fc", sortkey_results_win7_japanese_special7, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67a\u30fca\u30fca\uff67\u30fc", sortkey_results_win7_japanese_special8, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67\u30fc\uff67", sortkey_results_win7_japanese_special9, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67a\uff67\u30fc", sortkey_results_win7_japanese_special10, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67a\uff67\u30fca\u30fc", sortkey_results_win7_japanese_special11, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\u30B1\u30FC", sortkey_results_win7_japanese_special12, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uFF9C\u3034", sortkey_results_win7_japanese_special13, NORM_IGNORENONSPACE); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\u3083\u309D", sortkey_results_win7_japanese_special14, NORM_IGNOREKANATYPE); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"aaa\uff67\uff67\ua015a015a015\uff70\uff70a\uff67\u30fc", sortkey_results_win7_japanese_special15, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\u32EBj\uA015\uFF9C\u31FA\u3034\u30FDb\u30FA\uFF8Frrs\u30F2\uFF75\u3005n\uFF75\u32E8u", sortkey_results_win7_japanese_special16, 0); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\u32EBj\uA015\uFF9C\u31FA\u3034\u30FDb\u30FA\uFF8Frrs\u30F2\uFF75\u3005n\uFF75\u32E8u", sortkey_results_win7_japanese_special17, NORM_IGNORENONSPACE | NORM_IGNOREWIDTH | NORM_IGNOREKANATYPE); /* Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\u037f\u052a", sortkey_results_win7_missing_characters, 0); /* Characters not in table */ + todo_wine + run_sortkey_test(0x0409, L"\u00c6", sortkey_results_win7_expansion1, 0); /* Expansion */ + todo_wine + run_sortkey_test(0x0409, L"\u0374", sortkey_results_win7_compatibility1, 0); /* Compatibility */ + todo_wine + run_sortkey_test(0x0409, L"a\u0301\u0385\u06d6", sortkey_results_win7_expansion2, 0); /* Expansion */ + run_sortkey_test(0x0409, L"\0a", sortkey_results_win7_null_character, 0); /* null character */ + todo_wine + run_sortkey_test(0x0409, L"\u9185\xD994\uFF70", sortkey_results_win7_japanese_special_with_missing_characters1, 0); /* Characters not in table & Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\u9185\uFCA2\uFF70", sortkey_results_win7_japanese_special_with_expansion1, 0); /* Expansion & Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67\u200f\u30fc", sortkey_results_win7_japanese_special_with_unsortable, 0); /* Unsortable characters & Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67\u037f\u30fc", sortkey_results_win7_japanese_special_with_missing_characters2, 0); /* Character not in table & Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uff67\u00c6\u30fc", sortkey_results_win7_japanese_special_with_expansion2, 0); /* Expansion & Japanese special */ + todo_wine + run_sortkey_test(0x0409, L"\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\uE9D2\x001C", sortkey_results_win7_punctuation_with_cjk, 0); /* Punctuation with CJK */ + todo_wine + run_sortkey_test(0x0409, L"\u1fee", sortkey_results_win7_compatibility_to_expansion, 0); /* Compatibility to expansion */ + todo_wine + run_sortkey_test(0x0409, L"\uFEA6\uFA83\xDD01", sortkey_results_win7_compatibility2, 0); /* Compatibility */ + todo_wine + run_sortkey_test(0x0409, L"\uFA72\u30FC\u22DC", sortkey_results_win7_compatibility3, 0); /* Compatibility */ + todo_wine + run_sortkey_test(0x0409, L"\u30E6\u05B6\u3005", sortkey_results_win7_japanese_special_type1, 0); /* Type 1 and Japanese special */ + + /* ja-JP */ + todo_wine + run_sortkey_test(0x0411, L"\xd835\ufa43\u4edf", sortkey_results_win7_language_jap1, 0); +} + static void test_LCMapStringEx(void) { int ret; @@ -6281,6 +6462,7 @@ START_TEST(locale) test_LCMapStringW(); test_LCMapStringEx(); test_LocaleNameToLCID(); + test_LCMapString_sortkey(); test_FoldStringA(); test_FoldStringW(); test_ConvertDefaultLocale(); -- 2.25.0