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
b680794c
Commit
b680794c
authored
Sep 03, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
Sep 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xinput1_3/tests: Wait for the state to change before checking it.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
99614467
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
27 deletions
+57
-27
xinput.c
dlls/xinput1_3/tests/xinput.c
+57
-27
No files found.
dlls/xinput1_3/tests/xinput.c
View file @
b680794c
...
...
@@ -434,10 +434,10 @@ static void check_hid_caps(DWORD index, HANDLE device, PHIDP_PREPARSED_DATA pre
HIDP_LINK_COLLECTION_NODE
collections
[
16
];
HIDP_BUTTON_CAPS
button_caps
[
16
];
HIDP_VALUE_CAPS
value_caps
[
16
];
XINPUT_STATE
last_state
,
state
;
XINPUT_CAPABILITIES
xi_caps
;
char
buffer
[
200
]
=
{
0
};
ULONG
length
,
value
;
XINPUT_STATE
state
;
USAGE
usages
[
15
];
NTSTATUS
status
;
USHORT
count
;
...
...
@@ -637,19 +637,31 @@ static void check_hid_caps(DWORD index, HANDLE device, PHIDP_PREPARSED_DATA pre
else
if
(
attrs
->
VendorID
==
0x045e
&&
attrs
->
ProductID
==
0x02ff
)
skip
(
"skipping interactive tests (Xbox One For Windows)
\n
"
);
else
{
trace
(
"press A button on gamepad %d
\n
"
,
index
);
res
=
pXInputGetState
(
index
,
&
last_state
);
ok
(
res
==
ERROR_SUCCESS
,
"XInputGetState returned %#x
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
memset
(
buffer
,
0
,
sizeof
(
buffer
));
length
=
hid_caps
->
InputReportByteLength
;
ret
=
ReadFile
(
device
,
buffer
,
hid_caps
->
InputReportByteLength
,
&
length
,
NULL
);
ok
(
ret
,
"ReadFile failed, last error %u
\n
"
,
GetLastError
());
ok
(
length
==
hid_caps
->
InputReportByteLength
,
"ReadFile returned length %u
\n
"
,
length
);
trace
(
"press A button on gamepad %d
\n
"
,
index
);
res
=
pXInputGetState
(
index
,
&
state
);
ok
(
res
==
ERROR_SUCCESS
,
"XInputGetState returned %#x
\n
"
,
res
);
do
{
Sleep
(
5
);
res
=
pXInputGetState
(
index
,
&
state
);
ok
(
res
==
ERROR_SUCCESS
,
"XInputGetState returned %#x
\n
"
,
res
);
}
while
(
res
==
ERROR_SUCCESS
&&
state
.
dwPacketNumber
==
last_state
.
dwPacketNumber
);
ok
(
state
.
Gamepad
.
wButtons
&
XINPUT_GAMEPAD_A
,
"unexpected button state %#x
\n
"
,
state
.
Gamepad
.
wButtons
);
/* now read as many reports from the device to get a consistent final state */
for
(
i
=
0
;
i
<
(
state
.
dwPacketNumber
-
last_state
.
dwPacketNumber
);
++
i
)
{
SetLastError
(
0xdeadbeef
);
memset
(
buffer
,
0
,
sizeof
(
buffer
));
length
=
hid_caps
->
InputReportByteLength
;
ret
=
ReadFile
(
device
,
buffer
,
hid_caps
->
InputReportByteLength
,
&
length
,
NULL
);
ok
(
ret
,
"ReadFile failed, last error %u
\n
"
,
GetLastError
());
ok
(
length
==
hid_caps
->
InputReportByteLength
,
"ReadFile returned length %u
\n
"
,
length
);
}
last_state
=
state
;
length
=
ARRAY_SIZE
(
usages
);
status
=
HidP_GetUsages
(
HidP_Input
,
HID_USAGE_PAGE_BUTTON
,
0
,
usages
,
&
length
,
preparsed
,
buffer
,
hid_caps
->
InputReportByteLength
);
ok
(
status
==
HIDP_STATUS_SUCCESS
,
"HidP_GetUsages returned %#x
\n
"
,
status
);
...
...
@@ -658,17 +670,26 @@ static void check_hid_caps(DWORD index, HANDLE device, PHIDP_PREPARSED_DATA pre
trace
(
"release A on gamepad %d
\n
"
,
index
);
SetLastError
(
0xdeadbeef
);
memset
(
buffer
,
0
,
sizeof
(
buffer
));
length
=
hid_caps
->
InputReportByteLength
;
ret
=
ReadFile
(
device
,
buffer
,
hid_caps
->
InputReportByteLength
,
&
length
,
NULL
);
ok
(
ret
,
"ReadFile failed, last error %u
\n
"
,
GetLastError
());
ok
(
length
==
hid_caps
->
InputReportByteLength
,
"ReadFile returned length %u
\n
"
,
length
);
res
=
pXInputGetState
(
index
,
&
state
);
ok
(
res
==
ERROR_SUCCESS
,
"XInputGetState returned %#x
\n
"
,
res
);
do
{
Sleep
(
5
);
res
=
pXInputGetState
(
index
,
&
state
);
ok
(
res
==
ERROR_SUCCESS
,
"XInputGetState returned %#x
\n
"
,
res
);
}
while
(
res
==
ERROR_SUCCESS
&&
state
.
dwPacketNumber
==
last_state
.
dwPacketNumber
);
ok
(
!
state
.
Gamepad
.
wButtons
,
"unexpected button state %#x
\n
"
,
state
.
Gamepad
.
wButtons
);
/* now read as many reports from the device to get a consistent final state */
for
(
i
=
0
;
i
<
(
state
.
dwPacketNumber
-
last_state
.
dwPacketNumber
);
++
i
)
{
SetLastError
(
0xdeadbeef
);
memset
(
buffer
,
0
,
sizeof
(
buffer
));
length
=
hid_caps
->
InputReportByteLength
;
ret
=
ReadFile
(
device
,
buffer
,
hid_caps
->
InputReportByteLength
,
&
length
,
NULL
);
ok
(
ret
,
"ReadFile failed, last error %u
\n
"
,
GetLastError
());
ok
(
length
==
hid_caps
->
InputReportByteLength
,
"ReadFile returned length %u
\n
"
,
length
);
}
last_state
=
state
;
length
=
ARRAY_SIZE
(
usages
);
status
=
HidP_GetUsages
(
HidP_Input
,
HID_USAGE_PAGE_BUTTON
,
0
,
usages
,
&
length
,
preparsed
,
buffer
,
hid_caps
->
InputReportByteLength
);
ok
(
status
==
HIDP_STATUS_SUCCESS
,
"HidP_GetUsages returned %#x
\n
"
,
status
);
...
...
@@ -678,15 +699,24 @@ static void check_hid_caps(DWORD index, HANDLE device, PHIDP_PREPARSED_DATA pre
do
{
SetLastError
(
0xdeadbeef
);
memset
(
buffer
,
0
,
sizeof
(
buffer
));
length
=
hid_caps
->
InputReportByteLength
;
ret
=
ReadFile
(
device
,
buffer
,
hid_caps
->
InputReportByteLength
,
&
length
,
NULL
);
ok
(
ret
,
"ReadFile failed, last error %u
\n
"
,
GetLastError
()
);
ok
(
length
==
hid_caps
->
InputReportByteLength
,
"ReadFile returned length %u
\n
"
,
length
);
do
{
Sleep
(
5
)
;
res
=
pXInputGetState
(
index
,
&
state
);
ok
(
res
==
ERROR_SUCCESS
,
"XInputGetState returned %#x
\n
"
,
res
);
}
while
(
res
==
ERROR_SUCCESS
&&
state
.
dwPacketNumber
==
last_state
.
dwPacketNumber
);
res
=
pXInputGetState
(
index
,
&
state
);
ok
(
res
==
ERROR_SUCCESS
,
"XInputGetState returned %#x
\n
"
,
res
);
/* now read as many reports from the device to get a consistent final state */
for
(
i
=
0
;
i
<
(
state
.
dwPacketNumber
-
last_state
.
dwPacketNumber
);
++
i
)
{
SetLastError
(
0xdeadbeef
);
memset
(
buffer
,
0
,
sizeof
(
buffer
));
length
=
hid_caps
->
InputReportByteLength
;
ret
=
ReadFile
(
device
,
buffer
,
hid_caps
->
InputReportByteLength
,
&
length
,
NULL
);
ok
(
ret
,
"ReadFile failed, last error %u
\n
"
,
GetLastError
());
ok
(
length
==
hid_caps
->
InputReportByteLength
,
"ReadFile returned length %u
\n
"
,
length
);
}
last_state
=
state
;
value
=
0
;
status
=
HidP_GetUsageValue
(
HidP_Input
,
HID_USAGE_PAGE_GENERIC
,
0
,
HID_USAGE_GENERIC_X
,
&
value
,
preparsed
,
buffer
,
hid_caps
->
InputReportByteLength
);
...
...
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