These tests ensure the Instance GUID and Product GUIDs are the same for keyboard and mouse.
Signed-off-by: Brendan McGrath brendan@redmandi.com --- Changes since v3: - fix test output on failure (was printing guidProduct twice)
dlls/dinput/tests/dinput.c | 13 +++++++++++++ dlls/dinput8/tests/dinput.c | 13 +++++++++++++ 2 files changed, 26 insertions(+)
diff --git a/dlls/dinput/tests/dinput.c b/dlls/dinput/tests/dinput.c index 7e2da9ff32..6eec038a35 100644 --- a/dlls/dinput/tests/dinput.c +++ b/dlls/dinput/tests/dinput.c @@ -392,6 +392,19 @@ static BOOL CALLBACK enum_devices_callback(const DIDEVICEINSTANCEA *instance, vo { struct enum_devices_test *enum_test = context;
+ if ((instance->dwDevType & 0xff) == DIDEVTYPE_KEYBOARD || + (instance->dwDevType & 0xff) == DIDEVTYPE_MOUSE) { + const char *device = ((instance->dwDevType & 0xff) == + DIDEVTYPE_KEYBOARD) ? "Keyboard" : "Mouse"; + int cmp = memcmp(&instance->guidInstance, + &instance->guidProduct, + sizeof(instance->guidInstance)); + ok(cmp == 0, "%s guidInstance (%s) does not match guidProduct (%s)\n", + device, + wine_dbgstr_guid(&instance->guidInstance), + wine_dbgstr_guid(&instance->guidProduct)); + } + enum_test->device_count++; return enum_test->return_value; } diff --git a/dlls/dinput8/tests/dinput.c b/dlls/dinput8/tests/dinput.c index b093437096..4eabb58c61 100644 --- a/dlls/dinput8/tests/dinput.c +++ b/dlls/dinput8/tests/dinput.c @@ -377,6 +377,19 @@ static BOOL CALLBACK enum_devices_callback(const DIDEVICEINSTANCEA *instance, vo instance->wUsagePage, instance->wUsage);
+ if ((instance->dwDevType & 0xff) == DI8DEVTYPE_KEYBOARD || + (instance->dwDevType & 0xff) == DI8DEVTYPE_MOUSE) { + const char *device = ((instance->dwDevType & 0xff) == + DI8DEVTYPE_KEYBOARD) ? "Keyboard" : "Mouse"; + int cmp = memcmp(&instance->guidInstance, + &instance->guidProduct, + sizeof(instance->guidInstance)); + ok(cmp == 0, "%s guidInstance (%s) does not match guidProduct (%s)\n", + device, + wine_dbgstr_guid(&instance->guidInstance), + wine_dbgstr_guid(&instance->guidProduct)); + } + enum_test->device_count++; return enum_test->return_value; }