Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/dinput8/tests/hid.c | 41 ++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c index 7eba2f9f035..74f07c65498 100644 --- a/dlls/dinput8/tests/hid.c +++ b/dlls/dinput8/tests/hid.c @@ -5037,7 +5037,7 @@ struct device_desc HIDP_CAPS hid_caps; };
-static BOOL test_device_types(void) +static BOOL test_device_types( DWORD version ) { #include "psh_hid_macros.h" static const unsigned char unknown_desc[] = @@ -5197,32 +5197,36 @@ static BOOL test_device_types(void) }, }, }; - static const DIDEVCAPS expect_caps[] = + const DIDEVCAPS expect_caps[] = { { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .dwButtons = 6, }, { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .dwAxes = 2, .dwButtons = 6, }, { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_GAMEPAD << 8)|DIDEVTYPE_JOYSTICK, .dwAxes = 2, .dwButtons = 6, }, { .dwSize = sizeof(DIDEVCAPS), .dwFlags = DIDC_ATTACHED|DIDC_EMULATED, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .dwAxes = 3, .dwPOVs = 1, .dwButtons = 5, @@ -5235,7 +5239,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPESUPPLEMENTAL_UNKNOWN << 8)|DI8DEVTYPE_SUPPLEMENTAL + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5246,7 +5251,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_LIMITED << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5257,7 +5263,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEGAMEPAD_STANDARD << 8)|DI8DEVTYPE_GAMEPAD + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_GAMEPAD << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5268,7 +5275,8 @@ static BOOL test_device_types(void) .dwSize = sizeof(DIDEVICEINSTANCEW), .guidInstance = expect_guid_product, .guidProduct = expect_guid_product, - .dwDevType = DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK, + .dwDevType = version >= 0x800 ? DIDEVTYPE_HID|(DI8DEVTYPEJOYSTICK_STANDARD << 8)|DI8DEVTYPE_JOYSTICK + : DIDEVTYPE_HID|(DIDEVTYPEJOYSTICK_UNKNOWN << 8)|DIDEVTYPE_JOYSTICK, .tszInstanceName = L"Wine test root driver", .tszProductName = L"Wine test root driver", .guidFFDriver = GUID_NULL, @@ -5285,6 +5293,8 @@ static BOOL test_device_types(void) ULONG i, ref; HRESULT hr;
+ winetest_push_context( "version %#x", version ); + for (i = 0; i < ARRAY_SIZE(device_desc) && success; ++i) { winetest_push_context( "desc[%d]", i ); @@ -5300,7 +5310,7 @@ static BOOL test_device_types(void) goto done; }
- if (FAILED(hr = create_dinput_device( DIRECTINPUT_VERSION, &devinst, &device ))) + if (FAILED(hr = create_dinput_device( version, &devinst, &device ))) { success = FALSE; goto done; @@ -5312,6 +5322,7 @@ static BOOL test_device_types(void) todo_wine check_member_guid( devinst, expect_devinst[i], guidInstance ); check_member_guid( devinst, expect_devinst[i], guidProduct ); + todo_wine_if( version <= 0x700 && i == 3 ) check_member( devinst, expect_devinst[i], "%#x", dwDevType ); todo_wine check_member_wstr( devinst, expect_devinst[i], tszInstanceName ); @@ -5325,6 +5336,7 @@ static BOOL test_device_types(void) ok( hr == DI_OK, "GetCapabilities returned %#x\n", hr ); check_member( caps, expect_caps[i], "%d", dwSize ); check_member( caps, expect_caps[i], "%#x", dwFlags ); + todo_wine_if( version <= 0x700 && i == 3 ) check_member( caps, expect_caps[i], "%#x", dwDevType ); check_member( caps, expect_caps[i], "%d", dwAxes ); check_member( caps, expect_caps[i], "%d", dwButtons ); @@ -5345,6 +5357,8 @@ static BOOL test_device_types(void) winetest_pop_context(); }
+ winetest_pop_context(); + return success; }
@@ -7753,8 +7767,11 @@ START_TEST( hid ) test_hid_driver( 1, TRUE );
CoInitialize( NULL ); - if (test_device_types()) + if (test_device_types( 0x800 )) { + test_device_types( 0x500 ); + test_device_types( 0x700 ); + test_simple_joystick(); test_force_feedback_joystick( 0x500 ); test_force_feedback_joystick( 0x700 );