[PATCH v2] dinput/tests: Prove that GetDeviceData() does nothing.
Signed-off-by: Arkadiusz Hiler <ahiler(a)codeweavers.com> --- v2: use separate ok()s supersedes 210145 dlls/dinput/tests/mouse.c | 47 ++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c index 69051bb2a34..6bae6b9fe1e 100644 --- a/dlls/dinput/tests/mouse.c +++ b/dlls/dinput/tests/mouse.c @@ -106,7 +106,7 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd) DIMOUSESTATE m_state; HWND hwnd2; DIPROPDWORD di_op; - DIDEVICEOBJECTDATA mouse_state; + DIDEVICEOBJECTDATA mouse_state[30]; DWORD cnt; int i; @@ -159,16 +159,22 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd) ok(hr == S_OK, "Acquire() failed: %08x\n", hr); mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0); - cnt = 1; - hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0); - ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt); + cnt = ARRAY_SIZE(mouse_state); + mouse_state[0].dwTimeStamp = 0xdeadbeef; + hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state[0]), mouse_state, &cnt, 0); + todo_wine ok(hr == S_OK, "GetDeviceData() failed: %08x\n", hr); + todo_wine ok(cnt == ARRAY_SIZE(mouse_state), "GetDeviceData() unexpected cnt: %d\n", cnt); + todo_wine ok(mouse_state[0].dwTimeStamp == 0xdeadbeef, "GetDeviceData() overwrote the timestamp: %d\n", mouse_state[0].dwTimeStamp); mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0); hr = IDirectInputDevice_Unacquire(pMouse); ok(hr == S_OK, "Failed: %08x\n", hr); - cnt = 1; - hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0); - ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt); + cnt = ARRAY_SIZE(mouse_state); + mouse_state[0].dwTimeStamp = 0xdeadbeef; + hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state[0]), mouse_state, &cnt, 0); + todo_wine ok(hr == S_OK, "GetDeviceData() failed: %08x\n", hr); + todo_wine ok(cnt == ARRAY_SIZE(mouse_state), "GetDeviceData() unexpected cnt: %d\n", cnt); + todo_wine ok(mouse_state[0].dwTimeStamp == 0xdeadbeef, "GetDeviceData() overwrote the timestamp: %d\n", mouse_state[0].dwTimeStamp); hr = IDirectInputDevice_Acquire(pMouse); ok(hr == S_OK, "Failed: %08x\n", hr); @@ -178,20 +184,29 @@ static void test_acquire(IDirectInputA *pDI, HWND hwnd) hr = IDirectInputDevice_Acquire(pMouse); ok(hr == S_OK, "Failed: %08x\n", hr); - cnt = 1; - hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0); - ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt); + cnt = ARRAY_SIZE(mouse_state); + mouse_state[0].dwTimeStamp = 0xdeadbeef; + hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state[0]), mouse_state, &cnt, 0); + todo_wine ok(hr == S_OK, "GetDeviceData() failed: %08x\n", hr); + todo_wine ok(cnt == ARRAY_SIZE(mouse_state), "GetDeviceData() unexpected cnt: %d\n", cnt); + todo_wine ok(mouse_state[0].dwTimeStamp == 0xdeadbeef, "GetDeviceData() overwrote the timestamp: %d\n", mouse_state[0].dwTimeStamp); /* Check for buffer overflow */ for (i = 0; i < 6; i++) mouse_event(MOUSEEVENTF_MOVE, 10 + i, 10 + i, 0, 0); - cnt = 1; - hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0); - ok(hr == DI_OK, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt); - cnt = 1; - hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0); - ok(hr == DI_OK && cnt == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, cnt); + cnt = ARRAY_SIZE(mouse_state); + mouse_state[0].dwTimeStamp = 0xdeadbeef; + hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state[0]), mouse_state, &cnt, 0); + todo_wine ok(hr == S_OK, "GetDeviceData() failed: %08x\n", hr); + todo_wine ok(cnt == ARRAY_SIZE(mouse_state), "GetDeviceData() unexpected cnt: %d\n", cnt); + todo_wine ok(mouse_state[0].dwTimeStamp == 0xdeadbeef, "GetDeviceData() overwrote the timestamp: %d\n", mouse_state[0].dwTimeStamp); + cnt = ARRAY_SIZE(mouse_state); + mouse_state[0].dwTimeStamp = 0xdeadbeef; + hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state[0]), mouse_state, &cnt, 0); + todo_wine ok(hr == S_OK, "GetDeviceData() failed: %08x\n", hr); + todo_wine ok(cnt == ARRAY_SIZE(mouse_state), "GetDeviceData() unexpected cnt: %d\n", cnt); + todo_wine ok(mouse_state[0].dwTimeStamp == 0xdeadbeef, "GetDeviceData() overwrote the timestamp: %d\n", mouse_state[0].dwTimeStamp); /* Check for granularity property using BYOFFSET */ memset(&di_op, 0, sizeof(di_op)); -- 2.32.0
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=94582 Your paranoid android. === debiant2 (32 bit report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit Arabic:Morocco report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit German report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit French report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit Hebrew:Israel report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit Hindi:India report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit Japanese:Japan report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit Chinese:China report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (32 bit WoW report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737 === debiant2 (64 bit WoW report) === dinput: mouse.c:165: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:175: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:190: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:201: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:207: Test succeeded inside todo block: GetDeviceData() failed: 00000000 mouse.c:209: Test succeeded inside todo block: GetDeviceData() overwrote the timestamp: -559038737
participants (2)
-
Arkadiusz Hiler -
Marvin