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
f5e9079e
Commit
f5e9079e
authored
Jun 02, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput/tests: Use dinput_test_(init|exit) for all tests.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
4e04c710
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
93 additions
and
114 deletions
+93
-114
device.c
dlls/dinput/tests/device.c
+12
-8
device8.c
dlls/dinput/tests/device8.c
+6
-32
dinput.c
dlls/dinput/tests/dinput.c
+0
-0
dinput_test.h
dlls/dinput/tests/dinput_test.h
+2
-1
force_feedback.c
dlls/dinput/tests/force_feedback.c
+1
-3
hid.c
dlls/dinput/tests/hid.c
+32
-20
hotplug.c
dlls/dinput/tests/hotplug.c
+1
-3
joystick.c
dlls/dinput/tests/joystick.c
+15
-17
joystick8.c
dlls/dinput/tests/joystick8.c
+1
-3
keyboard.c
dlls/dinput/tests/keyboard.c
+11
-16
mouse.c
dlls/dinput/tests/mouse.c
+12
-11
No files found.
dlls/dinput/tests/device.c
View file @
f5e9079e
...
@@ -18,14 +18,19 @@
...
@@ -18,14 +18,19 @@
#define DIRECTINPUT_VERSION 0x0700
#define DIRECTINPUT_VERSION 0x0700
#define COBJMACROS
#include <stdarg.h>
#include <windows.h>
#include <stddef.h>
#include <limits.h>
#include "wine/test.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "windef.h"
#include "winbase.h"
#define COBJMACROS
#include "dinput.h"
#include "dinput.h"
#include
<limits.h>
#include
"dinput_test.h"
static
const
DIOBJECTDATAFORMAT
obj_data_format
[]
=
{
static
const
DIOBJECTDATAFORMAT
obj_data_format
[]
=
{
{
&
GUID_YAxis
,
16
,
DIDFT_OPTIONAL
|
DIDFT_AXIS
|
DIDFT_MAKEINSTANCE
(
1
),
0
},
{
&
GUID_YAxis
,
16
,
DIDFT_OPTIONAL
|
DIDFT_AXIS
|
DIDFT_MAKEINSTANCE
(
1
),
0
},
...
@@ -465,7 +470,6 @@ static void device_tests(void)
...
@@ -465,7 +470,6 @@ static void device_tests(void)
{
{
HRESULT
hr
;
HRESULT
hr
;
IDirectInputA
*
pDI
=
NULL
,
*
obj
=
NULL
;
IDirectInputA
*
pDI
=
NULL
,
*
obj
=
NULL
;
HINSTANCE
hInstance
=
GetModuleHandleW
(
NULL
);
HWND
hwnd
;
HWND
hwnd
;
struct
enum_data
data
;
struct
enum_data
data
;
...
@@ -478,7 +482,7 @@ static void device_tests(void)
...
@@ -478,7 +482,7 @@ static void device_tests(void)
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreateA() failed: %#lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreateA() failed: %#lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInput_Initialize
(
pDI
,
hI
nstance
,
DIRECTINPUT_VERSION
);
hr
=
IDirectInput_Initialize
(
pDI
,
i
nstance
,
DIRECTINPUT_VERSION
);
ok
(
SUCCEEDED
(
hr
),
"Initialize() failed: %#lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"Initialize() failed: %#lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
...
@@ -521,9 +525,9 @@ static void device_tests(void)
...
@@ -521,9 +525,9 @@ static void device_tests(void)
START_TEST
(
device
)
START_TEST
(
device
)
{
{
CoInitialize
(
NULL
);
dinput_test_init
(
);
device_tests
();
device_tests
();
CoUninitialize
();
dinput_test_exit
();
}
}
dlls/dinput/tests/device8.c
View file @
f5e9079e
...
@@ -31,10 +31,7 @@
...
@@ -31,10 +31,7 @@
#include "dinput.h"
#include "dinput.h"
#include "hidusage.h"
#include "hidusage.h"
#include "wine/test.h"
#include "dinput_test.h"
static
HINSTANCE
instance
;
static
BOOL
localized
;
/* object names get translated */
struct
enum_data
{
struct
enum_data
{
IDirectInput8A
*
pDI
;
IDirectInput8A
*
pDI
;
...
@@ -382,7 +379,6 @@ static void test_appdata_property_vs_map(struct enum_data *data)
...
@@ -382,7 +379,6 @@ static void test_appdata_property_vs_map(struct enum_data *data)
static
void
test_action_mapping
(
void
)
static
void
test_action_mapping
(
void
)
{
{
HRESULT
hr
;
HRESULT
hr
;
HINSTANCE
hinst
=
GetModuleHandleA
(
NULL
);
IDirectInput8A
*
pDI
=
NULL
;
IDirectInput8A
*
pDI
=
NULL
;
DIACTIONFORMATA
af
;
DIACTIONFORMATA
af
;
DIPROPSTRING
dps
;
DIPROPSTRING
dps
;
...
@@ -400,7 +396,7 @@ static void test_action_mapping(void)
...
@@ -400,7 +396,7 @@ static void test_action_mapping(void)
ok
(
SUCCEEDED
(
hr
),
"DirectInput8 Create failed: hr=%#lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"DirectInput8 Create failed: hr=%#lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInput8_Initialize
(
pDI
,
hinst
,
DIRECTINPUT_VERSION
);
hr
=
IDirectInput8_Initialize
(
pDI
,
instance
,
DIRECTINPUT_VERSION
);
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
hr
==
DIERR_BETADIRECTINPUTVERSION
)
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
hr
==
DIERR_BETADIRECTINPUTVERSION
)
{
{
win_skip
(
"ActionMapping requires dinput8
\n
"
);
win_skip
(
"ActionMapping requires dinput8
\n
"
);
...
@@ -520,7 +516,6 @@ static void test_action_mapping(void)
...
@@ -520,7 +516,6 @@ static void test_action_mapping(void)
static
void
test_save_settings
(
void
)
static
void
test_save_settings
(
void
)
{
{
HRESULT
hr
;
HRESULT
hr
;
HINSTANCE
hinst
=
GetModuleHandleA
(
NULL
);
IDirectInput8A
*
pDI
=
NULL
;
IDirectInput8A
*
pDI
=
NULL
;
DIACTIONFORMATA
af
;
DIACTIONFORMATA
af
;
IDirectInputDevice8A
*
pKey
;
IDirectInputDevice8A
*
pKey
;
...
@@ -552,7 +547,7 @@ static void test_save_settings(void)
...
@@ -552,7 +547,7 @@ static void test_save_settings(void)
ok
(
SUCCEEDED
(
hr
),
"DirectInput8 Create failed: hr=%#lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"DirectInput8 Create failed: hr=%#lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInput8_Initialize
(
pDI
,
hinst
,
DIRECTINPUT_VERSION
);
hr
=
IDirectInput8_Initialize
(
pDI
,
instance
,
DIRECTINPUT_VERSION
);
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
hr
==
DIERR_BETADIRECTINPUTVERSION
)
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
hr
==
DIERR_BETADIRECTINPUTVERSION
)
{
{
win_skip
(
"ActionMapping requires dinput8
\n
"
);
win_skip
(
"ActionMapping requires dinput8
\n
"
);
...
@@ -955,7 +950,6 @@ static void test_keyboard_events(void)
...
@@ -955,7 +950,6 @@ static void test_keyboard_events(void)
static
void
test_appdata_property
(
void
)
static
void
test_appdata_property
(
void
)
{
{
HRESULT
hr
;
HRESULT
hr
;
HINSTANCE
hinst
=
GetModuleHandleA
(
NULL
);
IDirectInputDevice8A
*
di_keyboard
;
IDirectInputDevice8A
*
di_keyboard
;
IDirectInput8A
*
pDI
=
NULL
;
IDirectInput8A
*
pDI
=
NULL
;
HWND
hwnd
;
HWND
hwnd
;
...
@@ -973,7 +967,7 @@ static void test_appdata_property(void)
...
@@ -973,7 +967,7 @@ static void test_appdata_property(void)
ok
(
SUCCEEDED
(
hr
),
"DirectInput8 Create failed: hr=%#lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"DirectInput8 Create failed: hr=%#lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInput8_Initialize
(
pDI
,
hinst
,
DIRECTINPUT_VERSION
);
hr
=
IDirectInput8_Initialize
(
pDI
,
instance
,
DIRECTINPUT_VERSION
);
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
hr
==
DIERR_BETADIRECTINPUTVERSION
)
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
||
hr
==
DIERR_BETADIRECTINPUTVERSION
)
{
{
win_skip
(
"DIPROP_APPDATA requires dinput8
\n
"
);
win_skip
(
"DIPROP_APPDATA requires dinput8
\n
"
);
...
@@ -1054,24 +1048,6 @@ static void test_appdata_property(void)
...
@@ -1054,24 +1048,6 @@ static void test_appdata_property(void)
IDirectInput_Release
(
pDI
);
IDirectInput_Release
(
pDI
);
}
}
#define check_member_( file, line, val, exp, fmt, member ) \
ok_( file, line )((val).member == (exp).member, "got " #member " " fmt ", expected " fmt "\n", \
(val).member, (exp).member)
#define check_member( val, exp, fmt, member ) \
check_member_( __FILE__, __LINE__, val, exp, fmt, member )
#define check_member_guid_( file, line, val, exp, member ) \
ok_( file, line )(IsEqualGUID( &(val).member, &(exp).member ), "got " #member " %s, expected %s\n", \
debugstr_guid( &(val).member ), debugstr_guid( &(exp).member ))
#define check_member_guid( val, exp, member ) \
check_member_guid_( __FILE__, __LINE__, val, exp, member )
#define check_member_wstr_( file, line, val, exp, member ) \
ok_( file, line )(!wcscmp( (val).member, (exp).member ), "got " #member " %s, expected %s\n", \
debugstr_w((val).member), debugstr_w((exp).member))
#define check_member_wstr( val, exp, member ) \
check_member_wstr_( __FILE__, __LINE__, val, exp, member )
struct
check_objects_todos
struct
check_objects_todos
{
{
BOOL
offset
;
BOOL
offset
;
...
@@ -1838,9 +1814,7 @@ static void test_keyboard_info(void)
...
@@ -1838,9 +1814,7 @@ static void test_keyboard_info(void)
START_TEST
(
device8
)
START_TEST
(
device8
)
{
{
instance
=
GetModuleHandleW
(
NULL
);
dinput_test_init
();
CoInitialize
(
NULL
);
test_mouse_info
();
test_mouse_info
();
test_keyboard_info
();
test_keyboard_info
();
...
@@ -1850,5 +1824,5 @@ START_TEST(device8)
...
@@ -1850,5 +1824,5 @@ START_TEST(device8)
test_keyboard_events
();
test_keyboard_events
();
test_appdata_property
();
test_appdata_property
();
CoUninitialize
();
dinput_test_exit
();
}
}
dlls/dinput/tests/dinput.c
View file @
f5e9079e
This diff is collapsed.
Click to expand it.
dlls/dinput/tests/dinput_test.h
View file @
f5e9079e
...
@@ -50,6 +50,7 @@ extern const GUID expect_guid_product;
...
@@ -50,6 +50,7 @@ extern const GUID expect_guid_product;
extern
const
WCHAR
expect_path
[];
extern
const
WCHAR
expect_path
[];
extern
const
WCHAR
expect_path_end
[];
extern
const
WCHAR
expect_path_end
[];
extern
typeof
(
DirectInputCreateEx
)
*
pDirectInputCreateEx
;
extern
HANDLE
device_added
,
device_removed
;
extern
HANDLE
device_added
,
device_removed
;
extern
HINSTANCE
instance
;
extern
HINSTANCE
instance
;
extern
BOOL
localized
;
/* object names get translated */
extern
BOOL
localized
;
/* object names get translated */
...
@@ -62,7 +63,7 @@ void bus_device_stop(void);
...
@@ -62,7 +63,7 @@ void bus_device_stop(void);
void
cleanup_registry_keys
(
void
);
void
cleanup_registry_keys
(
void
);
#define dinput_test_init() dinput_test_init_( __FILE__, __LINE__ )
#define dinput_test_init() dinput_test_init_( __FILE__, __LINE__ )
BOOL
dinput_test_init_
(
const
char
*
file
,
int
line
);
void
dinput_test_init_
(
const
char
*
file
,
int
line
);
void
dinput_test_exit
(
void
);
void
dinput_test_exit
(
void
);
HRESULT
dinput_test_create_device
(
DWORD
version
,
DIDEVICEINSTANCEW
*
devinst
,
IDirectInputDevice8W
**
device
);
HRESULT
dinput_test_create_device
(
DWORD
version
,
DIDEVICEINSTANCEW
*
devinst
,
IDirectInputDevice8W
**
device
);
...
...
dlls/dinput/tests/force_feedback.c
View file @
f5e9079e
...
@@ -6405,10 +6405,9 @@ done:
...
@@ -6405,10 +6405,9 @@ done:
START_TEST
(
force_feedback
)
START_TEST
(
force_feedback
)
{
{
if
(
!
dinput_test_init
())
return
;
dinput_test_init
()
;
if
(
!
bus_device_start
())
goto
done
;
if
(
!
bus_device_start
())
goto
done
;
CoInitialize
(
NULL
);
if
(
test_force_feedback_joystick
(
0x800
))
if
(
test_force_feedback_joystick
(
0x800
))
{
{
test_force_feedback_joystick
(
0x500
);
test_force_feedback_joystick
(
0x500
);
...
@@ -6416,7 +6415,6 @@ START_TEST( force_feedback )
...
@@ -6416,7 +6415,6 @@ START_TEST( force_feedback )
test_device_managed_effect
();
test_device_managed_effect
();
test_windows_gaming_input
();
test_windows_gaming_input
();
}
}
CoUninitialize
();
done
:
done
:
bus_device_stop
();
bus_device_stop
();
...
...
dlls/dinput/tests/hid.c
View file @
f5e9079e
...
@@ -44,7 +44,6 @@
...
@@ -44,7 +44,6 @@
#include "objbase.h"
#include "objbase.h"
#define COBJMACROS
#define COBJMACROS
#include "dinput.h"
#include "initguid.h"
#include "initguid.h"
#include "ddk/wdm.h"
#include "ddk/wdm.h"
...
@@ -52,13 +51,16 @@
...
@@ -52,13 +51,16 @@
#include "ddk/hidsdi.h"
#include "ddk/hidsdi.h"
#include "ddk/hidpi.h"
#include "ddk/hidpi.h"
#include "ddk/hidport.h"
#include "ddk/hidport.h"
#include "hidusage.h"
#include "devguid.h"
#include "devguid.h"
#include "dinput.h"
#include "dinputd.h"
#include "hidusage.h"
#include "wine/mssign.h"
#include "wine/mssign.h"
#include "dinput_test.h"
#include "dinput_test.h"
typeof
(
DirectInputCreateEx
)
*
pDirectInputCreateEx
;
HINSTANCE
instance
;
HINSTANCE
instance
;
BOOL
localized
;
/* object names get translated */
BOOL
localized
;
/* object names get translated */
...
@@ -475,6 +477,8 @@ void bus_device_stop(void)
...
@@ -475,6 +477,8 @@ void bus_device_stop(void)
DWORD
size
;
DWORD
size
;
BOOL
ret
;
BOOL
ret
;
if
(
!
test_data
)
return
;
set
=
SetupDiCreateDeviceInfoList
(
NULL
,
NULL
);
set
=
SetupDiCreateDeviceInfoList
(
NULL
,
NULL
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to create device list, error %lu
\n
"
,
GetLastError
()
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"failed to create device list, error %lu
\n
"
,
GetLastError
()
);
...
@@ -600,6 +604,8 @@ BOOL bus_device_start(void)
...
@@ -600,6 +604,8 @@ BOOL bus_device_start(void)
HDEVINFO
set
;
HDEVINFO
set
;
FILE
*
f
;
FILE
*
f
;
if
(
!
test_data
)
return
FALSE
;
old_mute_threshold
=
winetest_mute_threshold
;
old_mute_threshold
=
winetest_mute_threshold
;
winetest_mute_threshold
=
1
;
winetest_mute_threshold
=
1
;
...
@@ -3459,52 +3465,56 @@ DWORD WINAPI monitor_thread_proc( void *stop_event )
...
@@ -3459,52 +3465,56 @@ DWORD WINAPI monitor_thread_proc( void *stop_event )
return
0
;
return
0
;
}
}
BOOL
dinput_test_init_
(
const
char
*
file
,
int
line
)
void
dinput_test_init_
(
const
char
*
file
,
int
line
)
{
{
BOOL
is_wow64
;
BOOL
is_wow64
;
monitor_stop
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
monitor_stop
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
monitor_stop
,
"CreateEventW failed, error %lu
\n
"
,
GetLastError
()
);
ok
_
(
file
,
line
)
(
!!
monitor_stop
,
"CreateEventW failed, error %lu
\n
"
,
GetLastError
()
);
device_added
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
device_added
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
device_added
,
"CreateEventW failed, error %lu
\n
"
,
GetLastError
()
);
ok
_
(
file
,
line
)
(
!!
device_added
,
"CreateEventW failed, error %lu
\n
"
,
GetLastError
()
);
device_removed
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
device_removed
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
!!
device_removed
,
"CreateEventW failed, error %lu
\n
"
,
GetLastError
()
);
ok
_
(
file
,
line
)
(
!!
device_removed
,
"CreateEventW failed, error %lu
\n
"
,
GetLastError
()
);
monitor_thread
=
CreateThread
(
NULL
,
0
,
monitor_thread_proc
,
monitor_stop
,
0
,
NULL
);
monitor_thread
=
CreateThread
(
NULL
,
0
,
monitor_thread_proc
,
monitor_stop
,
0
,
NULL
);
ok
(
!!
monitor_thread
,
"CreateThread failed, error %lu
\n
"
,
GetLastError
()
);
ok_
(
file
,
line
)(
!!
monitor_thread
,
"CreateThread failed, error %lu
\n
"
,
GetLastError
()
);
CoInitialize
(
NULL
);
subtest_
(
file
,
line
)(
"hid"
);
instance
=
GetModuleHandleW
(
NULL
);
instance
=
GetModuleHandleW
(
NULL
);
localized
=
GetUserDefaultLCID
()
!=
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
);
localized
=
GetUserDefaultLCID
()
!=
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_DEFAULT
);
pSignerSign
=
(
void
*
)
GetProcAddress
(
LoadLibraryW
(
L"mssign32"
),
"SignerSign"
);
pSignerSign
=
(
void
*
)
GetProcAddress
(
LoadLibraryW
(
L"mssign32"
),
"SignerSign"
);
pDirectInputCreateEx
=
(
void
*
)
GetProcAddress
(
LoadLibraryW
(
L"dinput.dll"
),
"DirectInputCreateEx"
);
if
(
IsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
)
&&
is_wow64
)
if
(
IsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
)
&&
is_wow64
)
{
{
skip
(
"Running in WoW
64.
\n
"
);
skip
_
(
file
,
line
)(
"Skipping driver tests: running in wow
64.
\n
"
);
return
FALSE
;
return
;
}
}
test_data_mapping
=
CreateFileMappingW
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
test_data_mapping
=
CreateFileMappingW
(
INVALID_HANDLE_VALUE
,
NULL
,
PAGE_READWRITE
,
0
,
sizeof
(
*
test_data
),
L"Global
\\
winetest_dinput_section"
);
sizeof
(
*
test_data
),
L"Global
\\
winetest_dinput_section"
);
if
(
!
test_data_mapping
&&
GetLastError
()
==
ERROR_ACCESS_DENIED
)
if
(
!
test_data_mapping
&&
GetLastError
()
==
ERROR_ACCESS_DENIED
)
{
{
win_skip
(
"Failed to create test data
mapping.
\n
"
);
win_skip
_
(
file
,
line
)(
"Skipping driver tests: failed to create
mapping.
\n
"
);
return
FALSE
;
return
;
}
}
ok
(
!!
test_data_mapping
,
"got error %lu
\n
"
,
GetLastError
()
);
ok_
(
file
,
line
)(
!!
test_data_mapping
,
"got error %lu
\n
"
,
GetLastError
()
);
test_data
=
MapViewOfFile
(
test_data_mapping
,
FILE_MAP_READ
|
FILE_MAP_WRITE
,
0
,
0
,
1024
);
test_data
=
MapViewOfFile
(
test_data_mapping
,
FILE_MAP_READ
|
FILE_MAP_WRITE
,
0
,
0
,
1024
);
ok_
(
file
,
line
)(
!!
test_data
,
"MapViewOfFile failed, error %lu
\n
"
,
GetLastError
()
);
test_data
->
running_under_wine
=
!
strcmp
(
winetest_platform
,
"wine"
);
test_data
->
running_under_wine
=
!
strcmp
(
winetest_platform
,
"wine"
);
test_data
->
winetest_report_success
=
winetest_report_success
;
test_data
->
winetest_report_success
=
winetest_report_success
;
test_data
->
winetest_debug
=
winetest_debug
;
test_data
->
winetest_debug
=
winetest_debug
;
okfile
=
CreateFileW
(
L"C:
\\
windows
\\
winetest_dinput_okfile"
,
GENERIC_READ
|
GENERIC_WRITE
,
okfile
=
CreateFileW
(
L"C:
\\
windows
\\
winetest_dinput_okfile"
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
ok
(
okfile
!=
INVALID_HANDLE_VALUE
,
"failed to create file, error %lu
\n
"
,
GetLastError
()
);
ok
_
(
file
,
line
)
(
okfile
!=
INVALID_HANDLE_VALUE
,
"failed to create file, error %lu
\n
"
,
GetLastError
()
);
subtest
(
"driver
"
);
subtest
_
(
file
,
line
)(
"hid
"
);
subtest
(
"driver_bus
"
);
subtest
_
(
file
,
line
)(
"driver
"
);
subtest
(
"driver_hid
"
);
subtest
_
(
file
,
line
)(
"driver_bus
"
);
subtest
(
"driver_hid_poll
"
);
subtest
_
(
file
,
line
)(
"driver_hid
"
);
return
TRUE
;
subtest_
(
file
,
line
)(
"driver_hid_poll"
)
;
}
}
void
dinput_test_exit
(
void
)
void
dinput_test_exit
(
void
)
...
@@ -3520,6 +3530,8 @@ void dinput_test_exit(void)
...
@@ -3520,6 +3530,8 @@ void dinput_test_exit(void)
CloseHandle
(
monitor_stop
);
CloseHandle
(
monitor_stop
);
CloseHandle
(
device_removed
);
CloseHandle
(
device_removed
);
CloseHandle
(
device_added
);
CloseHandle
(
device_added
);
CoUninitialize
();
}
}
BOOL
CALLBACK
find_test_device
(
const
DIDEVICEINSTANCEW
*
devinst
,
void
*
context
)
BOOL
CALLBACK
find_test_device
(
const
DIDEVICEINSTANCEW
*
devinst
,
void
*
context
)
...
@@ -3931,7 +3943,7 @@ done:
...
@@ -3931,7 +3943,7 @@ done:
START_TEST
(
hid
)
START_TEST
(
hid
)
{
{
if
(
!
dinput_test_init
())
return
;
dinput_test_init
()
;
test_bus_driver
();
test_bus_driver
();
...
...
dlls/dinput/tests/hotplug.c
View file @
f5e9079e
...
@@ -1218,10 +1218,9 @@ next:
...
@@ -1218,10 +1218,9 @@ next:
START_TEST
(
hotplug
)
START_TEST
(
hotplug
)
{
{
if
(
!
dinput_test_init
())
return
;
dinput_test_init
()
;
if
(
!
bus_device_start
())
goto
done
;
if
(
!
bus_device_start
())
goto
done
;
CoInitialize
(
NULL
);
if
(
test_input_lost
(
0x500
))
if
(
test_input_lost
(
0x500
))
{
{
test_input_lost
(
0x700
);
test_input_lost
(
0x700
);
...
@@ -1230,7 +1229,6 @@ START_TEST( hotplug )
...
@@ -1230,7 +1229,6 @@ START_TEST( hotplug )
test_RegisterDeviceNotification
();
test_RegisterDeviceNotification
();
test_windows_gaming_input
();
test_windows_gaming_input
();
}
}
CoUninitialize
();
done
:
done
:
bus_device_stop
();
bus_device_stop
();
...
...
dlls/dinput/tests/joystick.c
View file @
f5e9079e
...
@@ -18,18 +18,19 @@
...
@@ -18,18 +18,19 @@
#define DIRECTINPUT_VERSION 0x0700
#define DIRECTINPUT_VERSION 0x0700
#define COBJMACROS
#include <stdarg.h>
#include <windows.h>
#include <stddef.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "wine/test.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "windef.h"
#include "wingdi.h"
#include "winbase.h"
#define COBJMACROS
#include "dinput.h"
#include "dinput.h"
#include "dinput_test.h"
typedef
struct
tagUserData
{
typedef
struct
tagUserData
{
IDirectInputA
*
pDI
;
IDirectInputA
*
pDI
;
DWORD
version
;
DWORD
version
;
...
@@ -317,7 +318,6 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
...
@@ -317,7 +318,6 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
LPDIRECTINPUTEFFECT
effect
=
NULL
;
LPDIRECTINPUTEFFECT
effect
=
NULL
;
LONG
cnt1
,
cnt2
;
LONG
cnt1
,
cnt2
;
HWND
real_hWnd
;
HWND
real_hWnd
;
HINSTANCE
hInstance
=
GetModuleHandleW
(
NULL
);
DIPROPDWORD
dip_gain_set
,
dip_gain_get
;
DIPROPDWORD
dip_gain_set
,
dip_gain_get
;
struct
effect_enum
effect_data
;
struct
effect_enum
effect_data
;
...
@@ -549,7 +549,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
...
@@ -549,7 +549,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
* - a visible window
* - a visible window
*/
*/
real_hWnd
=
CreateWindowExA
(
0
,
"EDIT"
,
"Test text"
,
0
,
10
,
10
,
300
,
300
,
NULL
,
NULL
,
real_hWnd
=
CreateWindowExA
(
0
,
"EDIT"
,
"Test text"
,
0
,
10
,
10
,
300
,
300
,
NULL
,
NULL
,
hI
nstance
,
NULL
);
i
nstance
,
NULL
);
ok
(
real_hWnd
!=
0
,
"CreateWindowExA failed: %p
\n
"
,
real_hWnd
);
ok
(
real_hWnd
!=
0
,
"CreateWindowExA failed: %p
\n
"
,
real_hWnd
);
ShowWindow
(
real_hWnd
,
SW_SHOW
);
ShowWindow
(
real_hWnd
,
SW_SHOW
);
hr
=
IDirectInputDevice_Unacquire
(
pJoystick
);
hr
=
IDirectInputDevice_Unacquire
(
pJoystick
);
...
@@ -598,7 +598,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
...
@@ -598,7 +598,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
GUID
guid
=
{
0
};
GUID
guid
=
{
0
};
DIEFFECT
effect_empty
;
DIEFFECT
effect_empty
;
hr
=
IDirectInputEffect_Initialize
(
effect
,
hI
nstance
,
data
->
version
,
hr
=
IDirectInputEffect_Initialize
(
effect
,
i
nstance
,
data
->
version
,
&
effect_data
.
guid
);
&
effect_data
.
guid
);
ok
(
hr
==
DI_OK
,
"IDirectInputEffect_Initialize failed: %#lx
\n
"
,
hr
);
ok
(
hr
==
DI_OK
,
"IDirectInputEffect_Initialize failed: %#lx
\n
"
,
hr
);
...
@@ -915,10 +915,9 @@ static void joystick_tests(DWORD version)
...
@@ -915,10 +915,9 @@ static void joystick_tests(DWORD version)
HRESULT
hr
;
HRESULT
hr
;
IDirectInputA
*
pDI
;
IDirectInputA
*
pDI
;
ULONG
ref
;
ULONG
ref
;
HINSTANCE
hInstance
=
GetModuleHandleW
(
NULL
);
trace
(
"-- Testing Direct Input Version %#lx --
\n
"
,
version
);
trace
(
"-- Testing Direct Input Version %#lx --
\n
"
,
version
);
hr
=
DirectInputCreateA
(
hI
nstance
,
version
,
&
pDI
,
NULL
);
hr
=
DirectInputCreateA
(
i
nstance
,
version
,
&
pDI
,
NULL
);
ok
(
hr
==
DI_OK
||
hr
==
DIERR_OLDDIRECTINPUTVERSION
,
"DirectInputCreateA() failed: %#lx
\n
"
,
hr
);
ok
(
hr
==
DI_OK
||
hr
==
DIERR_OLDDIRECTINPUTVERSION
,
"DirectInputCreateA() failed: %#lx
\n
"
,
hr
);
if
(
hr
==
DI_OK
&&
pDI
!=
0
)
{
if
(
hr
==
DI_OK
&&
pDI
!=
0
)
{
UserData
data
;
UserData
data
;
...
@@ -938,9 +937,8 @@ static void test_enum_feedback(void)
...
@@ -938,9 +937,8 @@ static void test_enum_feedback(void)
HRESULT
hr
;
HRESULT
hr
;
IDirectInputA
*
pDI
;
IDirectInputA
*
pDI
;
ULONG
ref
;
ULONG
ref
;
HINSTANCE
hInstance
=
GetModuleHandleW
(
NULL
);
hr
=
DirectInputCreateA
(
hI
nstance
,
0x0700
,
&
pDI
,
NULL
);
hr
=
DirectInputCreateA
(
i
nstance
,
0x0700
,
&
pDI
,
NULL
);
ok
(
hr
==
DI_OK
||
hr
==
DIERR_OLDDIRECTINPUTVERSION
,
"DirectInputCreateA() failed: %#lx
\n
"
,
hr
);
ok
(
hr
==
DI_OK
||
hr
==
DIERR_OLDDIRECTINPUTVERSION
,
"DirectInputCreateA() failed: %#lx
\n
"
,
hr
);
if
(
hr
==
DI_OK
&&
pDI
!=
0
)
{
if
(
hr
==
DI_OK
&&
pDI
!=
0
)
{
hr
=
IDirectInput_EnumDevices
(
pDI
,
0
,
EnumAllFeedback
,
NULL
,
DIEDFL_ATTACHEDONLY
|
DIEDFL_FORCEFEEDBACK
);
hr
=
IDirectInput_EnumDevices
(
pDI
,
0
,
EnumAllFeedback
,
NULL
,
DIEDFL_ATTACHEDONLY
|
DIEDFL_FORCEFEEDBACK
);
...
@@ -953,7 +951,7 @@ static void test_enum_feedback(void)
...
@@ -953,7 +951,7 @@ static void test_enum_feedback(void)
START_TEST
(
joystick
)
START_TEST
(
joystick
)
{
{
CoInitialize
(
NULL
);
dinput_test_init
(
);
joystick_tests
(
0x0700
);
joystick_tests
(
0x0700
);
joystick_tests
(
0x0500
);
joystick_tests
(
0x0500
);
...
@@ -961,5 +959,5 @@ START_TEST(joystick)
...
@@ -961,5 +959,5 @@ START_TEST(joystick)
test_enum_feedback
();
test_enum_feedback
();
CoUninitialize
();
dinput_test_exit
();
}
}
dlls/dinput/tests/joystick8.c
View file @
f5e9079e
...
@@ -4163,10 +4163,9 @@ done:
...
@@ -4163,10 +4163,9 @@ done:
START_TEST
(
joystick8
)
START_TEST
(
joystick8
)
{
{
if
(
!
dinput_test_init
())
return
;
dinput_test_init
()
;
if
(
!
bus_device_start
())
goto
done
;
if
(
!
bus_device_start
())
goto
done
;
CoInitialize
(
NULL
);
if
(
test_device_types
(
0x800
))
if
(
test_device_types
(
0x800
))
{
{
/* This needs to be done before doing anything involving dinput.dll
/* This needs to be done before doing anything involving dinput.dll
...
@@ -4184,7 +4183,6 @@ START_TEST( joystick8 )
...
@@ -4184,7 +4183,6 @@ START_TEST( joystick8 )
test_driving_wheel_axes
();
test_driving_wheel_axes
();
test_windows_gaming_input
();
test_windows_gaming_input
();
}
}
CoUninitialize
();
done
:
done
:
bus_device_stop
();
bus_device_stop
();
...
...
dlls/dinput/tests/keyboard.c
View file @
f5e9079e
...
@@ -18,20 +18,18 @@
...
@@ -18,20 +18,18 @@
#define DIRECTINPUT_VERSION 0x0700
#define DIRECTINPUT_VERSION 0x0700
#define COBJMACROS
#include <stdarg.h>
#include <windows.h>
#include <stddef.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "wine/test.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "windef.h"
#include "wingdi.h"
#include "winbase.h"
#define COBJMACROS
#include "dinput.h"
#include "dinput.h"
/* to make things easier with PSDK without a dinput.lib */
#include "dinput_test.h"
static
HRESULT
(
WINAPI
*
pDirectInputCreateA
)(
HINSTANCE
,
DWORD
,
IDirectInputA
**
,
IUnknown
*
);
static
void
pump_messages
(
void
)
static
void
pump_messages
(
void
)
{
{
...
@@ -513,11 +511,10 @@ static void keyboard_tests(DWORD version)
...
@@ -513,11 +511,10 @@ static void keyboard_tests(DWORD version)
{
{
HRESULT
hr
;
HRESULT
hr
;
IDirectInputA
*
pDI
=
NULL
;
IDirectInputA
*
pDI
=
NULL
;
HINSTANCE
hInstance
=
GetModuleHandleW
(
NULL
);
HWND
hwnd
;
HWND
hwnd
;
ULONG
ref
=
0
;
ULONG
ref
=
0
;
hr
=
pDirectInputCreateA
(
hI
nstance
,
version
,
&
pDI
,
NULL
);
hr
=
DirectInputCreateA
(
i
nstance
,
version
,
&
pDI
,
NULL
);
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
)
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
)
{
{
skip
(
"Tests require a newer dinput version
\n
"
);
skip
(
"Tests require a newer dinput version
\n
"
);
...
@@ -554,11 +551,9 @@ static void keyboard_tests(DWORD version)
...
@@ -554,11 +551,9 @@ static void keyboard_tests(DWORD version)
START_TEST
(
keyboard
)
START_TEST
(
keyboard
)
{
{
pDirectInputCreateA
=
(
void
*
)
GetProcAddress
(
GetModuleHandleA
(
"dinput.dll"
),
"DirectInputCreateA"
);
dinput_test_init
();
CoInitialize
(
NULL
);
keyboard_tests
(
0x0700
);
keyboard_tests
(
0x0700
);
CoUninitialize
();
dinput_test_exit
();
}
}
dlls/dinput/tests/mouse.c
View file @
f5e9079e
...
@@ -19,17 +19,19 @@
...
@@ -19,17 +19,19 @@
#define DIRECTINPUT_VERSION 0x0700
#define DIRECTINPUT_VERSION 0x0700
#define COBJMACROS
#include <stdarg.h>
#include <windows.h>
#include <stddef.h>
#include <math.h>
#include <stdlib.h>
#include "wine/test.h"
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "windef.h"
#include "windef.h"
#include "wingdi.h"
#include "winbase.h"
#define COBJMACROS
#include "dinput.h"
#include "dinput.h"
#include "dinput_test.h"
static
const
HRESULT
SetCoop_null_window
[
16
]
=
{
static
const
HRESULT
SetCoop_null_window
[
16
]
=
{
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_INVALIDARG
,
E_HANDLE
,
E_HANDLE
,
E_INVALIDARG
,
E_INVALIDARG
,
E_HANDLE
,
E_HANDLE
,
E_INVALIDARG
,
...
@@ -290,11 +292,10 @@ static void mouse_tests(void)
...
@@ -290,11 +292,10 @@ static void mouse_tests(void)
{
{
HRESULT
hr
;
HRESULT
hr
;
IDirectInputA
*
pDI
=
NULL
;
IDirectInputA
*
pDI
=
NULL
;
HINSTANCE
hInstance
=
GetModuleHandleW
(
NULL
);
HWND
hwnd
;
HWND
hwnd
;
ULONG
ref
=
0
;
ULONG
ref
=
0
;
hr
=
DirectInputCreateA
(
hI
nstance
,
DIRECTINPUT_VERSION
,
&
pDI
,
NULL
);
hr
=
DirectInputCreateA
(
i
nstance
,
DIRECTINPUT_VERSION
,
&
pDI
,
NULL
);
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
)
if
(
hr
==
DIERR_OLDDIRECTINPUTVERSION
)
{
{
skip
(
"Tests require a newer dinput version
\n
"
);
skip
(
"Tests require a newer dinput version
\n
"
);
...
@@ -323,9 +324,9 @@ static void mouse_tests(void)
...
@@ -323,9 +324,9 @@ static void mouse_tests(void)
START_TEST
(
mouse
)
START_TEST
(
mouse
)
{
{
CoInitialize
(
NULL
);
dinput_test_init
(
);
mouse_tests
();
mouse_tests
();
CoUninitialize
();
dinput_test_exit
();
}
}
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