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
a85f66e7
Commit
a85f66e7
authored
Jul 08, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Jul 11, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput8/tests: Tests for EnumDevicesBySemantics with different enumeration flags.
parent
88ff0e81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
5 deletions
+58
-5
device.c
dlls/dinput8/tests/device.c
+58
-5
No files found.
dlls/dinput8/tests/device.c
View file @
a85f66e7
...
...
@@ -187,6 +187,28 @@ static BOOL CALLBACK enumeration_callback(
return
DIENUM_CONTINUE
;
}
/* A simpler callback function used to count and check
the enumeration of devices.
*/
static
BOOL
CALLBACK
counting_callback
(
LPCDIDEVICEINSTANCE
lpddi
,
LPDIRECTINPUTDEVICE8
lpdid
,
DWORD
dwFlags
,
DWORD
dwRemaining
,
LPVOID
pvRef
)
{
struct
enum_data
*
data
=
pvRef
;
if
(
!
data
)
return
DIENUM_CONTINUE
;
data
->
ndevices
++
;
if
(
IsEqualGUID
(
&
lpddi
->
guidInstance
,
&
GUID_SysKeyboard
))
data
->
keyboard
=
lpdid
;
if
(
IsEqualGUID
(
&
lpddi
->
guidInstance
,
&
GUID_SysMouse
))
data
->
mouse
=
lpdid
;
return
DIENUM_CONTINUE
;
}
static
void
test_action_mapping
(
void
)
{
...
...
@@ -194,7 +216,8 @@ static void test_action_mapping(void)
HINSTANCE
hinst
=
GetModuleHandle
(
NULL
);
LPDIRECTINPUT8
pDI
=
NULL
;
DIACTIONFORMAT
af
;
struct
enum_data
data
=
{
pDI
,
&
af
,
NULL
,
NULL
,
0
};
struct
enum_data
data
=
{
pDI
,
&
af
,
NULL
,
NULL
,
0
};
struct
enum_data
count
=
{
pDI
,
&
af
,
NULL
,
NULL
,
0
};
hr
=
CoCreateInstance
(
&
CLSID_DirectInput8
,
0
,
1
,
&
IID_IDirectInput8A
,
(
LPVOID
*
)
&
pDI
);
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
...
...
@@ -226,12 +249,42 @@ static void test_action_mapping(void)
af
.
dwGenre
=
0x01000000
;
/* DIVIRTUAL_DRIVING_RACE */
af
.
dwBufferSize
=
32
;
hr
=
IDirectInput8_EnumDevicesBySemantics
(
pDI
,
0
,
&
af
,
enumeration_callback
,
&
data
,
0
);
/* Test enumerating all attached and installed devices */
count
.
keyboard
=
NULL
;
count
.
mouse
=
NULL
;
count
.
ndevices
=
0
;
hr
=
IDirectInput8_EnumDevicesBySemantics
(
pDI
,
0
,
&
af
,
counting_callback
,
&
count
,
DIEDBSFL_ATTACHEDONLY
);
ok
(
count
.
ndevices
>
0
,
"EnumDevicesBySemantics did not call the callback hr=%08x
\n
"
,
hr
);
ok
(
count
.
keyboard
!=
NULL
,
"EnumDevicesBySemantics should enumerate the keyboard
\n
"
);
ok
(
count
.
mouse
!=
NULL
,
"EnumDevicesBySemantics should enumerate the mouse
\n
"
);
/* Enumerate Force feedback devices. We should get no mouse nor keyboard */
count
.
keyboard
=
NULL
;
count
.
mouse
=
NULL
;
hr
=
IDirectInput8_EnumDevicesBySemantics
(
pDI
,
0
,
&
af
,
counting_callback
,
&
count
,
DIEDBSFL_FORCEFEEDBACK
);
ok
(
SUCCEEDED
(
hr
),
"EnumDevicesBySemantics failed hr=%08x
\n
"
,
hr
);
todo_wine
ok
(
count
.
keyboard
==
NULL
,
"Keyboard should not be enumerated when asking for forcefeedback
\n
"
);
todo_wine
ok
(
count
.
mouse
==
NULL
,
"Mouse should not be enumerated when asking for forcefeedback
\n
"
);
/* Enumerate available devices. That is devices with not owned by any user.
Before setting the action map for all devices we still have them available.
*/
count
.
ndevices
=
0
;
hr
=
IDirectInput8_EnumDevicesBySemantics
(
pDI
,
0
,
&
af
,
counting_callback
,
&
count
,
DIEDBSFL_AVAILABLEDEVICES
);
ok
(
SUCCEEDED
(
hr
),
"EnumDevicesBySemantics failed hr=%08x
\n
"
,
hr
);
ok
(
count
.
ndevices
>
0
,
"There should be devices available before action mapping available=%d
\n
"
,
count
.
ndevices
);
/* This enumeration builds and sets the action map for all devices */
hr
=
IDirectInput8_EnumDevicesBySemantics
(
pDI
,
0
,
&
af
,
enumeration_callback
,
&
data
,
DIEDBSFL_ATTACHEDONLY
);
ok
(
SUCCEEDED
(
hr
),
"EnumDevicesBySemantics failed: hr=%08x
\n
"
,
hr
);
ok
(
data
.
ndevices
>
0
,
"EnumDevicesBySemantics did not call the callback hr=%08x
\n
"
,
hr
);
ok
(
data
.
keyboard
!=
NULL
,
"EnumDevicesBySemantics should enumerate the keyboard
\n
"
);
ok
(
data
.
mouse
!=
NULL
,
"EnumDevicesBySemantics should enumerate the mouse
\n
"
);
/* After a succesfull action mapping we should have no devices available */
count
.
ndevices
=
0
;
hr
=
IDirectInput8_EnumDevicesBySemantics
(
pDI
,
0
,
&
af
,
counting_callback
,
&
count
,
DIEDBSFL_AVAILABLEDEVICES
);
ok
(
SUCCEEDED
(
hr
),
"EnumDevicesBySemantics failed hr=%08x
\n
"
,
hr
);
todo_wine
ok
(
count
.
ndevices
==
0
,
"No device should be available after action mapping available=%d
\n
"
,
count
.
ndevices
);
/* Use the devices we collect for some tests */
if
(
data
.
keyboard
!=
NULL
)
{
/* Test keyboard BuildActionMap */
...
...
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