Module: wine Branch: master Commit: 913cbb9f218095c344aab5aab801751b96ffe67c URL: http://source.winehq.org/git/wine.git/?a=commit;h=913cbb9f218095c344aab5aab8...
Author: Lucas Zawacki lfzawacki@gmail.com Date: Thu Oct 11 10:45:26 2012 -0300
dinput/tests: Test for DIPROP_INSTANCENAME and DIPROP_GUIDANDPATH.
---
dlls/dinput/tests/joystick.c | 26 ++++++++++++++++++++++++++ include/dinput.h | 2 ++ 2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c index a49ee2e..2fe12ba 100644 --- a/dlls/dinput/tests/joystick.c +++ b/dlls/dinput/tests/joystick.c @@ -181,6 +181,9 @@ static BOOL CALLBACK EnumJoysticks( DIDEVICEINSTANCE inst; DIDEVICEINSTANCE_DX3 inst3; DIPROPDWORD dipw; + DIPROPSTRING dps; + DIPROPGUIDANDPATH dpg; + WCHAR nameBuffer[MAX_PATH]; HWND hWnd = get_hwnd(); char oldstate[248], curstate[248];
@@ -216,6 +219,29 @@ static BOOL CALLBACK EnumJoysticks( hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_JOYSTICKID, &dipw.diph); ok(SUCCEEDED(hr), "IDirectInputDevice_GetProperty() for DIPROP_JOYSTICKID failed\n");
+ /* Test for INSTANCENAME property */ + memset(&dps, 0, sizeof(dps)); + dps.diph.dwSize = sizeof(DIPROPSTRING); + dps.diph.dwHeaderSize = sizeof(DIPROPHEADER); + dps.diph.dwHow = DIPH_DEVICE; + + hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_INSTANCENAME, &dps.diph); + ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_INSTANCENAME failed: %08x\n", hr); + + /* Test if instance name is the same as present in DIDEVICEINSTANCE */ + MultiByteToWideChar(CP_ACP, 0, lpddi->tszInstanceName, -1, nameBuffer, MAX_PATH); + ok(!lstrcmpW(nameBuffer, dps.wsz), "DIPROP_INSTANCENAME returned is wrong. Expected: %s Got: %s\n", + wine_dbgstr_w(nameBuffer), wine_dbgstr_w(dps.wsz)); + + /* Test for GUIDPATH properties */ + memset(&dpg, 0, sizeof(dpg)); + dpg.diph.dwSize = sizeof(DIPROPGUIDANDPATH); + dpg.diph.dwHeaderSize = sizeof(DIPROPHEADER); + dpg.diph.dwHow = DIPH_DEVICE; + + hr = IDirectInputDevice_GetProperty(pJoystick, DIPROP_GUIDANDPATH, &dpg.diph); + todo_wine ok(SUCCEEDED(hr), "IDirectInput_GetProperty() for DIPROP_GUIDANDPATH failed: %08x\n", hr); + hr = IDirectInputDevice_SetDataFormat(pJoystick, NULL); ok(hr==E_POINTER,"IDirectInputDevice_SetDataFormat() should have returned " "E_POINTER, returned: %08x\n", hr); diff --git a/include/dinput.h b/include/dinput.h index 3125800..8c779c2 100644 --- a/include/dinput.h +++ b/include/dinput.h @@ -905,6 +905,8 @@ typedef const DIPROPSTRING *LPCDIPROPSTRING;
#define DIPROP_CALIBRATION MAKEDIPROP(11) #define DIPROP_GUIDANDPATH MAKEDIPROP(12) + +#define DIPROP_INSTANCENAME MAKEDIPROP(13) #define DIPROP_JOYSTICKID MAKEDIPROP(15) #define DIPROP_KEYNAME MAKEDIPROP(20) #define DIPROP_VIDPID MAKEDIPROP(24)