From 0242300f27e2fc240e398bc0eaf722f68320e002 Mon Sep 17 00:00:00 2001 From: Sergey Khodych Date: Fri, 18 Apr 2008 00:29:24 +0300 Subject: Add test to show dinput does not use user defined data format for keyboard. --- dlls/dinput/tests/keyboard.c | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c index 76ecec8..440cd3c 100644 --- a/dlls/dinput/tests/keyboard.c +++ b/dlls/dinput/tests/keyboard.c @@ -71,6 +71,22 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd) HRESULT hr; LPDIRECTINPUTDEVICE pKeyboard; BYTE kbd_state[256]; + BYTE custom_state[4]; + DIOBJECTDATAFORMAT dodf[] = + { + { &GUID_Key, 0, DIDFT_MAKEINSTANCE(DIK_Q)|DIDFT_BUTTON, 0 }, + { &GUID_Key, 1, DIDFT_MAKEINSTANCE(DIK_W)|DIDFT_BUTTON, 0 }, + { &GUID_Key, 2, DIDFT_MAKEINSTANCE(DIK_E)|DIDFT_BUTTON, 0 }, + { &GUID_Key, 3, DIDFT_MAKEINSTANCE(DIK_R)|DIDFT_BUTTON, 0 }, + }; + + DIDATAFORMAT df; + df.dwSize = sizeof( df ); + df.dwObjSize = sizeof( DIOBJECTDATAFORMAT ); + df.dwFlags = DIDF_RELAXIS; + df.dwDataSize = sizeof( dodf )/sizeof( dodf[0] ); + df.dwNumObjs = sizeof( dodf )/sizeof( dodf[0] ); + df.rgodf = dodf; hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL); ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %s\n", DXGetErrorString8(hr)); @@ -94,6 +110,19 @@ static void acquire_tests(LPDIRECTINPUT pDI, HWND hwnd) ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(10,) should have failed: %s\n", DXGetErrorString8(hr)); hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state); ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState() failed: %s\n", DXGetErrorString8(hr)); + hr = IDirectInputDevice_Unacquire(pKeyboard); + ok(SUCCEEDED(hr), "IDirectInputDevice_Uncquire() failed: %s\n", DXGetErrorString8(hr)); + hr = IDirectInputDevice_SetDataFormat( pKeyboard , &df ); + ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %s\n", DXGetErrorString8(hr)); + hr = IDirectInputDevice_Acquire(pKeyboard); + ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %s\n", DXGetErrorString8(hr)); + todo_wine + { + hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state); + ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState(4,) failed: %s\n", DXGetErrorString8(hr)); + hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(kbd_state), kbd_state); + ok(hr == DIERR_INVALIDPARAM, "IDirectInputDevice_GetDeviceState(256,) should have failed: %s\n", DXGetErrorString8(hr)); + } if (pKeyboard) IUnknown_Release(pKeyboard); } -- 1.5.3.3