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
bb8bcf49
Commit
bb8bcf49
authored
Mar 09, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imm32/tests: Test ImmIsIME with the installed IME.
parent
7f5007f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
imm32.c
dlls/imm32/tests/imm32.c
+70
-0
No files found.
dlls/imm32/tests/imm32.c
View file @
bb8bcf49
...
...
@@ -35,6 +35,28 @@
#include "ime_test.h"
static
const
char
*
debugstr_ok
(
const
char
*
cond
)
{
int
c
,
n
=
0
;
/* skip possible casts */
while
((
c
=
*
cond
++
))
{
if
(
c
==
'('
)
n
++
;
if
(
!
n
)
break
;
if
(
c
==
')'
)
n
--
;
}
if
(
!
strchr
(
cond
-
1
,
'('
))
return
wine_dbg_sprintf
(
"got %s"
,
cond
-
1
);
return
wine_dbg_sprintf
(
"%.*s returned"
,
(
int
)
strcspn
(
cond
-
1
,
"( "
),
cond
-
1
);
}
#define ok_eq( e, r, t, f, ... ) \
do \
{ \
t v = (r); \
ok( v == (e), "%s " f "\n", debugstr_ok( #r ), v, ##__VA_ARGS__ ); \
} while (0)
#define ok_ret( e, r ) ok_eq( e, r, UINT_PTR, "%Iu, error %ld", GetLastError() )
BOOL
WINAPI
ImmSetActiveContext
(
HWND
,
HIMC
,
BOOL
);
static
BOOL
(
WINAPI
*
pImmAssociateContextEx
)(
HWND
,
HIMC
,
DWORD
);
...
...
@@ -2433,9 +2455,13 @@ static void test_ImmDisableIME(void)
#define ime_trace( msg, ... ) if (winetest_debug > 1) trace( "%04lx:%s " msg, GetCurrentThreadId(), __func__, ## __VA_ARGS__ )
static
BOOL
todo_ImeInquire
;
DEFINE_EXPECT
(
ImeInquire
);
static
BOOL
todo_ImeDestroy
;
DEFINE_EXPECT
(
ImeDestroy
);
static
BOOL
todo_IME_DLL_PROCESS_ATTACH
;
DEFINE_EXPECT
(
IME_DLL_PROCESS_ATTACH
);
static
BOOL
todo_IME_DLL_PROCESS_DETACH
;
DEFINE_EXPECT
(
IME_DLL_PROCESS_DETACH
);
static
IMEINFO
ime_info
;
...
...
@@ -2476,6 +2502,7 @@ static BOOL WINAPI ime_ImeDestroy( UINT force )
{
ime_trace
(
"force %u
\n
"
,
force
);
todo_wine_if
(
todo_ImeDestroy
)
CHECK_EXPECT
(
ImeDestroy
);
ok
(
!
force
,
"got force %u
\n
"
,
force
);
...
...
@@ -2519,6 +2546,7 @@ static BOOL WINAPI ime_ImeInquire( IMEINFO *info, WCHAR *ui_class, DWORD flags )
{
ime_trace
(
"info %p, ui_class %p, flags %#lx
\n
"
,
info
,
ui_class
,
flags
);
todo_wine_if
(
todo_ImeInquire
)
CHECK_EXPECT
(
ImeInquire
);
ok
(
!!
info
,
"got info %p
\n
"
,
info
);
...
...
@@ -2606,11 +2634,13 @@ static BOOL WINAPI ime_DllMain( HINSTANCE instance, DWORD reason, LPVOID reserve
DisableThreadLibraryCalls
(
instance
);
ime_ui_class
.
hInstance
=
instance
;
RegisterClassExW
(
&
ime_ui_class
);
todo_wine_if
(
todo_IME_DLL_PROCESS_ATTACH
)
CHECK_EXPECT
(
IME_DLL_PROCESS_ATTACH
);
break
;
case
DLL_PROCESS_DETACH
:
UnregisterClassW
(
ime_ui_class
.
lpszClassName
,
instance
);
todo_wine_if
(
todo_IME_DLL_PROCESS_DETACH
)
CHECK_EXPECT
(
IME_DLL_PROCESS_DETACH
);
break
;
}
...
...
@@ -2829,6 +2859,45 @@ cleanup:
SET_ENABLE
(
IME_DLL_PROCESS_DETACH
,
FALSE
);
}
static
void
test_ImmIsIME
(
void
)
{
HKL
hkl
=
GetKeyboardLayout
(
0
);
SET_ENABLE
(
IME_DLL_PROCESS_ATTACH
,
TRUE
);
SET_ENABLE
(
ImeInquire
,
TRUE
);
SET_ENABLE
(
ImeDestroy
,
TRUE
);
SET_ENABLE
(
IME_DLL_PROCESS_DETACH
,
TRUE
);
SetLastError
(
0xdeadbeef
);
todo_wine
ok_ret
(
0
,
ImmIsIME
(
0
)
);
ok_ret
(
0xdeadbeef
,
GetLastError
()
);
ok_ret
(
1
,
ImmIsIME
(
hkl
)
);
/* IME_PROP_END_UNLOAD for the IME to unload / reload. */
ime_info
.
fdwProperty
=
IME_PROP_END_UNLOAD
;
if
(
!
(
hkl
=
ime_install
()))
goto
cleanup
;
todo_ImeInquire
=
TRUE
;
todo_ImeDestroy
=
TRUE
;
todo_IME_DLL_PROCESS_ATTACH
=
TRUE
;
todo_IME_DLL_PROCESS_DETACH
=
TRUE
;
ok_ret
(
1
,
ImmIsIME
(
hkl
)
);
todo_IME_DLL_PROCESS_ATTACH
=
FALSE
;
todo_IME_DLL_PROCESS_DETACH
=
FALSE
;
todo_ImeInquire
=
FALSE
;
todo_ImeDestroy
=
FALSE
;
ime_cleanup
(
hkl
);
cleanup:
SET_ENABLE
(
IME_DLL_PROCESS_ATTACH
,
FALSE
);
SET_ENABLE
(
ImeInquire
,
FALSE
);
SET_ENABLE
(
ImeDestroy
,
FALSE
);
SET_ENABLE
(
IME_DLL_PROCESS_DETACH
,
FALSE
);
}
static
void
test_ImmGetDescription
(
void
)
{
HKL
hkl
=
GetKeyboardLayout
(
0
);
...
...
@@ -2996,6 +3065,7 @@ START_TEST(imm32)
test_ImmInstallIME
();
test_ImmGetDescription
();
test_ImmGetIMEFileName
();
test_ImmIsIME
();
if
(
init
())
{
...
...
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