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
8d5b1dd5
Commit
8d5b1dd5
authored
Mar 07, 2014
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput8: Create a window that will receive events generated by input tests.
parent
49f3b428
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
device.c
dlls/dinput8/tests/device.c
+28
-0
No files found.
dlls/dinput8/tests/device.c
View file @
8d5b1dd5
...
...
@@ -60,6 +60,21 @@ static DIACTIONA actionMapping[]=
{
4
,
DIMOUSE_YAXIS
,
0
,
{
"Y Axis"
}
}
};
static
void
flush_events
(
void
)
{
int
diff
=
200
;
int
min_timeout
=
100
;
DWORD
time
=
GetTickCount
()
+
diff
;
while
(
diff
>
0
)
{
if
(
MsgWaitForMultipleObjects
(
0
,
NULL
,
FALSE
,
min_timeout
,
QS_ALLINPUT
)
==
WAIT_TIMEOUT
)
break
;
diff
=
time
-
GetTickCount
();
min_timeout
=
50
;
}
}
static
void
test_device_input
(
IDirectInputDevice8A
*
lpdid
,
DWORD
event_type
,
DWORD
event
,
DWORD
expected
)
{
HRESULT
hr
;
...
...
@@ -76,12 +91,14 @@ static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWO
if
(
event_type
==
INPUT_MOUSE
)
mouse_event
(
event
,
0
,
0
,
0
,
0
);
flush_events
();
IDirectInputDevice8_Poll
(
lpdid
);
hr
=
IDirectInputDevice8_GetDeviceData
(
lpdid
,
sizeof
(
obj_data
),
&
obj_data
,
&
data_size
,
0
);
if
(
data_size
!=
1
)
{
win_skip
(
"We're not able to inject input into Windows dinput8 with events
\n
"
);
IDirectInputDevice_Unacquire
(
lpdid
);
return
;
}
...
...
@@ -100,6 +117,7 @@ static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWO
mouse_event
(
MOUSEEVENTF_LEFTUP
,
1
,
1
,
0
,
0
);
}
flush_events
();
IDirectInputDevice8_Poll
(
lpdid
);
data_size
=
1
;
...
...
@@ -108,6 +126,8 @@ static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWO
data_size
=
1
;
hr
=
IDirectInputDevice8_GetDeviceData
(
lpdid
,
sizeof
(
obj_data
),
&
obj_data
,
&
data_size
,
0
);
ok
(
hr
==
DI_OK
&&
data_size
==
1
,
"GetDeviceData() failed: %08x cnt:%d
\n
"
,
hr
,
data_size
);
IDirectInputDevice_Unacquire
(
lpdid
);
}
static
void
test_build_action_map
(
IDirectInputDevice8A
*
lpdid
,
DIACTIONFORMATA
*
lpdiaf
,
...
...
@@ -256,6 +276,7 @@ static void test_action_mapping(void)
IDirectInput8A
*
pDI
=
NULL
;
DIACTIONFORMATA
af
;
struct
enum_data
data
=
{
pDI
,
&
af
,
NULL
,
NULL
,
NULL
,
0
};
HWND
hwnd
;
hr
=
CoCreateInstance
(
&
CLSID_DirectInput8
,
0
,
CLSCTX_INPROC_SERVER
,
&
IID_IDirectInput8A
,
(
LPVOID
*
)
&
pDI
);
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
...
...
@@ -296,6 +317,11 @@ static void test_action_mapping(void)
hr
=
IDirectInput8_EnumDevicesBySemantics
(
pDI
,
NULL
,
&
af
,
enumeration_callback
,
&
data
,
DIEDBSFL_ATTACHEDONLY
);
ok
(
SUCCEEDED
(
hr
),
"EnumDevicesBySemantics failed: hr=%08x
\n
"
,
hr
);
hwnd
=
CreateWindowExA
(
WS_EX_TOPMOST
,
"static"
,
"dinput"
,
WS_POPUP
|
WS_VISIBLE
,
0
,
0
,
100
,
100
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hwnd
!=
NULL
,
"failed to create window
\n
"
);
SetCursorPos
(
50
,
50
);
if
(
data
.
keyboard
!=
NULL
)
{
/* Test keyboard BuildActionMap */
...
...
@@ -326,6 +352,8 @@ static void test_action_mapping(void)
test_device_input
(
data
.
mouse
,
INPUT_MOUSE
,
MOUSEEVENTF_LEFTDOWN
,
3
);
}
DestroyWindow
(
hwnd
);
}
static
void
test_save_settings
(
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