dinput/tests: Tests for IDirectInputJoyConfig8_GetConfig.

This commit is contained in:
Lucas Zawacki 2012-08-13 20:36:55 -03:00 committed by Alexandre Julliard
parent fc944144e3
commit dbc10ef937
2 changed files with 46 additions and 0 deletions

View File

@ -22,6 +22,7 @@
#include <initguid.h>
#include <windows.h>
#include <dinput.h>
#include <dinputd.h>
#include "wine/test.h"
@ -562,6 +563,48 @@ static void test_RunControlPanel(void)
IDirectInput_Release(pDI);
}
static void test_DirectInputJoyConfig8(void)
{
IDirectInputA *pDI;
IDirectInputDeviceA *pDID;
IDirectInputJoyConfig8 *pDIJC;
DIJOYCONFIG info;
HRESULT hr;
int i;
hr = DirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &pDI, NULL);
if (FAILED(hr))
{
win_skip("Failed to instantiate a IDirectInputA instance: 0x%08x\n", hr);
return;
}
hr = IDirectInput_QueryInterface(pDI, &IID_IDirectInputJoyConfig8, (void **)&pDIJC);
if (FAILED(hr))
{
win_skip("Failed to instantiate a IDirectInputJoyConfig8 instance: 0x%08x\n", hr);
return;
}
info.dwSize = sizeof(info);
hr = DI_OK;
i = 0;
/* Enumerate all connected joystick GUIDs and try to create the respective devices */
for (i = 0; SUCCEEDED(hr); i++)
{
hr = IDirectInputJoyConfig8_GetConfig(pDIJC, i, &info, DIJC_GUIDINSTANCE);
todo_wine ok (hr == DI_OK || hr == DIERR_NOMOREITEMS,
"IDirectInputJoyConfig8_GetConfig returned 0x%08x\n", hr);
if (SUCCEEDED(hr))
todo_wine ok (SUCCEEDED(IDirectInput_CreateDevice(pDI, &info.guidInstance, &pDID, NULL)),
"IDirectInput_CreateDevice failed with guid from GetConfig hr = 0x%08x\n", hr);
}
}
START_TEST(dinput)
{
HMODULE dinput_mod = GetModuleHandleA("dinput.dll");
@ -579,5 +622,6 @@ START_TEST(dinput)
test_GetDeviceStatus();
test_Initialize();
test_RunControlPanel();
test_DirectInputJoyConfig8();
CoUninitialize();
}

View File

@ -44,6 +44,8 @@ typedef BOOL (CALLBACK *LPDIJOYTYPECALLBACK)(LPCWSTR, LPVOID);
#define JOY_POVVAL_LEFT 2
#define JOY_POVVAL_RIGHT 3
#define DIERR_NOMOREITEMS MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NO_MORE_ITEMS)
typedef struct joypos_tag
{
DWORD dwX;