dinput/tests: Test for DIPROP_INSTANCENAME and DIPROP_GUIDANDPATH.

This commit is contained in:
Lucas Zawacki 2012-10-11 10:45:26 -03:00 committed by Alexandre Julliard
parent 59c144f197
commit 913cbb9f21
2 changed files with 28 additions and 0 deletions

View File

@ -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);

View File

@ -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)