[NTUSER][IMM32_APITEST] Associate HIMC to WND (#4451)

- Set the default input context to WND at IntCreateWindow function.
- Add more tests to the himc testcase of imm32_apitest.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-04-15 13:16:50 +09:00 committed by GitHub
parent f848343bff
commit 3820744a18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 1 deletions

View file

@ -7,7 +7,7 @@
#include "precomp.h"
START_TEST(himc)
static void Test1(void)
{
DWORD style;
HWND hwndEdit, hwndStatic;
@ -152,3 +152,44 @@ START_TEST(himc)
DestroyWindow(hwndEdit);
DestroyWindow(hwndStatic);
}
static void Test2(void)
{
static const LPCSTR apszClasses[] =
{
"BUTTON",
"COMBOBOX",
"EDIT",
"LISTBOX",
"SCROLLBAR",
"STATIC"
};
size_t i;
HIMC hIMC;
HWND hwnd;
for (i = 0; i < _countof(apszClasses); ++i)
{
LPCSTR pszClass = apszClasses[i];
hwnd = CreateWindowA(pszClass, NULL, WS_VISIBLE, 0, 0, 0, 0, NULL, NULL,
GetModuleHandle(NULL), NULL);
ok(hwnd != NULL, "CreateWindow failed\n");
hIMC = ImmGetContext(hwnd);
if (lstrcmpiA(pszClass, "BUTTON") == 0)
ok(hIMC == NULL, "hIMC was %p\n", hIMC);
else
ok(hIMC != NULL, "hIMC was NULL\n");
ImmReleaseContext(hwnd, hIMC);
DestroyWindow(hwnd);
}
}
START_TEST(himc)
{
Test1();
Test2();
}

View file

@ -1866,6 +1866,10 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
pWnd->ExStyle = Cs->dwExStyle;
pWnd->cbwndExtra = pWnd->pcls->cbwndExtra;
pWnd->pActCtx = acbiBuffer;
if (pti->spDefaultImc && Class->atomClassName != gpsi->atomSysClass[ICLS_BUTTON])
pWnd->hImc = UserHMGetHandle(pti->spDefaultImc);
pWnd->InternalPos.MaxPos.x = pWnd->InternalPos.MaxPos.y = -1;
pWnd->InternalPos.IconPos.x = pWnd->InternalPos.IconPos.y = -1;