Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9c1ecf99
Commit
9c1ecf99
authored
Jul 11, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32/tests: Add NtUserAssociateInputContext tests.
parent
f5b3283e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
imm32.c
dlls/imm32/tests/imm32.c
+79
-0
No files found.
dlls/imm32/tests/imm32.c
View file @
9c1ecf99
...
...
@@ -30,6 +30,7 @@
BOOL
WINAPI
ImmSetActiveContext
(
HWND
,
HIMC
,
BOOL
);
static
BOOL
(
WINAPI
*
pImmAssociateContextEx
)(
HWND
,
HIMC
,
DWORD
);
static
UINT
(
WINAPI
*
pNtUserAssociateInputContext
)(
HWND
,
HIMC
,
ULONG
);
static
BOOL
(
WINAPI
*
pImmIsUIMessageA
)(
HWND
,
UINT
,
WPARAM
,
LPARAM
);
static
UINT
(
WINAPI
*
pSendInput
)
(
UINT
,
INPUT
*
,
size_t
);
...
...
@@ -303,6 +304,8 @@ static BOOL init(void) {
pImmAssociateContextEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"ImmAssociateContextEx"
);
pImmIsUIMessageA
=
(
void
*
)
GetProcAddress
(
hmod
,
"ImmIsUIMessageA"
);
pSendInput
=
(
void
*
)
GetProcAddress
(
huser
,
"SendInput"
);
pNtUserAssociateInputContext
=
(
void
*
)
GetProcAddress
(
GetModuleHandleW
(
L"win32u.dll"
),
"NtUserAssociateInputContext"
);
wc
.
cbSize
=
sizeof
(
WNDCLASSEXA
);
wc
.
style
=
0
;
...
...
@@ -753,6 +756,81 @@ static void test_ImmAssociateContextEx(void)
ImmReleaseContext
(
hwnd
,
imc
);
}
/* similar to above, but using NtUserAssociateInputContext */
static
void
test_NtUserAssociateInputContext
(
void
)
{
HIMC
imc
;
UINT
rc
;
if
(
!
pNtUserAssociateInputContext
)
{
win_skip
(
"NtUserAssociateInputContext not available
\n
"
);
return
;
}
imc
=
ImmGetContext
(
hwnd
);
if
(
imc
)
{
HIMC
retimc
,
newimc
;
HWND
focus
;
SET_ENABLE
(
WM_IME_SETCONTEXT_ACTIVATE
,
TRUE
);
SET_ENABLE
(
WM_IME_SETCONTEXT_DEACTIVATE
,
TRUE
);
ok
(
GetActiveWindow
()
==
hwnd
,
"hwnd is not active
\n
"
);
newimc
=
ImmCreateContext
();
ok
(
newimc
!=
imc
,
"handles should not be the same
\n
"
);
rc
=
pNtUserAssociateInputContext
(
NULL
,
NULL
,
0
);
ok
(
rc
==
2
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
rc
=
pNtUserAssociateInputContext
(
hwnd
,
NULL
,
0
);
ok
(
rc
==
1
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
rc
=
pNtUserAssociateInputContext
(
NULL
,
imc
,
0
);
ok
(
rc
==
2
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
rc
=
pNtUserAssociateInputContext
(
hwnd
,
imc
,
0
);
ok
(
rc
==
1
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
retimc
=
ImmGetContext
(
hwnd
);
ok
(
retimc
==
imc
,
"handles should be the same
\n
"
);
ImmReleaseContext
(
hwnd
,
retimc
);
rc
=
pNtUserAssociateInputContext
(
hwnd
,
imc
,
0
);
ok
(
rc
==
0
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
rc
=
pNtUserAssociateInputContext
(
hwnd
,
newimc
,
0
);
ok
(
rc
==
1
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
retimc
=
ImmGetContext
(
hwnd
);
ok
(
retimc
==
newimc
,
"handles should be the same
\n
"
);
ImmReleaseContext
(
hwnd
,
retimc
);
focus
=
CreateWindowA
(
"button"
,
"button"
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
);
ok
(
focus
!=
NULL
,
"CreateWindow failed
\n
"
);
SET_EXPECT
(
WM_IME_SETCONTEXT_DEACTIVATE
);
SetFocus
(
focus
);
CHECK_CALLED
(
WM_IME_SETCONTEXT_DEACTIVATE
);
rc
=
pNtUserAssociateInputContext
(
hwnd
,
imc
,
0
);
ok
(
rc
==
0
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
SET_EXPECT
(
WM_IME_SETCONTEXT_ACTIVATE
);
DestroyWindow
(
focus
);
CHECK_CALLED
(
WM_IME_SETCONTEXT_ACTIVATE
);
SET_EXPECT
(
WM_IME_SETCONTEXT_DEACTIVATE
);
SetFocus
(
child
);
CHECK_CALLED
(
WM_IME_SETCONTEXT_DEACTIVATE
);
rc
=
pNtUserAssociateInputContext
(
hwnd
,
newimc
,
0
);
ok
(
rc
==
0
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
SET_EXPECT
(
WM_IME_SETCONTEXT_ACTIVATE
);
SetFocus
(
hwnd
);
CHECK_CALLED
(
WM_IME_SETCONTEXT_ACTIVATE
);
rc
=
pNtUserAssociateInputContext
(
hwnd
,
NULL
,
IACE_DEFAULT
);
ok
(
rc
==
1
,
"NtUserAssociateInputContext returned %x
\n
"
,
rc
);
SET_ENABLE
(
WM_IME_SETCONTEXT_ACTIVATE
,
FALSE
);
SET_ENABLE
(
WM_IME_SETCONTEXT_DEACTIVATE
,
FALSE
);
}
ImmReleaseContext
(
hwnd
,
imc
);
}
typedef
struct
_igc_threadinfo
{
HWND
hwnd
;
HANDLE
event
;
...
...
@@ -2331,6 +2409,7 @@ START_TEST(imm32) {
test_ImmSetCompositionString
();
test_ImmIME
();
test_ImmAssociateContextEx
();
test_NtUserAssociateInputContext
();
test_ImmThreads
();
test_ImmIsUIMessage
();
test_ImmGetContext
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment