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
13f0b5c9
Commit
13f0b5c9
authored
Mar 31, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32/tests: Add some ImmSetConversionStatus tests.
parent
3cb0b6c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
0 deletions
+165
-0
imm32.c
dlls/imm32/tests/imm32.c
+165
-0
No files found.
dlls/imm32/tests/imm32.c
View file @
13f0b5c9
...
...
@@ -3898,6 +3898,168 @@ cleanup:
winetest_pop_context
();
}
static
void
test_ImmSetConversionStatus
(
void
)
{
const
struct
ime_call
set_conversion_status_0_seq
[]
=
{
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
IME_NOTIFY
,
.
notify
=
{.
action
=
NI_CONTEXTUPDATED
,
.
index
=
0
,
.
value
=
IMC_SETCONVERSIONMODE
},
},
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
MSG_IME_UI
,
.
message
=
{.
msg
=
WM_IME_NOTIFY
,
.
wparam
=
IMN_SETCONVERSIONMODE
},
},
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
IME_NOTIFY
,
.
notify
=
{.
action
=
NI_CONTEXTUPDATED
,
.
index
=
0
,
.
value
=
IMC_SETSENTENCEMODE
},
},
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
MSG_IME_UI
,
.
message
=
{.
msg
=
WM_IME_NOTIFY
,
.
wparam
=
IMN_SETSENTENCEMODE
},
},
{
0
},
};
const
struct
ime_call
set_conversion_status_1_seq
[]
=
{
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
IME_NOTIFY
,
.
notify
=
{.
action
=
NI_CONTEXTUPDATED
,
.
index
=
0xdeadbeef
,
.
value
=
IMC_SETCONVERSIONMODE
},
},
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
MSG_IME_UI
,
.
message
=
{.
msg
=
WM_IME_NOTIFY
,
.
wparam
=
IMN_SETCONVERSIONMODE
},
},
{
0
},
};
const
struct
ime_call
set_conversion_status_2_seq
[]
=
{
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
IME_NOTIFY
,
.
notify
=
{.
action
=
NI_CONTEXTUPDATED
,
.
index
=
0
,
.
value
=
IMC_SETCONVERSIONMODE
},
},
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
MSG_IME_UI
,
.
message
=
{.
msg
=
WM_IME_NOTIFY
,
.
wparam
=
IMN_SETCONVERSIONMODE
},
},
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
IME_NOTIFY
,
.
notify
=
{.
action
=
NI_CONTEXTUPDATED
,
.
index
=
0xfeedcafe
,
.
value
=
IMC_SETSENTENCEMODE
},
},
{
.
hkl
=
expect_ime
,
.
himc
=
default_himc
,
.
func
=
MSG_IME_UI
,
.
message
=
{.
msg
=
WM_IME_NOTIFY
,
.
wparam
=
IMN_SETSENTENCEMODE
},
},
{
0
},
};
DWORD
old_conversion
,
old_sentence
,
conversion
,
sentence
;
HKL
hkl
,
old_hkl
=
GetKeyboardLayout
(
0
);
INPUTCONTEXT
*
ctx
;
ok_ret
(
0
,
ImmGetConversionStatus
(
0
,
&
old_conversion
,
&
old_sentence
)
);
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
old_conversion
,
&
old_sentence
)
);
ctx
=
ImmLockIMC
(
default_himc
);
ok_ne
(
NULL
,
ctx
,
INPUTCONTEXT
*
,
"%p"
);
ok_eq
(
old_conversion
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
old_sentence
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
hwnd
=
CreateWindowW
(
L"static"
,
NULL
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
100
,
100
,
100
,
100
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
!!
hwnd
,
"CreateWindowW failed, error %lu
\n
"
,
GetLastError
()
);
process_messages
();
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
conversion
,
&
sentence
)
);
ok_eq
(
old_conversion
,
conversion
,
UINT
,
"%#x"
);
ok_eq
(
old_sentence
,
sentence
,
UINT
,
"%#x"
);
ok_eq
(
old_conversion
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
old_sentence
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ok_ret
(
1
,
ImmSetConversionStatus
(
default_himc
,
0
,
0
)
);
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
conversion
,
&
sentence
)
);
ok_eq
(
0
,
conversion
,
UINT
,
"%#x"
);
ok_eq
(
0
,
sentence
,
UINT
,
"%#x"
);
ok_eq
(
0
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
0
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ime_info
.
fdwProperty
=
IME_PROP_END_UNLOAD
|
IME_PROP_UNICODE
;
if
(
!
(
hkl
=
ime_install
()))
goto
cleanup
;
ok_ret
(
1
,
ImmActivateLayout
(
hkl
)
);
ok_ret
(
1
,
ImmLoadIME
(
hkl
)
);
process_messages
();
/* initial values are dependent on both old and new IME */
ok_ret
(
1
,
ImmSetConversionStatus
(
default_himc
,
0
,
0
)
);
memset
(
ime_calls
,
0
,
sizeof
(
ime_calls
)
);
ime_call_count
=
0
;
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
conversion
,
&
sentence
)
);
ok_eq
(
0
,
conversion
,
UINT
,
"%#x"
);
ok_eq
(
0
,
sentence
,
UINT
,
"%#x"
);
ok_eq
(
0
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
0
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ok_seq
(
empty_sequence
);
ok_ret
(
1
,
ImmSetConversionStatus
(
default_himc
,
0xdeadbeef
,
0xfeedcafe
)
);
ok_seq
(
set_conversion_status_0_seq
);
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
conversion
,
&
sentence
)
);
ok_eq
(
0xdeadbeef
,
conversion
,
UINT
,
"%#x"
);
ok_eq
(
0xfeedcafe
,
sentence
,
UINT
,
"%#x"
);
ok_eq
(
0xdeadbeef
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
0xfeedcafe
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ok_seq
(
empty_sequence
);
ok_ret
(
1
,
ImmSetConversionStatus
(
default_himc
,
0
,
0xfeedcafe
)
);
ok_seq
(
set_conversion_status_1_seq
);
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
conversion
,
&
sentence
)
);
ok_eq
(
0
,
conversion
,
UINT
,
"%#x"
);
ok_eq
(
0xfeedcafe
,
sentence
,
UINT
,
"%#x"
);
ok_eq
(
0
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
0xfeedcafe
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ok_seq
(
empty_sequence
);
ok_ret
(
1
,
ImmSetConversionStatus
(
default_himc
,
~
0
,
~
0
)
);
ok_seq
(
set_conversion_status_2_seq
);
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
conversion
,
&
sentence
)
);
ok_eq
(
~
0
,
conversion
,
UINT
,
"%#x"
);
ok_eq
(
~
0
,
sentence
,
UINT
,
"%#x"
);
ok_eq
(
~
0
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
~
0
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
/* status is cached and some bits are kept from the previous active IME */
ok_ret
(
1
,
ImmActivateLayout
(
old_hkl
)
);
todo_wine
ok_eq
(
0x200
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
old_sentence
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ok_ret
(
1
,
ImmActivateLayout
(
hkl
)
);
todo_wine
ok_eq
(
~
0
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
todo_wine
ok_eq
(
~
0
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ok_ret
(
1
,
ImmActivateLayout
(
old_hkl
)
);
todo_wine
ok_eq
(
0x200
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
old_sentence
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ime_cleanup
(
hkl
,
TRUE
);
cleanup:
/* sanitize conversion status to some sane default */
ok_ret
(
1
,
ImmSetConversionStatus
(
default_himc
,
0
,
0
)
);
ok_ret
(
1
,
ImmGetConversionStatus
(
default_himc
,
&
conversion
,
&
sentence
)
);
ok_eq
(
0
,
conversion
,
UINT
,
"%#x"
);
ok_eq
(
0
,
sentence
,
UINT
,
"%#x"
);
ok_eq
(
0
,
ctx
->
fdwConversion
,
UINT
,
"%#x"
);
ok_eq
(
0
,
ctx
->
fdwSentence
,
UINT
,
"%#x"
);
ok_ret
(
1
,
DestroyWindow
(
hwnd
)
);
process_messages
();
memset
(
ime_calls
,
0
,
sizeof
(
ime_calls
)
);
ime_call_count
=
0
;
ok_ret
(
1
,
ImmUnlockIMC
(
default_himc
)
);
}
static
void
test_ImmProcessKey
(
void
)
{
const
struct
ime_call
process_key_seq
[]
=
...
...
@@ -4493,6 +4655,9 @@ START_TEST(imm32)
test_ImmUnregisterWord
(
FALSE
);
test_ImmUnregisterWord
(
TRUE
);
/* test these first to sanitize conversion / open statuses */
test_ImmSetConversionStatus
();
test_ImmActivateLayout
();
test_ImmCreateInputContext
();
test_ImmProcessKey
();
...
...
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