From cc953cd1d7324469ed5f0a9465ebd1557d4bf0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincas=20Mili=C5=ABnas?= Date: Tue, 5 Jul 2011 23:15:38 +0300 Subject: [PATCH 10/20] user32/tests: Added basic GetRawInputBuffer tests (try 16) --- dlls/user32/tests/input.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 180d2e4..8b9a516 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -78,6 +78,7 @@ static struct { static UINT (WINAPI *pSendInput) (UINT, INPUT*, size_t); static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEPOINT, int, DWORD); static UINT (WINAPI *pDefRawInputProc) (PRAWINPUT*, INT, UINT); +static UINT (WINAPI *pGetRawInputBuffer) (PRAWINPUT, PUINT, UINT); static INT (WINAPI *pGetRawInputData) (HRAWINPUT, UINT, LPVOID, PUINT, UINT); static UINT (WINAPI *pGetRawInputDeviceInfoA) (HANDLE, UINT, LPVOID, PUINT); static UINT (WINAPI *pGetRawInputDeviceInfoW) (HANDLE, UINT, LPVOID, PUINT); @@ -172,6 +173,7 @@ static void init_function_pointers(void) GET_PROC(SendInput) GET_PROC(DefRawInputProc) GET_PROC(GetMouseMovePointsEx) + GET_PROC(GetRawInputBuffer) GET_PROC(GetRawInputData) GET_PROC(GetRawInputDeviceInfoA) GET_PROC(GetRawInputDeviceInfoW) @@ -2423,6 +2425,48 @@ static void test_get_raw_input_data(void) "wrong error code: %u\n", error); } +static void test_get_raw_input_buffer(void) +{ + UINT ret, size; + DWORD error; + + if (!pGetRawInputBuffer) + { + win_skip("GetRawInputBuffer is not available\n"); + return; + } + + SetLastError(0xdeadbeef); + ret = pGetRawInputBuffer(NULL, NULL, 0); + error = GetLastError(); + todo_wine ok(ret == (UINT)-1, "GetRawInputBuffer returned wrong value: " + "expected (UINT)-1, got %u\n", ret); + todo_wine ok(error == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned " + "wrong error code: %u\n", error); + + SetLastError(0xdeadbeef); + ret = pGetRawInputBuffer(NULL, NULL, sizeof(RAWINPUTHEADER)); + error = GetLastError(); + todo_wine ok(ret == (UINT)-1, "GetRawInputBuffer returned wrong value: " + "expected (UINT)-1, got %u\n", ret); + todo_wine ok(error == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned " + "wrong error code: %u\n", error); + + SetLastError(0xdeadbeef); + ret = pGetRawInputBuffer(NULL, &size, 1); + error = GetLastError(); + todo_wine ok(ret == (UINT)-1, "GetRawInputBuffer returned wrong value: " + "expected (UINT)-1, got %u\n", ret); + todo_wine ok(error == ERROR_INVALID_PARAMETER, "GetRawInputBuffer returned " + "wrong error code: %u\n", error); + + size = 0xdeadbeef; + ret = pGetRawInputBuffer(NULL, &size, sizeof(RAWINPUTHEADER)); + ok(ret == 0, "GetRawInputBuffer returned wrong value: expected 0, got %u\n", ret); + todo_wine ok(size == 0, "GetRawInputBuffer returned wrong minimal buffer size: " + "expected 0, got %u\n", size); +} + START_TEST(input) { init_function_pointers(); @@ -2451,6 +2495,7 @@ START_TEST(input) test_raw_input_device_flag_preconditions(); test_extended_register_raw_input_devices(); test_get_raw_input_data(); + test_get_raw_input_buffer(); if(pGetMouseMovePointsEx) test_GetMouseMovePointsEx(); -- 1.7.3.4