Commit 35ee9b05 authored by Vitaliy Margolen's avatar Vitaliy Margolen Committed by Alexandre Julliard

dinput: Add SetCooperativeLevel test for joystick.

parent d35e4cd8
......@@ -123,6 +123,18 @@ static BOOL CALLBACK EnumAxes(
return DIENUM_CONTINUE;
}
static const HRESULT SetCoop_null_window[16] = {
E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG,
E_INVALIDARG, E_HANDLE, E_HANDLE, E_INVALIDARG,
E_INVALIDARG, E_HANDLE, S_OK, E_INVALIDARG,
E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG};
static const HRESULT SetCoop_real_window[16] = {
E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG,
E_INVALIDARG, S_OK, S_OK, E_INVALIDARG,
E_INVALIDARG, S_OK, S_OK, E_INVALIDARG,
E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG};
static BOOL CALLBACK EnumJoysticks(
LPCDIDEVICEINSTANCE lpddi,
LPVOID pvRef)
......@@ -193,6 +205,17 @@ static BOOL CALLBACK EnumJoysticks(
if (hr != DI_OK)
goto RELEASE;
for (i=0; i<16; i++)
{
hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, NULL, i);
ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %s\n", i, DXGetErrorString8(hr));
}
for (i=0; i<16; i++)
{
hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, hWnd, i);
ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %s\n", i, DXGetErrorString8(hr));
}
hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, hWnd,
DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %s\n",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment