mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:22:57 +00:00
[USER32_APITEST] Add tests for [Get|Set]Window[Word|Long|LongPtr]
This commit is contained in:
parent
fefc5f4823
commit
a9675d00a2
3 changed files with 80 additions and 0 deletions
|
@ -20,6 +20,7 @@ list(APPEND SOURCE
|
||||||
GetKeyState.c
|
GetKeyState.c
|
||||||
GetMessageTime.c
|
GetMessageTime.c
|
||||||
GetPeekMessage.c
|
GetPeekMessage.c
|
||||||
|
GetSetWindowInt.c
|
||||||
GetSystemMetrics.c
|
GetSystemMetrics.c
|
||||||
GetUserObjectInformation.c
|
GetUserObjectInformation.c
|
||||||
GetWindowPlacement.c
|
GetWindowPlacement.c
|
||||||
|
|
77
modules/rostests/apitests/user32/GetSetWindowInt.c
Normal file
77
modules/rostests/apitests/user32/GetSetWindowInt.c
Normal file
|
@ -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@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
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ extern void func_GetIconInfo(void);
|
||||||
extern void func_GetKeyState(void);
|
extern void func_GetKeyState(void);
|
||||||
extern void func_GetMessageTime(void);
|
extern void func_GetMessageTime(void);
|
||||||
extern void func_GetPeekMessage(void);
|
extern void func_GetPeekMessage(void);
|
||||||
|
extern void func_GetSetWindowInt(void);
|
||||||
extern void func_GetSystemMetrics(void);
|
extern void func_GetSystemMetrics(void);
|
||||||
extern void func_GetUserObjectInformation(void);
|
extern void func_GetUserObjectInformation(void);
|
||||||
extern void func_GetWindowPlacement(void);
|
extern void func_GetWindowPlacement(void);
|
||||||
|
@ -77,6 +78,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "GetKeyState", func_GetKeyState },
|
{ "GetKeyState", func_GetKeyState },
|
||||||
{ "GetMessageTime", func_GetMessageTime },
|
{ "GetMessageTime", func_GetMessageTime },
|
||||||
{ "GetPeekMessage", func_GetPeekMessage },
|
{ "GetPeekMessage", func_GetPeekMessage },
|
||||||
|
{ "GetSetWindowInt", func_GetSetWindowInt },
|
||||||
{ "GetSystemMetrics", func_GetSystemMetrics },
|
{ "GetSystemMetrics", func_GetSystemMetrics },
|
||||||
{ "GetUserObjectInformation", func_GetUserObjectInformation },
|
{ "GetUserObjectInformation", func_GetUserObjectInformation },
|
||||||
{ "GetWindowPlacement", func_GetWindowPlacement },
|
{ "GetWindowPlacement", func_GetWindowPlacement },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue