[PATCH 1/3] user32/tests: Added client-side raw input function tests (try 4)
Vitaliy Margolen
wine-devel at kievinfo.com
Mon Jun 20 09:07:41 CDT 2011
On 06/20/2011 02:55 AM, Vincas Miliūnas wrote:
> Fixed function name typo, compiler warnings, code style issues in a
> fragment of new code and incorrect usage of wcslen in the tests instead
> of lstrlenW after previous changes. My apologies :).
>
> +#define DEADBEEF 0xdeadbeef
Please don't do this. Just explicitly use 0xdeadbeef everywhere.
> + todo_wine ok(ret == 0 && GetLastError() == DEADBEEF && count >= 1, "Given (NULL, &count, sizeof), "
> + "GetRawInputDeviceList should return the number of raw input devices\n");
If call succeeded you don't need to check last error.
> + device_list = malloc(count * sizeof(RAWINPUTDEVICELIST));
Don't use malloc/free in Wine. Use HeapAlloc / HeapFree.
> + ret = pGetRawInputDeviceList(device_list, &count2, sizeof(RAWINPUTDEVICELIST));
> + todo_wine ok(ret == (UINT)-1 && GetLastError() == ERROR_INSUFFICIENT_BUFFER && count2 == count,
> + "Given (device_list, &count2 = 0, sizeof), GetRawInputDeviceList should return an error\n");
If something fails it's nice to know the error code - you need to print it.
For that you need to more GetLastError outside of ok() function call. See
other tests as example.
> +static BOOL get_raw_input_data_wnd_proc_was_called = FALSE;
Static variables automatically set to 0 at the start. You don't need to do
it explicitly.
Vitaliy.
More information about the wine-devel
mailing list