dinput/tests: Move Windows.Gaming.Input.RacingWheel tests to joystick8.c.
Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4ee3edf98c
commit
92f05bd3e7
|
@ -4587,17 +4587,15 @@ static void test_windows_gaming_input(void)
|
||||||
COLLECTION(1, Physical),
|
COLLECTION(1, Physical),
|
||||||
REPORT_ID(1, 1),
|
REPORT_ID(1, 1),
|
||||||
|
|
||||||
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_STEERING),
|
|
||||||
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_ACCELERATOR),
|
|
||||||
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_BRAKE),
|
|
||||||
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_CLUTCH),
|
|
||||||
USAGE(1, HID_USAGE_GENERIC_X),
|
USAGE(1, HID_USAGE_GENERIC_X),
|
||||||
|
USAGE(1, HID_USAGE_GENERIC_Y),
|
||||||
|
USAGE(1, HID_USAGE_GENERIC_Z),
|
||||||
LOGICAL_MINIMUM(1, 0),
|
LOGICAL_MINIMUM(1, 0),
|
||||||
LOGICAL_MAXIMUM(1, 127),
|
LOGICAL_MAXIMUM(1, 127),
|
||||||
PHYSICAL_MINIMUM(1, 0),
|
PHYSICAL_MINIMUM(1, 0),
|
||||||
PHYSICAL_MAXIMUM(1, 127),
|
PHYSICAL_MAXIMUM(1, 127),
|
||||||
REPORT_SIZE(1, 8),
|
REPORT_SIZE(1, 8),
|
||||||
REPORT_COUNT(1, 5),
|
REPORT_COUNT(1, 3),
|
||||||
INPUT(1, Data|Var|Abs),
|
INPUT(1, Data|Var|Abs),
|
||||||
|
|
||||||
USAGE(1, HID_USAGE_GENERIC_HATSWITCH),
|
USAGE(1, HID_USAGE_GENERIC_HATSWITCH),
|
||||||
|
@ -5006,7 +5004,7 @@ static void test_windows_gaming_input(void)
|
||||||
struct hid_device_desc desc =
|
struct hid_device_desc desc =
|
||||||
{
|
{
|
||||||
.use_report_id = TRUE,
|
.use_report_id = TRUE,
|
||||||
.caps = { .InputReportByteLength = 8 },
|
.caps = { .InputReportByteLength = 6 },
|
||||||
.attributes = default_attributes,
|
.attributes = default_attributes,
|
||||||
};
|
};
|
||||||
struct hid_expect expect_init[] =
|
struct hid_expect expect_init[] =
|
||||||
|
@ -5148,7 +5146,6 @@ static void test_windows_gaming_input(void)
|
||||||
};
|
};
|
||||||
static const WCHAR *force_feedback_motor = RuntimeClass_Windows_Gaming_Input_ForceFeedback_ForceFeedbackMotor;
|
static const WCHAR *force_feedback_motor = RuntimeClass_Windows_Gaming_Input_ForceFeedback_ForceFeedbackMotor;
|
||||||
static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController;
|
static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController;
|
||||||
static const WCHAR *racing_wheel_class_name = RuntimeClass_Windows_Gaming_Input_RacingWheel;
|
|
||||||
|
|
||||||
DIPROPGUIDANDPATH guid_path =
|
DIPROPGUIDANDPATH guid_path =
|
||||||
{
|
{
|
||||||
|
@ -5166,16 +5163,11 @@ static void test_windows_gaming_input(void)
|
||||||
EventRegistrationToken controller_added_token;
|
EventRegistrationToken controller_added_token;
|
||||||
struct bool_async_handler bool_async_handler;
|
struct bool_async_handler bool_async_handler;
|
||||||
IVectorView_ForceFeedbackMotor *motors_view;
|
IVectorView_ForceFeedbackMotor *motors_view;
|
||||||
IVectorView_RacingWheel *racing_wheels_view;
|
|
||||||
IRacingWheelStatics2 *racing_wheel_statics2;
|
|
||||||
IRacingWheelStatics *racing_wheel_statics;
|
|
||||||
ForceFeedbackEffectAxes supported_axes;
|
ForceFeedbackEffectAxes supported_axes;
|
||||||
IAsyncOperation_boolean *bool_async;
|
IAsyncOperation_boolean *bool_async;
|
||||||
IRawGameController *raw_controller;
|
IRawGameController *raw_controller;
|
||||||
IGameController *game_controller;
|
|
||||||
IDirectInputDevice8W *device;
|
IDirectInputDevice8W *device;
|
||||||
IForceFeedbackMotor *motor;
|
IForceFeedbackMotor *motor;
|
||||||
IRacingWheel *racing_wheel;
|
|
||||||
BOOLEAN paused, enabled;
|
BOOLEAN paused, enabled;
|
||||||
IAsyncInfo *async_info;
|
IAsyncInfo *async_info;
|
||||||
DOUBLE gain;
|
DOUBLE gain;
|
||||||
|
@ -5244,34 +5236,6 @@ static void test_windows_gaming_input(void)
|
||||||
ok( hr == S_OK, "GetAt returned %#lx\n", hr );
|
ok( hr == S_OK, "GetAt returned %#lx\n", hr );
|
||||||
IVectorView_RawGameController_Release( controllers_view );
|
IVectorView_RawGameController_Release( controllers_view );
|
||||||
|
|
||||||
hr = pWindowsCreateString( racing_wheel_class_name, wcslen( racing_wheel_class_name ), &str );
|
|
||||||
ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr );
|
|
||||||
hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics, (void **)&racing_wheel_statics );
|
|
||||||
ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr );
|
|
||||||
hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics2, (void **)&racing_wheel_statics2 );
|
|
||||||
ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr );
|
|
||||||
pWindowsDeleteString( str );
|
|
||||||
|
|
||||||
/* HID driving wheels aren't exposed as WGI gamepads on Windows */
|
|
||||||
|
|
||||||
hr = IRacingWheelStatics_get_RacingWheels( racing_wheel_statics, &racing_wheels_view );
|
|
||||||
ok( hr == S_OK, "get_RacingWheels returned %#lx\n", hr );
|
|
||||||
hr = IVectorView_RacingWheel_get_Size( racing_wheels_view, &size );
|
|
||||||
ok( hr == S_OK, "get_Size returned %#lx\n", hr );
|
|
||||||
todo_wine /* but Wine currently intentionally does */
|
|
||||||
ok( size == 0, "got size %u\n", size );
|
|
||||||
IVectorView_RacingWheel_Release( racing_wheels_view );
|
|
||||||
IRacingWheelStatics_Release( racing_wheel_statics );
|
|
||||||
|
|
||||||
hr = IRawGameController_QueryInterface( raw_controller, &IID_IGameController, (void **)&game_controller );
|
|
||||||
ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
|
|
||||||
hr = IRacingWheelStatics2_FromGameController( racing_wheel_statics2, game_controller, &racing_wheel );
|
|
||||||
ok( hr == S_OK, "FromGameController returned %#lx\n", hr );
|
|
||||||
todo_wine
|
|
||||||
ok( racing_wheel == NULL, "got racing_wheel %p\n", racing_wheel );
|
|
||||||
IGameController_Release( game_controller );
|
|
||||||
IRacingWheelStatics2_Release( racing_wheel_statics2 );
|
|
||||||
|
|
||||||
set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
|
set_hid_expect( file, expect_acquire, sizeof(expect_acquire) );
|
||||||
hr = IRawGameController_get_ForceFeedbackMotors( raw_controller, &motors_view );
|
hr = IRawGameController_get_ForceFeedbackMotors( raw_controller, &motors_view );
|
||||||
ok( hr == S_OK, "get_ForceFeedbackMotors returned %#lx\n", hr );
|
ok( hr == S_OK, "get_ForceFeedbackMotors returned %#lx\n", hr );
|
||||||
|
|
|
@ -3917,6 +3917,49 @@ static void test_windows_gaming_input(void)
|
||||||
END_COLLECTION,
|
END_COLLECTION,
|
||||||
};
|
};
|
||||||
C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN);
|
C_ASSERT(sizeof(report_desc) < MAX_HID_DESCRIPTOR_LEN);
|
||||||
|
static const unsigned char wheel_threepedals_desc[] =
|
||||||
|
{
|
||||||
|
USAGE_PAGE(1, HID_USAGE_PAGE_GENERIC),
|
||||||
|
USAGE(1, HID_USAGE_GENERIC_JOYSTICK),
|
||||||
|
COLLECTION(1, Application),
|
||||||
|
USAGE(1, HID_USAGE_GENERIC_JOYSTICK),
|
||||||
|
COLLECTION(1, Physical),
|
||||||
|
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_STEERING),
|
||||||
|
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_ACCELERATOR),
|
||||||
|
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_BRAKE),
|
||||||
|
USAGE(4, (HID_USAGE_PAGE_SIMULATION<<16)|HID_USAGE_SIMULATION_CLUTCH),
|
||||||
|
USAGE(1, HID_USAGE_GENERIC_Y),
|
||||||
|
LOGICAL_MINIMUM(1, 0),
|
||||||
|
LOGICAL_MAXIMUM(1, 127),
|
||||||
|
PHYSICAL_MINIMUM(1, 0),
|
||||||
|
PHYSICAL_MAXIMUM(1, 127),
|
||||||
|
REPORT_SIZE(1, 8),
|
||||||
|
REPORT_COUNT(1, 5),
|
||||||
|
INPUT(1, Data|Var|Abs),
|
||||||
|
|
||||||
|
USAGE(1, HID_USAGE_GENERIC_HATSWITCH),
|
||||||
|
LOGICAL_MINIMUM(1, 1),
|
||||||
|
LOGICAL_MAXIMUM(1, 8),
|
||||||
|
PHYSICAL_MINIMUM(1, 0),
|
||||||
|
PHYSICAL_MAXIMUM(1, 8),
|
||||||
|
REPORT_SIZE(1, 8),
|
||||||
|
REPORT_COUNT(1, 1),
|
||||||
|
INPUT(1, Data|Var|Abs|Null),
|
||||||
|
|
||||||
|
USAGE_PAGE(1, HID_USAGE_PAGE_BUTTON),
|
||||||
|
USAGE_MINIMUM(1, 1),
|
||||||
|
USAGE_MAXIMUM(1, 5),
|
||||||
|
LOGICAL_MINIMUM(1, 0),
|
||||||
|
LOGICAL_MAXIMUM(1, 1),
|
||||||
|
PHYSICAL_MINIMUM(1, 0),
|
||||||
|
PHYSICAL_MAXIMUM(1, 1),
|
||||||
|
REPORT_SIZE(1, 1),
|
||||||
|
REPORT_COUNT(1, 16),
|
||||||
|
INPUT(1, Data|Var|Abs),
|
||||||
|
END_COLLECTION,
|
||||||
|
END_COLLECTION,
|
||||||
|
};
|
||||||
|
C_ASSERT(sizeof(wheel_threepedals_desc) < MAX_HID_DESCRIPTOR_LEN);
|
||||||
#include "pop_hid_macros.h"
|
#include "pop_hid_macros.h"
|
||||||
|
|
||||||
struct hid_device_desc desc =
|
struct hid_device_desc desc =
|
||||||
|
@ -3926,15 +3969,20 @@ static void test_windows_gaming_input(void)
|
||||||
.attributes = default_attributes,
|
.attributes = default_attributes,
|
||||||
};
|
};
|
||||||
static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController;
|
static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController;
|
||||||
|
static const WCHAR *racing_wheel_class_name = RuntimeClass_Windows_Gaming_Input_RacingWheel;
|
||||||
static const WCHAR *gamepad_class_name = RuntimeClass_Windows_Gaming_Input_Gamepad;
|
static const WCHAR *gamepad_class_name = RuntimeClass_Windows_Gaming_Input_Gamepad;
|
||||||
|
|
||||||
IRawGameController *raw_controller, *tmp_raw_controller;
|
IRawGameController *raw_controller, *tmp_raw_controller;
|
||||||
IVectorView_RawGameController *controllers_view;
|
IVectorView_RawGameController *controllers_view;
|
||||||
IRawGameControllerStatics *controller_statics;
|
IRawGameControllerStatics *controller_statics;
|
||||||
EventRegistrationToken controller_added_token;
|
EventRegistrationToken controller_added_token;
|
||||||
|
IVectorView_RacingWheel *racing_wheels_view;
|
||||||
|
IRacingWheelStatics2 *racing_wheel_statics2;
|
||||||
|
IRacingWheelStatics *racing_wheel_statics;
|
||||||
IVectorView_Gamepad *gamepads_view;
|
IVectorView_Gamepad *gamepads_view;
|
||||||
IGamepadStatics *gamepad_statics;
|
IGamepadStatics *gamepad_statics;
|
||||||
IGameController *game_controller;
|
IGameController *game_controller;
|
||||||
|
IRacingWheel *racing_wheel;
|
||||||
UINT32 size;
|
UINT32 size;
|
||||||
HSTRING str;
|
HSTRING str;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -4044,6 +4092,67 @@ static void test_windows_gaming_input(void)
|
||||||
hr = IRawGameControllerStatics_remove_RawGameControllerAdded( controller_statics, controller_added_token );
|
hr = IRawGameControllerStatics_remove_RawGameControllerAdded( controller_statics, controller_added_token );
|
||||||
ok( hr == S_OK, "remove_RawGameControllerAdded returned %#lx\n", hr );
|
ok( hr == S_OK, "remove_RawGameControllerAdded returned %#lx\n", hr );
|
||||||
|
|
||||||
|
hid_device_stop( &desc );
|
||||||
|
|
||||||
|
|
||||||
|
desc.report_descriptor_len = sizeof(wheel_threepedals_desc);
|
||||||
|
memcpy( desc.report_descriptor_buf, wheel_threepedals_desc, sizeof(wheel_threepedals_desc) );
|
||||||
|
fill_context( __LINE__, desc.context, ARRAY_SIZE(desc.context) );
|
||||||
|
|
||||||
|
controller_added.event = CreateEventW( NULL, FALSE, FALSE, NULL );
|
||||||
|
ok( !!controller_added.event, "CreateEventW failed, error %lu\n", GetLastError() );
|
||||||
|
|
||||||
|
hr = IRawGameControllerStatics_add_RawGameControllerAdded( controller_statics, &controller_added.IEventHandler_RawGameController_iface,
|
||||||
|
&controller_added_token );
|
||||||
|
ok( hr == S_OK, "add_RawGameControllerAdded returned %#lx\n", hr );
|
||||||
|
ok( controller_added_token.value, "got token %I64u\n", controller_added_token.value );
|
||||||
|
|
||||||
|
if (!hid_device_start( &desc )) goto done;
|
||||||
|
WaitForSingleObject( controller_added.event, INFINITE );
|
||||||
|
CloseHandle( controller_added.event );
|
||||||
|
|
||||||
|
hr = IRawGameControllerStatics_get_RawGameControllers( controller_statics, &controllers_view );
|
||||||
|
ok( hr == S_OK, "get_RawGameControllers returned %#lx\n", hr );
|
||||||
|
hr = IVectorView_RawGameController_get_Size( controllers_view, &size );
|
||||||
|
ok( hr == S_OK, "get_Size returned %#lx\n", hr );
|
||||||
|
ok( size == 1, "got size %u\n", size );
|
||||||
|
hr = IVectorView_RawGameController_GetAt( controllers_view, 0, &raw_controller );
|
||||||
|
ok( hr == S_OK, "GetAt returned %#lx\n", hr );
|
||||||
|
IVectorView_RawGameController_Release( controllers_view );
|
||||||
|
|
||||||
|
hr = IRawGameControllerStatics_remove_RawGameControllerAdded( controller_statics, controller_added_token );
|
||||||
|
ok( hr == S_OK, "remove_RawGameControllerAdded returned %#lx\n", hr );
|
||||||
|
|
||||||
|
hr = pWindowsCreateString( racing_wheel_class_name, wcslen( racing_wheel_class_name ), &str );
|
||||||
|
ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr );
|
||||||
|
hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics, (void **)&racing_wheel_statics );
|
||||||
|
ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr );
|
||||||
|
hr = pRoGetActivationFactory( str, &IID_IRacingWheelStatics2, (void **)&racing_wheel_statics2 );
|
||||||
|
ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr );
|
||||||
|
pWindowsDeleteString( str );
|
||||||
|
|
||||||
|
/* HID driving wheels aren't exposed as WGI RacingWheel on Windows */
|
||||||
|
|
||||||
|
hr = IRacingWheelStatics_get_RacingWheels( racing_wheel_statics, &racing_wheels_view );
|
||||||
|
ok( hr == S_OK, "get_RacingWheels returned %#lx\n", hr );
|
||||||
|
hr = IVectorView_RacingWheel_get_Size( racing_wheels_view, &size );
|
||||||
|
ok( hr == S_OK, "get_Size returned %#lx\n", hr );
|
||||||
|
todo_wine /* but Wine currently intentionally does */
|
||||||
|
ok( size == 0, "got size %u\n", size );
|
||||||
|
IVectorView_RacingWheel_Release( racing_wheels_view );
|
||||||
|
IRacingWheelStatics_Release( racing_wheel_statics );
|
||||||
|
|
||||||
|
hr = IRawGameController_QueryInterface( raw_controller, &IID_IGameController, (void **)&game_controller );
|
||||||
|
ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
|
||||||
|
hr = IRacingWheelStatics2_FromGameController( racing_wheel_statics2, game_controller, &racing_wheel );
|
||||||
|
ok( hr == S_OK, "FromGameController returned %#lx\n", hr );
|
||||||
|
todo_wine
|
||||||
|
ok( racing_wheel == NULL, "got racing_wheel %p\n", racing_wheel );
|
||||||
|
if (racing_wheel) IRacingWheel_Release( racing_wheel );
|
||||||
|
IGameController_Release( game_controller );
|
||||||
|
IRacingWheelStatics2_Release( racing_wheel_statics2 );
|
||||||
|
|
||||||
|
IRawGameController_Release( raw_controller );
|
||||||
IRawGameControllerStatics_Release( controller_statics );
|
IRawGameControllerStatics_Release( controller_statics );
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
Loading…
Reference in New Issue