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
bed1ecba
Commit
bed1ecba
authored
May 19, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
May 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput/tests: Add some tests with keyboard action mapping.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=54917
parent
a8c56b19
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
118 additions
and
0 deletions
+118
-0
device8.c
dlls/dinput/tests/device8.c
+118
-0
No files found.
dlls/dinput/tests/device8.c
View file @
bed1ecba
...
...
@@ -34,6 +34,10 @@
#include "dinput_test.h"
#include "initguid.h"
DEFINE_GUID
(
GUID_keyboard_action_mapping
,
0x00000001
,
0x0002
,
0x0003
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0a
,
0x0b
);
struct
enum_data
{
DWORD
version
;
...
...
@@ -1712,6 +1716,60 @@ static void test_dik_codes( IDirectInputDevice8W *device, HANDLE event, HWND hwn
ok
(
hr
==
DI_OK
,
"Unacquire returned %#lx
\n
"
,
hr
);
}
#define check_member_str_( file, line, val, exp, member ) \
ok_(file, line)( !strcmp( (val).member, (exp).member ), "got " #member " %s\n", \
debugstr_a((val).member) )
#define check_member_str( val, exp, member ) \
check_member_str_( __FILE__, __LINE__, val, exp, member )
#define check_diactionA( a, b ) check_diactionA_( __LINE__, a, b )
static
void
check_diactionA_
(
int
line
,
const
DIACTIONA
*
actual
,
const
DIACTIONA
*
expected
)
{
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#Ix"
,
uAppData
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwSemantic
);
todo_wine_if
(
expected
->
dwSemantic
==
0x810004c8
)
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwFlags
);
if
(
actual
->
lptszActionName
&&
expected
->
lptszActionName
)
check_member_str_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
lptszActionName
);
else
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%p"
,
lptszActionName
);
todo_wine_if
(
expected
->
dwSemantic
==
0x810004c8
)
check_member_guid_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
guidInstance
);
todo_wine_if
(
expected
->
dwSemantic
==
0x810004c8
)
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwObjID
);
todo_wine_if
(
expected
->
dwSemantic
==
0x810004c8
)
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwHow
);
}
#define check_diactionformatA( a, b ) check_diactionformatA_( __LINE__, a, b )
static
void
check_diactionformatA_
(
int
line
,
const
DIACTIONFORMATA
*
actual
,
const
DIACTIONFORMATA
*
expected
)
{
DWORD
i
;
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwSize
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwActionSize
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwDataSize
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwNumActions
);
for
(
i
=
0
;
i
<
min
(
actual
->
dwNumActions
,
expected
->
dwNumActions
);
++
i
)
{
winetest_push_context
(
"action[%lu]"
,
i
);
check_diactionA_
(
line
,
actual
->
rgoAction
+
i
,
expected
->
rgoAction
+
i
);
winetest_pop_context
();
if
(
expected
->
dwActionSize
!=
sizeof
(
DIACTIONA
))
break
;
if
(
actual
->
dwActionSize
!=
sizeof
(
DIACTIONA
))
break
;
}
check_member_guid_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
guidActionMap
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwGenre
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwBufferSize
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%+ld"
,
lAxisMin
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%+ld"
,
lAxisMax
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%p"
,
hInstString
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%ld"
,
ftTimeStamp
.
dwLowDateTime
);
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%ld"
,
ftTimeStamp
.
dwHighDateTime
);
todo_wine
check_member_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
"%#lx"
,
dwCRC
);
check_member_str_
(
__FILE__
,
line
,
*
actual
,
*
expected
,
tszActionMap
);
}
static
void
test_sys_keyboard
(
DWORD
version
)
{
const
DIDEVCAPS
expect_caps
=
...
...
@@ -2213,6 +2271,64 @@ skip_key_tests:
localized
=
old_localized
;
}
static
void
test_sys_keyboard_action_format
(
void
)
{
DIACTIONA
actions
[]
=
{
{.
uAppData
=
0x1
,
.
dwSemantic
=
0x810004c8
,
.
dwFlags
=
DIA_APPNOMAP
},
{.
uAppData
=
0x1
,
.
dwSemantic
=
0x81000448
,
.
dwFlags
=
0
},
};
const
DIACTIONA
expect_actions
[
ARRAY_SIZE
(
actions
)]
=
{
{.
uAppData
=
0x1
,
.
dwSemantic
=
0x810004c8
,
.
dwFlags
=
0
,
.
guidInstance
=
GUID_SysKeyboard
,
.
dwObjID
=
0xc804
,
.
dwHow
=
DIAH_DEFAULT
},
{.
uAppData
=
0x1
,
.
dwSemantic
=
0x81000448
,
.
dwFlags
=
0
,
.
guidInstance
=
GUID_SysKeyboard
,
.
dwObjID
=
0x4804
,
.
dwHow
=
DIAH_DEFAULT
},
};
DIACTIONFORMATA
action_format
=
{
.
dwSize
=
sizeof
(
DIACTIONFORMATA
),
.
dwActionSize
=
sizeof
(
DIACTIONA
),
.
dwNumActions
=
ARRAY_SIZE
(
actions
),
.
dwDataSize
=
ARRAY_SIZE
(
actions
)
*
4
,
.
rgoAction
=
actions
,
.
dwGenre
=
0x1000000
,
.
guidActionMap
=
GUID_keyboard_action_mapping
,
};
const
DIACTIONFORMATA
expect_action_format
=
{
.
dwSize
=
sizeof
(
DIACTIONFORMATA
),
.
dwActionSize
=
sizeof
(
DIACTIONA
),
.
dwNumActions
=
ARRAY_SIZE
(
expect_actions
),
.
dwDataSize
=
ARRAY_SIZE
(
expect_actions
)
*
4
,
.
rgoAction
=
(
DIACTIONA
*
)
expect_actions
,
.
dwGenre
=
0x1000000
,
.
guidActionMap
=
GUID_keyboard_action_mapping
,
.
dwCRC
=
0x68e7e227
,
};
IDirectInputDevice8A
*
device
;
IDirectInput8A
*
dinput
;
HRESULT
hr
;
LONG
ref
;
hr
=
DirectInput8Create
(
instance
,
0x800
,
&
IID_IDirectInput8A
,
(
void
**
)
&
dinput
,
NULL
);
ok
(
hr
==
DI_OK
,
"CreateDevice returned %#lx
\n
"
,
hr
);
hr
=
IDirectInput_CreateDevice
(
dinput
,
&
GUID_SysKeyboard
,
&
device
,
NULL
);
ok
(
hr
==
DI_OK
,
"CreateDevice returned %#lx
\n
"
,
hr
);
ref
=
IDirectInput_Release
(
dinput
);
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
hr
=
IDirectInputDevice8_BuildActionMap
(
device
,
&
action_format
,
NULL
,
2
);
ok
(
hr
==
DI_OK
,
"BuildActionMap returned %#lx
\n
"
,
hr
);
check_diactionformatA
(
&
action_format
,
&
expect_action_format
);
hr
=
IDirectInputDevice8_SetActionMap
(
device
,
&
action_format
,
NULL
,
2
);
ok
(
hr
==
DI_SETTINGSNOTSAVED
,
"SetActionMap returned %#lx
\n
"
,
hr
);
hr
=
IDirectInputDevice8_SetActionMap
(
device
,
&
action_format
,
NULL
,
0
);
ok
(
hr
==
DI_OK
,
"SetActionMap returned %#lx
\n
"
,
hr
);
ref
=
IDirectInputDevice8_Release
(
device
);
ok
(
ref
==
0
,
"Release returned %ld
\n
"
,
ref
);
}
START_TEST
(
device8
)
{
dinput_test_init
();
...
...
@@ -2233,6 +2349,8 @@ START_TEST(device8)
test_sys_keyboard
(
0x700
);
test_sys_keyboard
(
0x800
);
test_sys_keyboard_action_format
();
test_mouse_keyboard
();
test_keyboard_events
();
test_appdata_property
();
...
...
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