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
b648dac7
Commit
b648dac7
authored
Jul 08, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Don't depend on the dxerr8 static library in the tests.
parent
a08bb2f0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
49 deletions
+46
-49
Makefile.in
dlls/dinput/tests/Makefile.in
+1
-1
device.c
dlls/dinput/tests/device.c
+13
-14
joystick.c
dlls/dinput/tests/joystick.c
+0
-0
keyboard.c
dlls/dinput/tests/keyboard.c
+19
-20
mouse.c
dlls/dinput/tests/mouse.c
+13
-14
No files found.
dlls/dinput/tests/Makefile.in
View file @
b648dac7
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
...
@@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR
=
@srcdir@
SRCDIR
=
@srcdir@
VPATH
=
@srcdir@
VPATH
=
@srcdir@
TESTDLL
=
dinput.dll
TESTDLL
=
dinput.dll
IMPORTS
=
d
xerr8 d
input ole32 version user32 kernel32
IMPORTS
=
dinput ole32 version user32 kernel32
CTESTS
=
\
CTESTS
=
\
device.c
\
device.c
\
...
...
dlls/dinput/tests/device.c
View file @
b648dac7
...
@@ -25,7 +25,6 @@
...
@@ -25,7 +25,6 @@
#include "windef.h"
#include "windef.h"
#include "initguid.h"
#include "initguid.h"
#include "dinput.h"
#include "dinput.h"
#include "dxerr8.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
},
...
@@ -74,13 +73,13 @@ static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd)
...
@@ -74,13 +73,13 @@ static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd)
int
cnt
=
0
,
cnt1
=
0
;
int
cnt
=
0
,
cnt1
=
0
;
hr
=
IDirectInputDevice_EnumObjects
(
device
,
enum_callback
,
&
cnt
,
DIDFT_ALL
);
hr
=
IDirectInputDevice_EnumObjects
(
device
,
enum_callback
,
&
cnt
,
DIDFT_ALL
);
ok
(
SUCCEEDED
(
hr
),
"EnumObjects() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"EnumObjects() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_SetDataFormat
(
device
,
&
data_format
);
hr
=
IDirectInputDevice_SetDataFormat
(
device
,
&
data_format
);
ok
(
SUCCEEDED
(
hr
),
"SetDataFormat() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"SetDataFormat() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_EnumObjects
(
device
,
enum_callback
,
&
cnt1
,
DIDFT_ALL
);
hr
=
IDirectInputDevice_EnumObjects
(
device
,
enum_callback
,
&
cnt1
,
DIDFT_ALL
);
ok
(
SUCCEEDED
(
hr
),
"EnumObjects() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"EnumObjects() failed: %
08x
\n
"
,
hr
);
if
(
0
)
/* fails for joystick only */
if
(
0
)
/* fails for joystick only */
ok
(
cnt
==
cnt1
,
"Enum count changed from %d to %d
\n
"
,
cnt
,
cnt1
);
ok
(
cnt
==
cnt1
,
"Enum count changed from %d to %d
\n
"
,
cnt
,
cnt1
);
...
@@ -97,19 +96,19 @@ static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd)
...
@@ -97,19 +96,19 @@ static void test_object_info(LPDIRECTINPUTDEVICE device, HWND hwnd)
dp
.
diph
.
dwObj
=
16
;
dp
.
diph
.
dwObj
=
16
;
dp
.
dwData
=
DIPROPAXISMODE_ABS
;
dp
.
dwData
=
DIPROPAXISMODE_ABS
;
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
ok
(
hr
==
DIERR_UNSUPPORTED
,
"SetProperty() returned: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_UNSUPPORTED
,
"SetProperty() returned: %
08x
\n
"
,
hr
);
dp
.
diph
.
dwHow
=
DIPH_DEVICE
;
dp
.
diph
.
dwHow
=
DIPH_DEVICE
;
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"SetProperty() returned: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"SetProperty() returned: %
08x
\n
"
,
hr
);
dp
.
diph
.
dwObj
=
0
;
dp
.
diph
.
dwObj
=
0
;
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
ok
(
hr
==
DI_OK
,
"SetProperty() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DI_OK
,
"SetProperty() failed: %
08x
\n
"
,
hr
);
/* Cannot change mode while acquired */
/* Cannot change mode while acquired */
hr
=
IDirectInputDevice_Acquire
(
device
);
hr
=
IDirectInputDevice_Acquire
(
device
);
ok
(
hr
==
DI_OK
,
"Acquire() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DI_OK
,
"Acquire() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
hr
=
IDirectInputDevice_SetProperty
(
device
,
DIPROP_AXISMODE
,
&
dp
.
diph
);
ok
(
hr
==
DIERR_ACQUIRED
,
"SetProperty() returned: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_ACQUIRED
,
"SetProperty() returned: %
08x
\n
"
,
hr
);
}
}
}
}
...
@@ -126,12 +125,12 @@ static BOOL CALLBACK enum_devices(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
...
@@ -126,12 +125,12 @@ static BOOL CALLBACK enum_devices(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
HRESULT
hr
;
HRESULT
hr
;
hr
=
IDirectInput_GetDeviceStatus
(
data
->
pDI
,
&
lpddi
->
guidInstance
);
hr
=
IDirectInput_GetDeviceStatus
(
data
->
pDI
,
&
lpddi
->
guidInstance
);
ok
(
hr
==
DI_OK
,
"IDirectInput_GetDeviceStatus() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DI_OK
,
"IDirectInput_GetDeviceStatus() failed: %
08x
\n
"
,
hr
);
if
(
hr
==
DI_OK
)
if
(
hr
==
DI_OK
)
{
{
hr
=
IDirectInput_CreateDevice
(
data
->
pDI
,
&
lpddi
->
guidInstance
,
&
device
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
data
->
pDI
,
&
lpddi
->
guidInstance
,
&
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
08x
\n
"
,
hr
);
trace
(
"Testing device
\"
%s
\"\n
"
,
lpddi
->
tszInstanceName
);
trace
(
"Testing device
\"
%s
\"\n
"
,
lpddi
->
tszInstanceName
);
test_object_info
(
device
,
data
->
hwnd
);
test_object_info
(
device
,
data
->
hwnd
);
IUnknown_Release
(
device
);
IUnknown_Release
(
device
);
...
@@ -153,7 +152,7 @@ static void device_tests(void)
...
@@ -153,7 +152,7 @@ static void device_tests(void)
skip
(
"Tests require a newer dinput version
\n
"
);
skip
(
"Tests require a newer dinput version
\n
"
);
return
;
return
;
}
}
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %
08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
,
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
,
...
@@ -166,7 +165,7 @@ static void device_tests(void)
...
@@ -166,7 +165,7 @@ static void device_tests(void)
data
.
pDI
=
pDI
;
data
.
pDI
=
pDI
;
data
.
hwnd
=
hwnd
;
data
.
hwnd
=
hwnd
;
hr
=
IDirectInput_EnumDevices
(
pDI
,
0
,
enum_devices
,
&
data
,
DIEDFL_ALLDEVICES
);
hr
=
IDirectInput_EnumDevices
(
pDI
,
0
,
enum_devices
,
&
data
,
DIEDFL_ALLDEVICES
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_EnumDevices() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_EnumDevices() failed: %
08x
\n
"
,
hr
);
/* If GetDeviceStatus returns DI_OK the device must exist */
/* If GetDeviceStatus returns DI_OK the device must exist */
...
@@ -176,7 +175,7 @@ static void device_tests(void)
...
@@ -176,7 +175,7 @@ static void device_tests(void)
LPDIRECTINPUTDEVICE
device
=
NULL
;
LPDIRECTINPUTDEVICE
device
=
NULL
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_Joystick
,
&
device
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_Joystick
,
&
device
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
08x
\n
"
,
hr
);
if
(
device
)
IUnknown_Release
(
device
);
if
(
device
)
IUnknown_Release
(
device
);
}
}
...
...
dlls/dinput/tests/joystick.c
View file @
b648dac7
This diff is collapsed.
Click to expand it.
dlls/dinput/tests/keyboard.c
View file @
b648dac7
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include "windef.h"
#include "windef.h"
#include "wingdi.h"
#include "wingdi.h"
#include "dinput.h"
#include "dinput.h"
#include "dxerr8.h"
#include "dinput_test.h"
#include "dinput_test.h"
const
char
*
get_file_version
(
const
char
*
file_name
)
const
char
*
get_file_version
(
const
char
*
file_name
)
...
@@ -89,37 +88,37 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
...
@@ -89,37 +88,37 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd)
df
.
rgodf
=
dodf
;
df
.
rgodf
=
dodf
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysKeyboard
,
&
pKeyboard
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysKeyboard
,
&
pKeyboard
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInputDevice_SetDataFormat
(
pKeyboard
,
&
c_dfDIKeyboard
);
hr
=
IDirectInputDevice_SetDataFormat
(
pKeyboard
,
&
c_dfDIKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pKeyboard
,
NULL
,
DISCL_NONEXCLUSIVE
|
DISCL_BACKGROUND
);
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pKeyboard
,
NULL
,
DISCL_NONEXCLUSIVE
|
DISCL_BACKGROUND
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetCooperativeLevel() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetCooperativeLevel() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
10
,
kbd_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
10
,
kbd_state
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"IDirectInputDevice_GetDeviceState() should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"IDirectInputDevice_GetDeviceState() should have failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Unacquire
(
pKeyboard
);
hr
=
IDirectInputDevice_Unacquire
(
pKeyboard
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Unacquire() should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Unacquire() should have failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Acquire() should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Acquire() should have failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
10
,
kbd_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
10
,
kbd_state
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(10,) should have failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Unacquire
(
pKeyboard
);
hr
=
IDirectInputDevice_Unacquire
(
pKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Uncquire() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Uncquire() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_SetDataFormat
(
pKeyboard
,
&
df
);
hr
=
IDirectInputDevice_SetDataFormat
(
pKeyboard
,
&
df
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
hr
=
IDirectInputDevice_Acquire
(
pKeyboard
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
custom_state
),
custom_state
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState(4,) failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_GetDeviceState(4,) failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pKeyboard
,
sizeof
(
kbd_state
),
kbd_state
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(256,) should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_INVALIDPARAM
,
"IDirectInputDevice_GetDeviceState(256,) should have failed: %
08x
\n
"
,
hr
);
if
(
pKeyboard
)
IUnknown_Release
(
pKeyboard
);
if
(
pKeyboard
)
IUnknown_Release
(
pKeyboard
);
}
}
...
@@ -143,18 +142,18 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd)
...
@@ -143,18 +142,18 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd)
int
i
;
int
i
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysKeyboard
,
&
pKeyboard
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysKeyboard
,
&
pKeyboard
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
{
{
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pKeyboard
,
NULL
,
i
);
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pKeyboard
,
NULL
,
i
);
ok
(
hr
==
SetCoop_null_window
[
i
],
"SetCooperativeLevel(NULL, %d): %
s
\n
"
,
i
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
SetCoop_null_window
[
i
],
"SetCooperativeLevel(NULL, %d): %
08x
\n
"
,
i
,
hr
);
}
}
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
{
{
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pKeyboard
,
hwnd
,
i
);
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pKeyboard
,
hwnd
,
i
);
ok
(
hr
==
SetCoop_real_window
[
i
],
"SetCooperativeLevel(hwnd, %d): %
s
\n
"
,
i
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
SetCoop_real_window
[
i
],
"SetCooperativeLevel(hwnd, %d): %
08x
\n
"
,
i
,
hr
);
}
}
if
(
pKeyboard
)
IUnknown_Release
(
pKeyboard
);
if
(
pKeyboard
)
IUnknown_Release
(
pKeyboard
);
...
@@ -174,7 +173,7 @@ static void keyboard_tests(DWORD version)
...
@@ -174,7 +173,7 @@ static void keyboard_tests(DWORD version)
skip
(
"Tests require a newer dinput version
\n
"
);
skip
(
"Tests require a newer dinput version
\n
"
);
return
;
return
;
}
}
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %
08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
...
...
dlls/dinput/tests/mouse.c
View file @
b648dac7
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include "windef.h"
#include "windef.h"
#include "wingdi.h"
#include "wingdi.h"
#include "dinput.h"
#include "dinput.h"
#include "dxerr8.h"
#include "dinput_test.h"
#include "dinput_test.h"
static
const
HRESULT
SetCoop_null_window
[
16
]
=
{
static
const
HRESULT
SetCoop_null_window
[
16
]
=
{
...
@@ -51,18 +50,18 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd)
...
@@ -51,18 +50,18 @@ static void test_set_coop(LPDIRECTINPUT pDI, HWND hwnd)
int
i
;
int
i
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
&
pMouse
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
&
pMouse
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
{
{
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
NULL
,
i
);
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
NULL
,
i
);
ok
(
hr
==
SetCoop_null_window
[
i
],
"SetCooperativeLevel(NULL, %d): %
s
\n
"
,
i
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
SetCoop_null_window
[
i
],
"SetCooperativeLevel(NULL, %d): %
08x
\n
"
,
i
,
hr
);
}
}
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
{
{
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
hwnd
,
i
);
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
hwnd
,
i
);
ok
(
hr
==
SetCoop_real_window
[
i
],
"SetCooperativeLevel(hwnd, %d): %
s
\n
"
,
i
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
SetCoop_real_window
[
i
],
"SetCooperativeLevel(hwnd, %d): %
08x
\n
"
,
i
,
hr
);
}
}
if
(
pMouse
)
IUnknown_Release
(
pMouse
);
if
(
pMouse
)
IUnknown_Release
(
pMouse
);
...
@@ -75,36 +74,36 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
...
@@ -75,36 +74,36 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
DIMOUSESTATE
m_state
;
DIMOUSESTATE
m_state
;
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
&
pMouse
,
NULL
);
hr
=
IDirectInput_CreateDevice
(
pDI
,
&
GUID_SysMouse
,
&
pMouse
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInput_CreateDevice() failed: %
08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
hwnd
,
DISCL_NONEXCLUSIVE
|
DISCL_FOREGROUND
);
hr
=
IDirectInputDevice_SetCooperativeLevel
(
pMouse
,
hwnd
,
DISCL_NONEXCLUSIVE
|
DISCL_FOREGROUND
);
ok
(
hr
==
S_OK
,
"SetCooperativeLevel: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
S_OK
,
"SetCooperativeLevel: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_SetDataFormat
(
pMouse
,
&
c_dfDIMouse
);
hr
=
IDirectInputDevice_SetDataFormat
(
pMouse
,
&
c_dfDIMouse
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_SetDataFormat() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Unacquire
(
pMouse
);
hr
=
IDirectInputDevice_Unacquire
(
pMouse
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Unacquire() should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Unacquire() should have failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"IDirectInputDevice_Acquire() failed: %
08x
\n
"
,
hr
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Acquire() should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
S_FALSE
,
"IDirectInputDevice_Acquire() should have failed: %
08x
\n
"
,
hr
);
/* Foreground coop level requires window to have focus */
/* Foreground coop level requires window to have focus */
/* This should make dinput loose mouse input */
/* This should make dinput loose mouse input */
SetActiveWindow
(
0
);
SetActiveWindow
(
0
);
hr
=
IDirectInputDevice_GetDeviceState
(
pMouse
,
sizeof
(
m_state
),
&
m_state
);
hr
=
IDirectInputDevice_GetDeviceState
(
pMouse
,
sizeof
(
m_state
),
&
m_state
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"GetDeviceState() should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_NOTACQUIRED
,
"GetDeviceState() should have failed: %
08x
\n
"
,
hr
);
/* Workaround so we can test other things. Remove when Wine is fixed */
/* Workaround so we can test other things. Remove when Wine is fixed */
IDirectInputDevice_Unacquire
(
pMouse
);
IDirectInputDevice_Unacquire
(
pMouse
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
ok
(
hr
==
DIERR_OTHERAPPHASPRIO
,
"Acquire() should have failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
DIERR_OTHERAPPHASPRIO
,
"Acquire() should have failed: %
08x
\n
"
,
hr
);
SetActiveWindow
(
hwnd
);
SetActiveWindow
(
hwnd
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
hr
=
IDirectInputDevice_Acquire
(
pMouse
);
ok
(
hr
==
S_OK
,
"Acquire() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
hr
==
S_OK
,
"Acquire() failed: %
08x
\n
"
,
hr
);
if
(
pMouse
)
IUnknown_Release
(
pMouse
);
if
(
pMouse
)
IUnknown_Release
(
pMouse
);
}
}
...
@@ -123,7 +122,7 @@ static void mouse_tests(void)
...
@@ -123,7 +122,7 @@ static void mouse_tests(void)
skip
(
"Tests require a newer dinput version
\n
"
);
skip
(
"Tests require a newer dinput version
\n
"
);
return
;
return
;
}
}
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %
s
\n
"
,
DXGetErrorString8
(
hr
)
);
ok
(
SUCCEEDED
(
hr
),
"DirectInputCreate() failed: %
08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
if
(
FAILED
(
hr
))
return
;
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
,
hwnd
=
CreateWindow
(
"static"
,
"Title"
,
WS_OVERLAPPEDWINDOW
,
...
...
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