Commit 8bffed50 authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Added dinput tests.

parent e6d4bcd7
......@@ -19959,7 +19959,7 @@ MAKE_LIB_RULES=libs/Makelib.rules
MAKE_PROG_RULES=programs/Makeprog.rules
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/advpack/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/cryptdll/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/lzexpand/tests/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msi/tests/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/powrprof/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/riched20/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/rsaenh/Makefile dlls/rsaenh/tests/Makefile dlls/secur32/Makefile dlls/sensapi/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/stdole32.tlb/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/wtsapi32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/advpack/tests/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/cryptdll/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput/tests/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/lzexpand/tests/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msi/tests/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/powrprof/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/riched20/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/rsaenh/Makefile dlls/rsaenh/tests/Makefile dlls/secur32/Makefile dlls/sensapi/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/stdole32.tlb/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/wtsapi32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
cat >confcache <<\_ACEOF
......@@ -20529,6 +20529,7 @@ do
"dlls/ddraw/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/ddraw/tests/Makefile" ;;
"dlls/devenum/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/devenum/Makefile" ;;
"dlls/dinput/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dinput/Makefile" ;;
"dlls/dinput/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dinput/tests/Makefile" ;;
"dlls/dinput8/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dinput8/Makefile" ;;
"dlls/dmband/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dmband/Makefile" ;;
"dlls/dmcompos/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/dmcompos/Makefile" ;;
......
......@@ -1550,6 +1550,7 @@ dlls/ddraw/Makefile
dlls/ddraw/tests/Makefile
dlls/devenum/Makefile
dlls/dinput/Makefile
dlls/dinput/tests/Makefile
dlls/dinput8/Makefile
dlls/dmband/Makefile
dlls/dmcompos/Makefile
......
......@@ -21,6 +21,8 @@ IMPLIB_SRCS = data_formats.c
RC_SRCS = version.rc
SUBDIRS = tests
@MAKE_DLL_RULES@
### Dependencies:
Makefile
joystick.ok
keyboard.ok
mouse.ok
testlist.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = dinput.dll
IMPORTS = dinput ole32 version user32 kernel32
EXTRALIBS = -ldxguid -luuid -ldxerr8
CTESTS = \
joystick.c \
keyboard.c \
mouse.c
@MAKE_TEST_RULES@
### Dependencies:
/*
* Copyright (c) 2005 Robert Reif
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
extern HWND get_hwnd();
extern const char * get_file_version(const char * file_name);
/*
* Copyright (c) 2004-2005 Robert Reif
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define STRICT
#define DIRECTINPUT_VERSION 0x0700
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include <windows.h>
#include <math.h>
#include <stdlib.h>
#include "wine/test.h"
#include "windef.h"
#include "wingdi.h"
#include "dinput.h"
#include "dxerr8.h"
#include "dinput_test.h"
#define numObjects(x) (sizeof(x) / sizeof(x[0]))
static const DIOBJECTDATAFORMAT dfDIJoystickTest[] = {
{ &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
{ &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
{ &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
{ &GUID_RxAxis,DIJOFS_RX,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
{ &GUID_RyAxis,DIJOFS_RY,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
{ &GUID_RzAxis,DIJOFS_RZ,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(0),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(1),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(2),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(3),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(4),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(5),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(6),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(7),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(8),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(9),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
{ &GUID_Button,DIJOFS_BUTTON(10),DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_ANYINSTANCE,0},
};
static const DIDATAFORMAT c_dfDIJoystickTest = {
sizeof(DIDATAFORMAT),
sizeof(DIOBJECTDATAFORMAT),
DIDF_ABSAXIS,
sizeof(DIJOYSTATE2),
numObjects(dfDIJoystickTest),
(LPDIOBJECTDATAFORMAT)dfDIJoystickTest
};
HWND get_hwnd()
{
HWND hwnd=GetForegroundWindow();
if (!hwnd)
hwnd=GetDesktopWindow();
return hwnd;
}
typedef struct tagJoystickInfo
{
LPDIRECTINPUTDEVICE pJoystick;
int axis;
int pov;
int button;
} JoystickInfo;
static BOOL CALLBACK EnumAxes(
const DIDEVICEOBJECTINSTANCE* pdidoi,
VOID* pContext)
{
HRESULT hr;
JoystickInfo * info = (JoystickInfo *)pContext;
if (IsEqualIID(&pdidoi->guidType, &GUID_XAxis) ||
IsEqualIID(&pdidoi->guidType, &GUID_YAxis) ||
IsEqualIID(&pdidoi->guidType, &GUID_ZAxis) ||
IsEqualIID(&pdidoi->guidType, &GUID_RxAxis) ||
IsEqualIID(&pdidoi->guidType, &GUID_RyAxis) ||
IsEqualIID(&pdidoi->guidType, &GUID_RzAxis) ||
IsEqualIID(&pdidoi->guidType, &GUID_Slider)) {
DIPROPRANGE diprg;
diprg.diph.dwSize = sizeof(DIPROPRANGE);
diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER);
diprg.diph.dwHow = DIPH_BYID;
diprg.diph.dwObj = pdidoi->dwType;
diprg.lMin = -1000;
diprg.lMax = +1000;
hr = IDirectInputDevice_SetProperty(info->pJoystick, DIPROP_RANGE, NULL);
ok(hr==E_POINTER,"IDirectInputDevice_SetProperty() should have returned "
"E_POINTER, returned: %s\n", DXGetErrorString8(hr));
hr = IDirectInputDevice_SetProperty(info->pJoystick, DIPROP_RANGE, &diprg.diph);
ok(hr==DI_OK,"IDirectInputDevice_SetProperty() failed: %s\n", DXGetErrorString8(hr));
info->axis++;
} else if (IsEqualIID(&pdidoi->guidType, &GUID_POV))
info->pov++;
else if (IsEqualIID(&pdidoi->guidType, &GUID_Button))
info->button++;
return DIENUM_CONTINUE;
}
static BOOL CALLBACK EnumJoysticks(
LPCDIDEVICEINSTANCE lpddi,
LPVOID pvRef)
{
HRESULT hr;
LPDIRECTINPUT pDI = (LPDIRECTINPUT)pvRef;
LPDIRECTINPUTDEVICE pJoystick;
DIDATAFORMAT format;
DIDEVCAPS caps;
DIJOYSTATE2 js;
JoystickInfo info;
int i, count;
ULONG ref;
hr = IDirectInput_CreateDevice(pDI, &lpddi->guidInstance, NULL, NULL);
ok(hr==E_POINTER,"IDirectInput_CreateDevice() should have returned "
"E_POINTER, returned: %s\n", DXGetErrorString8(hr));
hr = IDirectInput_CreateDevice(pDI, NULL, &pJoystick, NULL);
ok(hr==E_POINTER,"IDirectInput_CreateDevice() should have returned "
"E_POINTER, returned: %s\n", DXGetErrorString8(hr));
hr = IDirectInput_CreateDevice(pDI, NULL, NULL, NULL);
ok(hr==E_POINTER,"IDirectInput_CreateDevice() should have returned "
"E_POINTER, returned: %s\n", DXGetErrorString8(hr));
hr = IDirectInput_CreateDevice(pDI, &lpddi->guidInstance, &pJoystick, NULL);
ok(hr==DI_OK,"IDirectInput_CreateDevice() failed: %s\n",
DXGetErrorString8(hr));
if (hr!=DI_OK)
goto DONE;
trace("---- %s ----\n", lpddi->tszProductName);
hr = IDirectInputDevice_SetDataFormat(pJoystick, NULL);
ok(hr==E_POINTER,"IDirectInputDevice_SetDataFormat() should have returned "
"E_POINTER, returned: %s\n", DXGetErrorString8(hr));
ZeroMemory(&format, sizeof(format));
hr = IDirectInputDevice_SetDataFormat(pJoystick, &format);
ok(hr==DIERR_INVALIDPARAM,"IDirectInputDevice_SetDataFormat() should have "
"returned DIERR_INVALIDPARAM, returned: %s\n", DXGetErrorString8(hr));
/* try the default formats */
hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick);
ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %s\n",
DXGetErrorString8(hr));
hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick2);
ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %s\n",
DXGetErrorString8(hr));
/* try an alternate format */
hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystickTest);
ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %s\n",
DXGetErrorString8(hr));
hr = IDirectInputDevice_SetDataFormat(pJoystick, &c_dfDIJoystick2);
ok(hr==DI_OK,"IDirectInputDevice_SetDataFormat() failed: %s\n",
DXGetErrorString8(hr));
if (hr != DI_OK)
goto RELEASE;
hr = IDirectInputDevice_SetCooperativeLevel(pJoystick, get_hwnd(),
DISCL_EXCLUSIVE | DISCL_FOREGROUND);
ok(hr==DI_OK,"IDirectInputDevice_SetCooperativeLevel() failed: %s\n",
DXGetErrorString8(hr));
/* get capabilities */
hr = IDirectInputDevice_GetCapabilities(pJoystick, NULL);
ok(hr==E_POINTER,"IDirectInputDevice_GetCapabilities() "
"should have returned E_POINTER, returned: %s\n",
DXGetErrorString8(hr));
ZeroMemory(&caps, sizeof(caps));
hr = IDirectInputDevice_GetCapabilities(pJoystick, &caps);
ok(hr==DIERR_INVALIDPARAM,"IDirectInputDevice_GetCapabilities() "
"should have returned DIERR_INVALIDPARAM, returned: %s\n",
DXGetErrorString8(hr));
caps.dwSize = sizeof(caps);
hr = IDirectInputDevice_GetCapabilities(pJoystick, &caps);
ok(hr==DI_OK,"IDirectInputDevice_GetCapabilities() failed: %s\n",
DXGetErrorString8(hr));
ZeroMemory(&info, sizeof(info));
info.pJoystick = pJoystick;
/* enumerate objects */
hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, (VOID*)&info, DIDFT_ALL);
ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %s\n",
DXGetErrorString8(hr));
ok(caps.dwAxes == info.axis, "Number of enumerated axes doesn't match capabilities\n");
ok(caps.dwButtons == info.button, "Number of enumerated buttons doesn't match capabilities\n");
ok(caps.dwPOVs == info.pov, "Number of enumerated buttons doesn't match capabilities\n");
hr = IDirectInputDevice_Acquire(pJoystick);
ok(hr==DI_OK,"IDirectInputDevice_Acquire() failed: %s\n",
DXGetErrorString8(hr));
if (hr != DI_OK)
goto RELEASE;
if (winetest_interactive) {
trace("You have 30 seconds to test all axes, sliders, POVs and buttons\n");
count = 300;
} else
count = 1;
trace("\n");
for (i = 0; i < count; i++) {
hr = IDirectInputDevice_GetDeviceState(pJoystick, sizeof(DIJOYSTATE2), &js);
ok(hr==DI_OK,"IDirectInputDevice_GetDeviceState() failed: %s\n",
DXGetErrorString8(hr));
if (hr != DI_OK)
break;
trace("X%5ld Y%5ld Z%5ld Rx%5ld Ry%5ld Rz%5ld "
"S0%5ld S1%5ld POV0%5ld POV1%5ld POV2%5ld POV3%5ld "
"B %d %d %d %d %d %d %d %d %d %d %d %d\r",
js.lX, js.lY, js.lZ, js.lRx, js.lRy, js.lRz,
js.rglSlider[0], js.rglSlider[1],
js.rgdwPOV[0], js.rgdwPOV[1], js.rgdwPOV[2], js.rgdwPOV[3],
js.rgbButtons[0]>>7, js.rgbButtons[1]>>7, js.rgbButtons[2]>>7,
js.rgbButtons[3]>>7, js.rgbButtons[4]>>7, js.rgbButtons[5]>>7,
js.rgbButtons[6]>>7, js.rgbButtons[7]>>7, js.rgbButtons[8]>>7,
js.rgbButtons[9]>>7, js.rgbButtons[10]>>7, js.rgbButtons[11]>>7);
Sleep(100);
}
trace("\n");
hr = IDirectInputDevice_Unacquire(pJoystick);
ok(hr==DI_OK,"IDirectInputDevice_Unacquire() failed: %s\n",
DXGetErrorString8(hr));
RELEASE:
ref = IDirectInputDevice_Release(pJoystick);
ok(ref==0,"IDirectInputDevice_Release() reference count = %ld\n", ref);
DONE:
return DIENUM_CONTINUE;
}
static void joystick_tests()
{
HRESULT hr;
LPDIRECTINPUT pDI;
ULONG ref;
hr = DirectInputCreate(GetModuleHandle(NULL), DIRECTINPUT_VERSION, &pDI, NULL);
ok(hr==DI_OK, "DirectInputCreate() failed: %s\n", DXGetErrorString8(hr));
if (hr!=DI_OK)
return;
hr = IDirectInput_EnumDevices(pDI, DIDEVTYPE_JOYSTICK, EnumJoysticks, pDI, DIEDFL_ALLDEVICES);
ok(hr==DI_OK,"IDirectInput_EnumDevices() failed: %s\n", DXGetErrorString8(hr));
ref = IDirectInput_Release(pDI);
ok(ref==0,"IDirectInput_Release() reference count = %ld\n", ref);
}
START_TEST(joystick)
{
CoInitialize(NULL);
trace("DLL Version: %s\n", get_file_version("dinput.dll"));
joystick_tests();
CoUninitialize();
}
/*
* Copyright (c) 2005 Robert Reif
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define STRICT
#define DIRECTINPUT_VERSION 0x0700
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include <windows.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "wine/test.h"
#include "windef.h"
#include "wingdi.h"
#include "dinput.h"
#include "dxerr8.h"
#include "dinput_test.h"
const char * get_file_version(const char * file_name)
{
static char version[32];
DWORD size;
DWORD handle;
size = GetFileVersionInfoSizeA(file_name, &handle);
if (size) {
char * data = HeapAlloc(GetProcessHeap(), 0, size);
if (data) {
if (GetFileVersionInfoA(file_name, handle, size, data)) {
VS_FIXEDFILEINFO *pFixedVersionInfo;
UINT len;
if (VerQueryValueA(data, "\\", (LPVOID *)&pFixedVersionInfo, &len)) {
sprintf(version, "%ld.%ld.%ld.%ld",
pFixedVersionInfo->dwFileVersionMS >> 16,
pFixedVersionInfo->dwFileVersionMS & 0xffff,
pFixedVersionInfo->dwFileVersionLS >> 16,
pFixedVersionInfo->dwFileVersionLS & 0xffff);
} else
sprintf(version, "not available");
} else
sprintf(version, "failed");
HeapFree(GetProcessHeap(), 0, data);
} else
sprintf(version, "failed");
} else
sprintf(version, "not available");
return version;
}
static void keyboard_tests()
{
}
START_TEST(keyboard)
{
CoInitialize(NULL);
trace("DLL Version: %s\n", get_file_version("dinput.dll"));
keyboard_tests();
CoUninitialize();
}
/*
* Copyright (c) 2005 Robert Reif
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define STRICT
#define DIRECTINPUT_VERSION 0x0700
#define NONAMELESSSTRUCT
#define NONAMELESSUNION
#include <windows.h>
#include <math.h>
#include <stdlib.h>
#include "wine/test.h"
#include "windef.h"
#include "wingdi.h"
#include "dinput.h"
#include "dxerr8.h"
#include "dinput_test.h"
static void mouse_tests()
{
}
START_TEST(mouse)
{
CoInitialize(NULL);
trace("DLL Version: %s\n", get_file_version("dinput.dll"));
mouse_tests();
CoUninitialize();
}
......@@ -23,6 +23,7 @@ TESTBINS = \
advapi32_test.exe$(DLLEXT) \
comctl32_test.exe$(DLLEXT) \
ddraw_test.exe$(DLLEXT) \
dinput_test.exe$(DLLEXT) \
dsound_test.exe$(DLLEXT) \
gdi32_test.exe$(DLLEXT) \
iphlpapi_test.exe$(DLLEXT) \
......@@ -95,6 +96,8 @@ comctl32_test.exe$(DLLEXT): $(DLLDIR)/comctl32/tests/comctl32_test.exe$(DLLEXT)
cp $(DLLDIR)/comctl32/tests/comctl32_test.exe$(DLLEXT) $@ && $(STRIP) $@
ddraw_test.exe$(DLLEXT): $(DLLDIR)/ddraw/tests/ddraw_test.exe$(DLLEXT)
cp $(DLLDIR)/ddraw/tests/ddraw_test.exe$(DLLEXT) $@ && $(STRIP) $@
dinput_test.exe$(DLLEXT): $(DLLDIR)/dinput/tests/dinput_test.exe$(DLLEXT)
cp $(DLLDIR)/dinput/tests/dinput_test.exe$(DLLEXT) $@ && $(STRIP) $@
dsound_test.exe$(DLLEXT): $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT)
cp $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT) $@ && $(STRIP) $@
gdi32_test.exe$(DLLEXT): $(DLLDIR)/gdi/tests/gdi32_test.exe$(DLLEXT)
......
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