[PATCH 2/3] dinput8/tests: Make overflow test more robust.

Arkadiusz Hiler ahiler at codeweavers.com
Tue Aug 3 05:59:26 CDT 2021


On Windows dinput sometimes ignores injected input events.

Signed-off-by: Arkadiusz Hiler <ahiler at codeweavers.com>
---
 dlls/dinput8/tests/device.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index 17deed193dd..7d6f8442085 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -127,10 +127,16 @@ static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWO
 
     data_size = 1;
     hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0);
-    ok(hr == DI_BUFFEROVERFLOW, "GetDeviceData() failed: %08x\n", hr);
-    data_size = 1;
-    hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0);
-    ok(hr == DI_OK && data_size == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, data_size);
+    if (hr != DI_BUFFEROVERFLOW)
+    {
+        win_skip("We're not able to inject input into Windows dinput8 with events\n");
+    }
+    else
+    {
+        data_size = 1;
+        hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0);
+        ok(hr == DI_OK && data_size == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, data_size);
+    }
 
     /* drain device's queue */
     while (data_size == 1)
-- 
2.32.0




More information about the wine-devel mailing list