From: Rémi Bernon rbernon@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58574 --- dlls/dinput/tests/dinput_test.h | 29 +++++++++++++++++++++++++++++ dlls/dinput/tests/hid.c | 1 + dlls/dinput/tests/joystick8.c | 26 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+)
diff --git a/dlls/dinput/tests/dinput_test.h b/dlls/dinput/tests/dinput_test.h index e2438d6d2d1..d19e1868d76 100644 --- a/dlls/dinput/tests/dinput_test.h +++ b/dlls/dinput/tests/dinput_test.h @@ -119,4 +119,33 @@ DWORD msg_wait_for_events_( const char *file, int line, DWORD count, HANDLE *eve #define create_foreground_window( a ) create_foreground_window_( __FILE__, __LINE__, a, 5 ) HWND create_foreground_window_( const char *file, int line, BOOL fullscreen, UINT retries );
+static inline const char *debugstr_ok( const char *cond ) +{ + int c, n = 0; + /* skip possible casts */ + while ((c = *cond++)) + { + if (c == '(') n++; + if (!n) break; + if (c == ')') n--; + } + if (!strchr( cond - 1, '(' )) return wine_dbg_sprintf( "got %s", cond - 1 ); + return wine_dbg_sprintf( "%.*s returned", (int)strcspn( cond - 1, "( " ), cond - 1 ); +} + +#define ok_eq( e, r, t, f, ... ) \ + do \ + { \ + t v = (r); \ + ok( v == (e), "%s " f "\n", debugstr_ok( #r ), v, ##__VA_ARGS__ ); \ + } while (0) +#define ok_ne( e, r, t, f, ... ) \ + do \ + { \ + t v = (r); \ + ok( v != (e), "%s " f "\n", debugstr_ok( #r ), v, ##__VA_ARGS__ ); \ + } while (0) +#define ok_ret( e, r ) ok_eq( e, r, UINT_PTR, "%Iu, error %ld", GetLastError() ) +#define ok_hr( e, r ) ok_eq( e, r, HRESULT, "%#lx" ) + #endif /* __WINE_DINPUT_TEST_H */ diff --git a/dlls/dinput/tests/hid.c b/dlls/dinput/tests/hid.c index 5e48050738b..7ec8482aeed 100644 --- a/dlls/dinput/tests/hid.c +++ b/dlls/dinput/tests/hid.c @@ -55,6 +55,7 @@ #include "dinput.h" #include "dinputd.h" #include "hidusage.h" +#include "gameinput.h"
#include "wine/mssign.h"
diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index e381ad7b6f5..c5143623aa8 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -49,6 +49,14 @@
#include "initguid.h"
+#define _GAMEINPUT_ +#define GAMEINPUT_API_VERSION 0 +#include "gameinput.h" +#undef GAMEINPUT_API_VERSION +#define GAMEINPUT_API_VERSION 1 +#include "gameinput.h" +#undef GAMEINPUT_API_VERSION + #define DESKTOP_ALL_ACCESS 0x01ff
DEFINE_GUID(GUID_action_mapping_1,0x00000001,0x0002,0x0003,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b); @@ -5318,6 +5326,23 @@ done: cleanup_registry_keys(); }
+static void test_game_input(void) +{ + HMODULE gameinput = LoadLibraryW( L"gameinput.dll" ); + HRESULT (WINAPI *pGameInputCreate)( IGameInput0 **out ); + IGameInput0 *gi0; + + if (!gameinput || !(pGameInputCreate = (void *)GetProcAddress( gameinput, "GameInputCreate" ))) + { + win_skip( "GameInputCreate not found, skipping tests.\n" ); + return; + } + + gi0 = (void *)0xdeadbeef; + todo_wine ok_hr( S_OK, pGameInputCreate( &gi0 ) ); + if (gi0 != (void *)0xdeadbeef) ok_ret( 0, IGameInput0_Release( gi0 ) ); +} + static HANDLE rawinput_device_added, rawinput_device_removed, rawinput_event; static UINT rawinput_len[64], rawbuffer_count[64], rawbuffer_size, rawinput_calls; static char rawbuffer[1024]; @@ -5997,6 +6022,7 @@ START_TEST( joystick8 ) test_driving_wheel_axes(); test_rawinput( argv ); test_windows_gaming_input(); + test_game_input(); }
done: