user32/tests: Add Korean IME specific test sequences.

Windows with Korean locale has a different IME message sequence.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53890
This commit is contained in:
Zhiyi Zhang 2023-07-05 17:28:04 +08:00 committed by Alexandre Julliard
parent 6596f85ee1
commit b9feebf7f3

View file

@ -12821,6 +12821,21 @@ static const struct message edit_wm_ime_composition_seq[] =
{0}
};
static const struct message edit_wm_ime_composition_korean_seq[] =
{
{WM_IME_ENDCOMPOSITION, sent},
{WM_IME_COMPOSITION, sent | wparam, 'W'},
{WM_IME_CHAR, sent | wparam | defwinproc, 'W'},
{WM_IME_CHAR, sent | wparam | defwinproc, 'i'},
{WM_IME_CHAR, sent | wparam | defwinproc, 'n'},
{WM_IME_CHAR, sent | wparam | defwinproc, 'e'},
{WM_CHAR, sent | wparam, 'W'},
{WM_CHAR, sent | wparam, 'i'},
{WM_CHAR, sent | wparam, 'n'},
{WM_CHAR, sent | wparam, 'e'},
{0}
};
static const struct message edit_wm_ime_char_seq[] =
{
{WM_IME_CHAR, sent | wparam, '0'},
@ -12836,6 +12851,13 @@ static const struct message edit_eimes_getcompstratonce_seq[] =
{0}
};
static const struct message edit_eimes_getcompstratonce_korean_seq[] =
{
{WM_IME_ENDCOMPOSITION, sent},
{WM_IME_COMPOSITION, sent | wparam, 'W'},
{0}
};
static LRESULT CALLBACK edit_ime_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
@ -12881,13 +12903,17 @@ static LRESULT CALLBACK edit_ime_subclass_proc(HWND hwnd, UINT message, WPARAM w
static DWORD WINAPI test_edit_ime_messages(void *unused_arg)
{
static const HKL korean_hkl = (HKL)0x04120412;
WNDPROC old_proc;
LRESULT lr;
HIMC himc;
HWND hwnd;
BOOL ret;
HKL hkl;
MSG msg;
hkl = GetKeyboardLayout(0);
hwnd = CreateWindowA(WC_EDITA, "Test", WS_POPUP | WS_VISIBLE, 10, 10, 300, 300, NULL, NULL,
NULL, NULL);
ok(hwnd != NULL, "CreateWindowA failed.\n");
@ -12965,7 +12991,11 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg)
/* Note that the following message loop is necessary to get the WM_CHAR messages because they
* are posted. Same for the later message loops in this function. */
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(edit_wm_ime_composition_seq, "WM_IME_COMPOSITION", TRUE);
if (hkl == korean_hkl)
ok_sequence(edit_wm_ime_composition_korean_seq,
"korean WM_IME_COMPOSITION", TRUE);
else
ok_sequence(edit_wm_ime_composition_seq, "WM_IME_COMPOSITION", TRUE);
/* Test that WM_IME_CHAR is passed to DefWindowProc() to get WM_CHAR */
flush_sequence();
@ -12985,8 +13015,12 @@ static DWORD WINAPI test_edit_ime_messages(void *unused_arg)
ret = ImmNotifyIME(himc, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
ok(ret, "ImmNotifyIME failed.\n");
while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg);
ok_sequence(edit_eimes_getcompstratonce_seq,
"WM_IME_COMPOSITION with EIMES_GETCOMPSTRATONCE", TRUE);
if (hkl == korean_hkl)
ok_sequence(edit_eimes_getcompstratonce_korean_seq,
"korean WM_IME_COMPOSITION with EIMES_GETCOMPSTRATONCE", TRUE);
else
ok_sequence(edit_eimes_getcompstratonce_seq,
"WM_IME_COMPOSITION with EIMES_GETCOMPSTRATONCE", TRUE);
/* Test that WM_IME_CHAR is passed to DefWindowProc() to get WM_CHAR with EIMES_GETCOMPSTRATONCE */
flush_sequence();