user32/tests: Move rawinput tests into input.c.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b466419c32
commit
4a58d67106
|
@ -17,7 +17,6 @@ C_SRCS = \
|
||||||
menu.c \
|
menu.c \
|
||||||
monitor.c \
|
monitor.c \
|
||||||
msg.c \
|
msg.c \
|
||||||
rawinput.c \
|
|
||||||
resource.c \
|
resource.c \
|
||||||
scroll.c \
|
scroll.c \
|
||||||
static.c \
|
static.c \
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* Test Key event to Key message translation
|
/* Test Key event to Key message translation
|
||||||
*
|
*
|
||||||
* Copyright 2003 Rein Klazes
|
* Copyright 2003 Rein Klazes
|
||||||
|
* Copyright 2019 Remi Bernon for CodeWeavers
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -1712,6 +1713,75 @@ static void test_GetRawInputData(void)
|
||||||
ok(ret == ~0U, "Expect ret %u, got %u\n", ~0U, ret);
|
ok(ret == ~0U, "Expect ret %u, got %u\n", ~0U, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_RegisterRawInputDevices(void)
|
||||||
|
{
|
||||||
|
HWND hwnd;
|
||||||
|
RAWINPUTDEVICE raw_devices[1];
|
||||||
|
BOOL res;
|
||||||
|
|
||||||
|
raw_devices[0].usUsagePage = 0x01;
|
||||||
|
raw_devices[0].usUsage = 0x05;
|
||||||
|
|
||||||
|
hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
|
||||||
|
ok(hwnd != NULL, "CreateWindowExA failed\n");
|
||||||
|
|
||||||
|
|
||||||
|
res = RegisterRawInputDevices(NULL, 0, 0);
|
||||||
|
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
||||||
|
|
||||||
|
|
||||||
|
raw_devices[0].dwFlags = 0;
|
||||||
|
raw_devices[0].hwndTarget = 0;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), 0);
|
||||||
|
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||||
|
ok(res == TRUE, "RegisterRawInputDevices failed\n");
|
||||||
|
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||||
|
|
||||||
|
|
||||||
|
/* RIDEV_REMOVE requires hwndTarget == NULL */
|
||||||
|
raw_devices[0].dwFlags = RIDEV_REMOVE;
|
||||||
|
raw_devices[0].hwndTarget = hwnd;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||||
|
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||||
|
|
||||||
|
raw_devices[0].hwndTarget = 0;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||||
|
ok(res == TRUE, "RegisterRawInputDevices failed\n");
|
||||||
|
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||||
|
|
||||||
|
|
||||||
|
/* RIDEV_INPUTSINK requires hwndTarget != NULL */
|
||||||
|
raw_devices[0].dwFlags = RIDEV_INPUTSINK;
|
||||||
|
raw_devices[0].hwndTarget = 0;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||||
|
todo_wine
|
||||||
|
ok(res == FALSE, "RegisterRawInputDevices failed\n");
|
||||||
|
todo_wine
|
||||||
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||||
|
|
||||||
|
raw_devices[0].hwndTarget = hwnd;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||||
|
ok(res == TRUE, "RegisterRawInputDevices succeeded\n");
|
||||||
|
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||||
|
|
||||||
|
DestroyWindow(hwnd);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_key_map(void)
|
static void test_key_map(void)
|
||||||
{
|
{
|
||||||
HKL kl = GetKeyboardLayout(0);
|
HKL kl = GetKeyboardLayout(0);
|
||||||
|
@ -2902,6 +2972,7 @@ START_TEST(input)
|
||||||
test_GetKeyState();
|
test_GetKeyState();
|
||||||
test_OemKeyScan();
|
test_OemKeyScan();
|
||||||
test_GetRawInputData();
|
test_GetRawInputData();
|
||||||
|
test_RegisterRawInputDevices();
|
||||||
|
|
||||||
if(pGetMouseMovePointsEx)
|
if(pGetMouseMovePointsEx)
|
||||||
test_GetMouseMovePointsEx();
|
test_GetMouseMovePointsEx();
|
||||||
|
|
|
@ -1,101 +0,0 @@
|
||||||
/* Unit test suite for rawinput.
|
|
||||||
*
|
|
||||||
* Copyright 2019 Remi Bernon for CodeWeavers
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#define STRICT
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#include "wine/test.h"
|
|
||||||
|
|
||||||
static void test_RegisterRawInputDevices(void)
|
|
||||||
{
|
|
||||||
HWND hwnd;
|
|
||||||
RAWINPUTDEVICE raw_devices[1];
|
|
||||||
BOOL res;
|
|
||||||
|
|
||||||
raw_devices[0].usUsagePage = 0x01;
|
|
||||||
raw_devices[0].usUsage = 0x05;
|
|
||||||
|
|
||||||
hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
|
|
||||||
ok(hwnd != NULL, "CreateWindowExA failed\n");
|
|
||||||
|
|
||||||
|
|
||||||
res = RegisterRawInputDevices(NULL, 0, 0);
|
|
||||||
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
|
||||||
|
|
||||||
|
|
||||||
raw_devices[0].dwFlags = 0;
|
|
||||||
raw_devices[0].hwndTarget = 0;
|
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), 0);
|
|
||||||
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
|
||||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
|
||||||
ok(res == TRUE, "RegisterRawInputDevices failed\n");
|
|
||||||
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
|
||||||
|
|
||||||
|
|
||||||
/* RIDEV_REMOVE requires hwndTarget == NULL */
|
|
||||||
raw_devices[0].dwFlags = RIDEV_REMOVE;
|
|
||||||
raw_devices[0].hwndTarget = hwnd;
|
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
|
||||||
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
|
||||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
|
||||||
|
|
||||||
raw_devices[0].hwndTarget = 0;
|
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
|
||||||
ok(res == TRUE, "RegisterRawInputDevices failed\n");
|
|
||||||
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
|
||||||
|
|
||||||
|
|
||||||
/* RIDEV_INPUTSINK requires hwndTarget != NULL */
|
|
||||||
raw_devices[0].dwFlags = RIDEV_INPUTSINK;
|
|
||||||
raw_devices[0].hwndTarget = 0;
|
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
|
||||||
todo_wine
|
|
||||||
ok(res == FALSE, "RegisterRawInputDevices failed\n");
|
|
||||||
todo_wine
|
|
||||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
|
||||||
|
|
||||||
raw_devices[0].hwndTarget = hwnd;
|
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
|
||||||
ok(res == TRUE, "RegisterRawInputDevices succeeded\n");
|
|
||||||
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
|
||||||
|
|
||||||
DestroyWindow(hwnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
START_TEST(rawinput)
|
|
||||||
{
|
|
||||||
test_RegisterRawInputDevices();
|
|
||||||
}
|
|
Loading…
Reference in New Issue