Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
---
Or we could move the rawinput tests out of input.c into rawinput.c
dlls/user32/tests/Makefile.in | 1 -
dlls/user32/tests/input.c | 71 ++++++++++++++++++++++++
dlls/user32/tests/rawinput.c | 101 ----------------------------------
3 files changed, 71 insertions(+), 102 deletions(-)
delete mode 100644 dlls/user32/tests/rawinput.c
diff --git a/dlls/user32/tests/Makefile.in b/dlls/user32/tests/Makefile.in
index 26bc3b2bc6d..7149dc824ea 100644
--- a/dlls/user32/tests/Makefile.in
+++ b/dlls/user32/tests/Makefile.in
@@ -17,7 +17,6 @@ C_SRCS = \
menu.c \
monitor.c \
msg.c \
- rawinput.c \
resource.c \
scroll.c \
static.c \
diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c
index c5cf9556ede..5723af3fd2b 100644
--- a/dlls/user32/tests/input.c
+++ b/dlls/user32/tests/input.c
@@ -1,6 +1,7 @@
/* Test Key event to Key message translation
*
* Copyright 2003 Rein Klazes
+ * 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
@@ -1712,6 +1713,75 @@ static void test_GetRawInputData(void)
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)
{
HKL kl = GetKeyboardLayout(0);
@@ -2902,6 +2972,7 @@ START_TEST(input)
test_GetKeyState();
test_OemKeyScan();
test_GetRawInputData();
+ test_RegisterRawInputDevices();
if(pGetMouseMovePointsEx)
test_GetMouseMovePointsEx();
diff --git a/dlls/user32/tests/rawinput.c b/dlls/user32/tests/rawinput.c
deleted file mode 100644
index f4c8eb6738b..00000000000
--- a/dlls/user32/tests/rawinput.c
+++ /dev/null
@@ -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();
-}
--
2.23.0