https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a9675d00a2a5f1e8ee2df…
commit a9675d00a2a5f1e8ee2df32c7b20e50df26e38e4
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Fri May 12 22:35:55 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Tue May 16 21:59:19 2023 +0300
[USER32_APITEST] Add tests for [Get|Set]Window[Word|Long|LongPtr]
---
modules/rostests/apitests/user32/CMakeLists.txt | 1 +
modules/rostests/apitests/user32/GetSetWindowInt.c | 77 ++++++++++++++++++++++
modules/rostests/apitests/user32/testlist.c | 2 +
3 files changed, 80 insertions(+)
diff --git a/modules/rostests/apitests/user32/CMakeLists.txt
b/modules/rostests/apitests/user32/CMakeLists.txt
index a9f4a4cb859..2ee5e76b815 100644
--- a/modules/rostests/apitests/user32/CMakeLists.txt
+++ b/modules/rostests/apitests/user32/CMakeLists.txt
@@ -20,6 +20,7 @@ list(APPEND SOURCE
GetKeyState.c
GetMessageTime.c
GetPeekMessage.c
+ GetSetWindowInt.c
GetSystemMetrics.c
GetUserObjectInformation.c
GetWindowPlacement.c
diff --git a/modules/rostests/apitests/user32/GetSetWindowInt.c
b/modules/rostests/apitests/user32/GetSetWindowInt.c
new file mode 100644
index 00000000000..ef77cac4958
--- /dev/null
+++ b/modules/rostests/apitests/user32/GetSetWindowInt.c
@@ -0,0 +1,77 @@
+/*
+ * PROJECT: ReactOS api tests
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Tests for GetClassInfo
+ * COPYRIGHT: Copyright 2023 Timo Kreuzer <timo.kreuzer(a)reactos.org>
+ */
+
+#include "precomp.h"
+
+START_TEST(GetSetWindowInt)
+{
+ WNDCLASSEXW wcex = { 0 };
+ ATOM atom;
+ HWND hwnd;
+
+ wcex.cbSize = sizeof(WNDCLASSEXW);
+ wcex.style = 0x1;
+ wcex.lpfnWndProc = DefWindowProcW;
+ wcex.cbClsExtra = 1;
+ wcex.cbWndExtra = 5;
+ wcex.hInstance = GetModuleHandle(NULL);
+ wcex.lpszClassName = L"ProTestClass1";
+
+ atom = RegisterClassExW(&wcex);
+ ok(atom != 0, "Failed to register class!\n");
+
+ hwnd = CreateWindowW(wcex.lpszClassName,
+ L"WindowTitle",
+ WS_POPUP,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ NULL,
+ NULL,
+ GetModuleHandle(NULL),
+ NULL);
+ ok(hwnd != 0, "\n");
+
+ SetLastError(0xdeadbeef);
+ ok_hex(SetWindowWord(hwnd, 0, 0x1234), 0);
+ ok_hex(GetWindowWord(hwnd, 0), 0x1234);
+ ok_hex(SetWindowWord(hwnd, 1, 0x2345), 0x12);
+ ok_hex(GetWindowWord(hwnd, 1), 0x2345);
+ ok_hex(SetWindowWord(hwnd, 2, 0x3456), 0x23);
+ ok_hex(GetWindowWord(hwnd, 2), 0x3456);
+ ok_hex(SetWindowWord(hwnd, 3, 0x4567), 0x34);
+ ok_hex(GetWindowWord(hwnd, 3), 0x4567);
+ ok_err(0xdeadbeef);
+ ok_hex(SetWindowWord(hwnd, 4, 0x5678), 0);
+ ok_err(ERROR_INVALID_INDEX);
+ SetLastError(0xdeadbeef);
+ ok_hex(GetWindowWord(hwnd, 4), 0);
+ ok_err(ERROR_INVALID_INDEX);
+
+ SetLastError(0xdeadbeef);
+ ok_hex(SetWindowLong(hwnd, 0, 0x12345678), 0x67564534);
+ ok_hex(GetWindowLong(hwnd, 0), 0x12345678);
+ ok_hex(SetWindowLong(hwnd, 1, 0x23456789), 0x45123456);
+ ok_hex(GetWindowLong(hwnd, 1), 0x23456789);
+ ok_err(0xdeadbeef);
+ ok_hex(SetWindowLong(hwnd, 2, 0x3456789a), 0);
+ ok_err(ERROR_INVALID_INDEX);
+ SetLastError(0xdeadbeef);
+ ok_hex(GetWindowLong(hwnd, 2), 0);
+ ok_err(ERROR_INVALID_INDEX);
+
+#ifdef _WIN64
+ SetLastError(0xdeadbeef);
+ ok_hex(SetWindowLongPtr(hwnd, 0, 123), 0);
+ ok_err(ERROR_INVALID_INDEX);
+ SetLastError(0xdeadbeef);
+ ok_hex(GetWindowLongPtr(hwnd, 0), 0);
+ ok_err(ERROR_INVALID_INDEX);
+#endif
+
+}
diff --git a/modules/rostests/apitests/user32/testlist.c
b/modules/rostests/apitests/user32/testlist.c
index 34c34259eda..9b351182afb 100644
--- a/modules/rostests/apitests/user32/testlist.c
+++ b/modules/rostests/apitests/user32/testlist.c
@@ -22,6 +22,7 @@ extern void func_GetIconInfo(void);
extern void func_GetKeyState(void);
extern void func_GetMessageTime(void);
extern void func_GetPeekMessage(void);
+extern void func_GetSetWindowInt(void);
extern void func_GetSystemMetrics(void);
extern void func_GetUserObjectInformation(void);
extern void func_GetWindowPlacement(void);
@@ -77,6 +78,7 @@ const struct test winetest_testlist[] =
{ "GetKeyState", func_GetKeyState },
{ "GetMessageTime", func_GetMessageTime },
{ "GetPeekMessage", func_GetPeekMessage },
+ { "GetSetWindowInt", func_GetSetWindowInt },
{ "GetSystemMetrics", func_GetSystemMetrics },
{ "GetUserObjectInformation", func_GetUserObjectInformation },
{ "GetWindowPlacement", func_GetWindowPlacement },