Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
80bec586
Commit
80bec586
authored
Aug 12, 2022
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Aug 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/tests: Add IME tests for edit control.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
parent
1f843165
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
212 additions
and
1 deletion
+212
-1
Makefile.in
dlls/comctl32/tests/Makefile.in
+1
-1
edit.c
dlls/comctl32/tests/edit.c
+211
-0
No files found.
dlls/comctl32/tests/Makefile.in
View file @
80bec586
TESTDLL
=
comctl32.dll
TESTDLL
=
comctl32.dll
IMPORTS
=
ole32 user32 gdi32 advapi32
IMPORTS
=
ole32 user32 gdi32 advapi32
imm32
C_SRCS
=
\
C_SRCS
=
\
animate.c
\
animate.c
\
...
...
dlls/comctl32/tests/edit.c
View file @
80bec586
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include <windows.h>
#include <windows.h>
#include <commctrl.h>
#include <commctrl.h>
#include <imm.h>
#include "wine/test.h"
#include "wine/test.h"
#include "v6util.h"
#include "v6util.h"
...
@@ -3441,6 +3442,215 @@ static void test_change_focus(void)
...
@@ -3441,6 +3442,215 @@ static void test_change_focus(void)
DestroyWindow
(
hwnd
);
DestroyWindow
(
hwnd
);
}
}
static
const
struct
message
wm_ime_composition_seq
[]
=
{
{
WM_IME_STARTCOMPOSITION
,
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_IME_ENDCOMPOSITION
,
sent
},
{
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
wm_ime_char_seq
[]
=
{
{
WM_IME_CHAR
,
sent
|
wparam
,
'0'
},
{
WM_CHAR
,
sent
|
wparam
,
'0'
},
{
0
}
};
static
const
struct
message
eimes_getcompstratonce_seq
[]
=
{
{
WM_IME_STARTCOMPOSITION
,
sent
},
{
WM_IME_COMPOSITION
,
sent
|
wparam
,
'W'
},
{
WM_IME_ENDCOMPOSITION
,
sent
},
{
0
}
};
static
LRESULT
CALLBACK
edit_ime_subclass_proc
(
HWND
hwnd
,
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
WNDPROC
oldproc
=
(
WNDPROC
)
GetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
);
static
LONG
defwndproc_counter
=
0
;
struct
message
msg
=
{
0
};
LRESULT
ret
;
msg
.
message
=
message
;
msg
.
flags
=
sent
|
wparam
;
if
(
defwndproc_counter
)
msg
.
flags
|=
defwinproc
;
msg
.
wParam
=
wParam
;
if
(
message
<
0xc000
&&
message
!=
WM_GETTEXTLENGTH
&&
message
!=
WM_GETTEXT
&&
message
!=
WM_GETFONT
&&
message
!=
WM_GETICON
&&
message
!=
WM_IME_SETCONTEXT
&&
message
!=
WM_IME_NOTIFY
&&
message
!=
WM_CTLCOLOREDIT
&&
message
!=
WM_PAINT
&&
message
!=
WM_ERASEBKGND
&&
message
!=
WM_NCHITTEST
&&
message
!=
WM_SETCURSOR
&&
message
!=
WM_MOUSEMOVE
&&
message
!=
WM_MOUSEACTIVATE
&&
message
!=
WM_KEYUP
&&
(
message
<
EM_GETSEL
||
message
>
EM_GETIMESTATUS
))
{
add_message
(
sequences
,
COMBINED_SEQ_INDEX
,
&
msg
);
}
defwndproc_counter
++
;
if
(
IsWindowUnicode
(
hwnd
))
ret
=
CallWindowProcW
(
oldproc
,
hwnd
,
message
,
wParam
,
lParam
);
else
ret
=
CallWindowProcA
(
oldproc
,
hwnd
,
message
,
wParam
,
lParam
);
defwndproc_counter
--
;
return
ret
;
}
static
void
test_ime
(
void
)
{
WNDPROC
old_proc
;
LRESULT
lr
;
HIMC
himc
;
HWND
hwnd
;
BOOL
ret
;
MSG
msg
;
hwnd
=
create_editcontrol
(
WS_POPUP
|
WS_VISIBLE
,
0
);
/* Test EM_{GET|SET}IMESTATUS */
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
ok
(
lr
==
0
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
/* Note that EM_SETIMESTATUS always return 1, which is contrary to what MSDN says about
* returning the previous LPARAM value */
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
EIMES_GETCOMPSTRATONCE
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
EIMES_GETCOMPSTRATONCE
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
EIMES_CANCELCOMPSTRINFOCUS
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
EIMES_CANCELCOMPSTRINFOCUS
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
EIMES_COMPLETECOMPSTRKILLFOCUS
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
EIMES_COMPLETECOMPSTRKILLFOCUS
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
EIMES_GETCOMPSTRATONCE
|
EIMES_CANCELCOMPSTRINFOCUS
|
EIMES_COMPLETECOMPSTRKILLFOCUS
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
(
EIMES_GETCOMPSTRATONCE
|
EIMES_CANCELCOMPSTRINFOCUS
|
EIMES_COMPLETECOMPSTRKILLFOCUS
),
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
ok
(
lr
==
0
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
/* Invalid EM_{GET|SET}IMESTATUS status types and flags */
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
0
,
0
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
+
1
,
0
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
0
,
EIMES_GETCOMPSTRATONCE
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
ok
(
lr
==
0
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
+
1
,
EIMES_GETCOMPSTRATONCE
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
ok
(
lr
==
0
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0xFFFFFFFF
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
0xFFFF
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
ok
(
lr
==
0
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
/* Test IME messages when EIMES_GETCOMPSTRATONCE is not set */
old_proc
=
(
WNDPROC
)
SetWindowLongPtrA
(
hwnd
,
GWLP_WNDPROC
,
(
LONG_PTR
)
edit_ime_subclass_proc
);
SetWindowLongPtrA
(
hwnd
,
GWLP_USERDATA
,
(
LONG_PTR
)
old_proc
);
himc
=
ImmGetContext
(
hwnd
);
ret
=
ImmSetCompositionStringA
(
himc
,
SCS_SETSTR
,
"Wine"
,
4
,
NULL
,
0
);
ok
(
ret
,
"ImmSetCompositionStringA failed.
\n
"
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
ret
=
ImmNotifyIME
(
himc
,
NI_COMPOSITIONSTR
,
CPS_COMPLETE
,
0
);
ok
(
ret
,
"ImmNotifyIME failed.
\n
"
);
/* 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
(
sequences
,
COMBINED_SEQ_INDEX
,
wm_ime_composition_seq
,
"WM_IME_COMPOSITION"
,
TRUE
);
/* Test that WM_IME_CHAR is passed to DefWindowProc() to get WM_CHAR */
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
SendMessageA
(
hwnd
,
WM_IME_CHAR
,
'0'
,
1
);
while
(
PeekMessageA
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessageA
(
&
msg
);
ok_sequence
(
sequences
,
COMBINED_SEQ_INDEX
,
wm_ime_char_seq
,
"WM_IME_CHAR"
,
TRUE
);
/* Test IME messages when EIMES_GETCOMPSTRATONCE is set */
lr
=
SendMessageA
(
hwnd
,
EM_SETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
EIMES_GETCOMPSTRATONCE
);
todo_wine
ok
(
lr
==
1
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
lr
=
SendMessageA
(
hwnd
,
EM_GETIMESTATUS
,
EMSIS_COMPOSITIONSTRING
,
0
);
todo_wine
ok
(
lr
==
EIMES_GETCOMPSTRATONCE
,
"Got unexpected lr %#Ix.
\n
"
,
lr
);
ret
=
ImmSetCompositionStringA
(
himc
,
SCS_SETSTR
,
"Wine"
,
4
,
NULL
,
0
);
ok
(
ret
,
"ImmSetCompositionStringA failed.
\n
"
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
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
(
sequences
,
COMBINED_SEQ_INDEX
,
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_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
SendMessageA
(
hwnd
,
WM_IME_CHAR
,
'0'
,
1
);
while
(
PeekMessageA
(
&
msg
,
0
,
0
,
0
,
PM_REMOVE
))
DispatchMessageA
(
&
msg
);
ok_sequence
(
sequences
,
COMBINED_SEQ_INDEX
,
wm_ime_char_seq
,
"WM_IME_CHAR"
,
TRUE
);
ImmReleaseContext
(
hwnd
,
himc
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
edit
)
START_TEST
(
edit
)
{
{
ULONG_PTR
ctx_cookie
;
ULONG_PTR
ctx_cookie
;
...
@@ -3487,6 +3697,7 @@ START_TEST(edit)
...
@@ -3487,6 +3697,7 @@ START_TEST(edit)
test_wordbreak_proc
();
test_wordbreak_proc
();
test_change_focus
();
test_change_focus
();
test_cue_banner
();
test_cue_banner
();
test_ime
();
UnregisterWindowClasses
();
UnregisterWindowClasses
();
...
...
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