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
b943a69c
Commit
b943a69c
authored
May 07, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
May 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32/tests: Add tests for keyboard layout preload list.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fbd30fff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
72 additions
and
6 deletions
+72
-6
input.c
dlls/user32/tests/input.c
+72
-6
No files found.
dlls/user32/tests/input.c
View file @
b943a69c
...
...
@@ -3072,9 +3072,10 @@ static void test_get_async_key_state(void)
static
void
test_keyboard_layout_name
(
void
)
{
WCHAR
klid
[
KL_NAMELENGTH
],
tmpklid
[
KL_NAMELENGTH
],
layout_path
[
MAX_PATH
],
value
[
5
];
HKL
layout
,
tmplayout
,
layouts
[
64
];
DWORD
status
,
value_size
;
int
i
,
len
;
HKL
layout
,
tmplayout
,
*
layouts
,
*
layouts_preload
;
DWORD
status
,
value_size
,
klid_size
,
type
,
id
;
int
i
,
j
,
len
;
HKEY
hkey
;
BOOL
ret
;
if
(
0
)
/* crashes on native system */
...
...
@@ -3087,15 +3088,77 @@ static void test_keyboard_layout_name(void)
layout
=
GetKeyboardLayout
(
0
);
len
=
GetKeyboardLayoutList
(
ARRAY_SIZE
(
layouts
),
layouts
);
len
=
GetKeyboardLayoutList
(
0
,
NULL
);
ok
(
len
>
0
,
"GetKeyboardLayoutList returned %d
\n
"
,
len
);
layouts
=
malloc
(
len
*
sizeof
(
HKL
));
ok
(
layouts
!=
NULL
,
"Could not allocate memory
\n
"
);
len
=
GetKeyboardLayoutList
(
len
,
layouts
);
ok
(
len
>
0
,
"GetKeyboardLayoutList returned %d
\n
"
,
len
);
layouts_preload
=
calloc
(
len
,
sizeof
(
HKL
));
ok
(
layouts_preload
!=
NULL
,
"Could not allocate memory
\n
"
);
if
(
!
RegOpenKeyW
(
HKEY_CURRENT_USER
,
L"Keyboard Layout
\\
Preload"
,
&
hkey
))
{
i
=
0
;
type
=
REG_SZ
;
klid_size
=
sizeof
(
klid
);
value_size
=
ARRAY_SIZE
(
value
);
while
(
i
<
len
&&
!
RegEnumValueW
(
hkey
,
i
++
,
value
,
&
value_size
,
NULL
,
&
type
,
(
void
*
)
&
klid
,
&
klid_size
))
{
klid_size
=
sizeof
(
klid
);
value_size
=
ARRAY_SIZE
(
value
);
layouts_preload
[
i
-
1
]
=
UlongToHandle
(
wcstoul
(
klid
,
NULL
,
16
)
);
id
=
(
DWORD_PTR
)
layouts_preload
[
i
-
1
];
if
(
id
&
0x80000000
)
todo_wine_if
(
HIWORD
(
id
)
==
0xe001
)
ok
((
id
&
0xf0000000
)
==
0xd0000000
,
"Unexpected preloaded keyboard layout high bits %#x
\n
"
,
id
);
else
ok
(
!
(
id
&
0xf0000000
),
"Unexpected preloaded keyboard layout high bits %#x
\n
"
,
id
);
}
ok
(
i
<=
len
,
"Unexpected keyboard count %d in preload list
\n
"
,
i
);
RegCloseKey
(
hkey
);
}
if
(
!
RegOpenKeyW
(
HKEY_CURRENT_USER
,
L"Keyboard Layout
\\
Substitutes"
,
&
hkey
))
{
for
(
i
=
0
;
i
<
len
&&
layouts_preload
[
i
];
++
i
)
{
type
=
REG_SZ
;
klid_size
=
sizeof
(
klid
);
swprintf
(
tmpklid
,
KL_NAMELENGTH
,
L"%08x"
,
HandleToUlong
(
layouts_preload
[
i
]
)
);
if
(
!
RegQueryValueExW
(
hkey
,
tmpklid
,
NULL
,
&
type
,
(
void
*
)
&
klid
,
&
klid_size
))
{
layouts_preload
[
i
]
=
UlongToHandle
(
wcstoul
(
klid
,
NULL
,
16
)
);
/* Substitute should contain the keyboard layout id, not the HKL high word */
id
=
(
DWORD_PTR
)
layouts_preload
[
i
];
ok
(
!
(
id
&
0xf0000000
),
"Unexpected substitute keyboard layout high bits %#x
\n
"
,
id
);
}
else
{
id
=
(
DWORD_PTR
)
layouts_preload
[
i
];
ok
(
!
(
id
&
0xf0000000
),
"Unexpected preloaded keyboard layout high bits %#x
\n
"
,
id
);
}
}
RegCloseKey
(
hkey
);
}
for
(
i
=
len
-
1
;
i
>=
0
;
--
i
)
{
UINT
id
=
(
UINT
_PTR
)
layouts
[
i
];
id
=
(
DWORD
_PTR
)
layouts
[
i
];
ActivateKeyboardLayout
(
layouts
[
i
],
0
);
GetKeyboardLayoutNameW
(
klid
);
for
(
j
=
0
;
j
<
len
;
++
j
)
{
swprintf
(
tmpklid
,
KL_NAMELENGTH
,
L"%08X"
,
layouts_preload
[
j
]
);
if
(
!
wcscmp
(
tmpklid
,
klid
))
break
;
}
ok
(
j
<
len
,
"Could not find keyboard layout %p in preload list
\n
"
,
layout
);
if
(
id
&
0x80000000
)
{
todo_wine
ok
((
id
>>
28
)
==
0xf
,
"hkl high bits %#x, expected 0xf
\n
"
,
id
>>
28
);
...
...
@@ -3120,7 +3183,7 @@ static void test_keyboard_layout_name(void)
tmplayout
=
LoadKeyboardLayoutW
(
klid
,
KLF_ACTIVATE
);
/* The low word of HKL is the selected user lang and may be different as LoadKeyboardLayoutW also selects the default lang from the layout */
ok
(((
UINT_PTR
)
tmplayout
&
~
0xffff
)
==
((
UINT_PTR
)
layouts
[
i
]
&
~
0xffff
),
"
GetKeyboardLayout
returned %p, expected %p
\n
"
,
tmplayout
,
layouts
[
i
]);
ok
(((
UINT_PTR
)
tmplayout
&
~
0xffff
)
==
((
UINT_PTR
)
layouts
[
i
]
&
~
0xffff
),
"
LoadKeyboardLayoutW
returned %p, expected %p
\n
"
,
tmplayout
,
layouts
[
i
]);
/* The layout name only depends on the keyboard layout: the high word of HKL. */
GetKeyboardLayoutNameW
(
tmpklid
);
...
...
@@ -3128,6 +3191,9 @@ static void test_keyboard_layout_name(void)
}
ActivateKeyboardLayout
(
layout
,
0
);
free
(
layouts
);
free
(
layouts_preload
);
}
static
void
test_key_names
(
void
)
...
...
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