1*a9675d00STimo Kreuzer /*
2*a9675d00STimo Kreuzer * PROJECT: ReactOS api tests
3*a9675d00STimo Kreuzer * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4*a9675d00STimo Kreuzer * PURPOSE: Tests for GetClassInfo
5*a9675d00STimo Kreuzer * COPYRIGHT: Copyright 2023 Timo Kreuzer <timo.kreuzer@reactos.org>
6*a9675d00STimo Kreuzer */
7*a9675d00STimo Kreuzer
8*a9675d00STimo Kreuzer #include "precomp.h"
9*a9675d00STimo Kreuzer
START_TEST(GetSetWindowInt)10*a9675d00STimo Kreuzer START_TEST(GetSetWindowInt)
11*a9675d00STimo Kreuzer {
12*a9675d00STimo Kreuzer WNDCLASSEXW wcex = { 0 };
13*a9675d00STimo Kreuzer ATOM atom;
14*a9675d00STimo Kreuzer HWND hwnd;
15*a9675d00STimo Kreuzer
16*a9675d00STimo Kreuzer wcex.cbSize = sizeof(WNDCLASSEXW);
17*a9675d00STimo Kreuzer wcex.style = 0x1;
18*a9675d00STimo Kreuzer wcex.lpfnWndProc = DefWindowProcW;
19*a9675d00STimo Kreuzer wcex.cbClsExtra = 1;
20*a9675d00STimo Kreuzer wcex.cbWndExtra = 5;
21*a9675d00STimo Kreuzer wcex.hInstance = GetModuleHandle(NULL);
22*a9675d00STimo Kreuzer wcex.lpszClassName = L"ProTestClass1";
23*a9675d00STimo Kreuzer
24*a9675d00STimo Kreuzer atom = RegisterClassExW(&wcex);
25*a9675d00STimo Kreuzer ok(atom != 0, "Failed to register class!\n");
26*a9675d00STimo Kreuzer
27*a9675d00STimo Kreuzer hwnd = CreateWindowW(wcex.lpszClassName,
28*a9675d00STimo Kreuzer L"WindowTitle",
29*a9675d00STimo Kreuzer WS_POPUP,
30*a9675d00STimo Kreuzer CW_USEDEFAULT,
31*a9675d00STimo Kreuzer CW_USEDEFAULT,
32*a9675d00STimo Kreuzer CW_USEDEFAULT,
33*a9675d00STimo Kreuzer CW_USEDEFAULT,
34*a9675d00STimo Kreuzer NULL,
35*a9675d00STimo Kreuzer NULL,
36*a9675d00STimo Kreuzer GetModuleHandle(NULL),
37*a9675d00STimo Kreuzer NULL);
38*a9675d00STimo Kreuzer ok(hwnd != 0, "\n");
39*a9675d00STimo Kreuzer
40*a9675d00STimo Kreuzer SetLastError(0xdeadbeef);
41*a9675d00STimo Kreuzer ok_hex(SetWindowWord(hwnd, 0, 0x1234), 0);
42*a9675d00STimo Kreuzer ok_hex(GetWindowWord(hwnd, 0), 0x1234);
43*a9675d00STimo Kreuzer ok_hex(SetWindowWord(hwnd, 1, 0x2345), 0x12);
44*a9675d00STimo Kreuzer ok_hex(GetWindowWord(hwnd, 1), 0x2345);
45*a9675d00STimo Kreuzer ok_hex(SetWindowWord(hwnd, 2, 0x3456), 0x23);
46*a9675d00STimo Kreuzer ok_hex(GetWindowWord(hwnd, 2), 0x3456);
47*a9675d00STimo Kreuzer ok_hex(SetWindowWord(hwnd, 3, 0x4567), 0x34);
48*a9675d00STimo Kreuzer ok_hex(GetWindowWord(hwnd, 3), 0x4567);
49*a9675d00STimo Kreuzer ok_err(0xdeadbeef);
50*a9675d00STimo Kreuzer ok_hex(SetWindowWord(hwnd, 4, 0x5678), 0);
51*a9675d00STimo Kreuzer ok_err(ERROR_INVALID_INDEX);
52*a9675d00STimo Kreuzer SetLastError(0xdeadbeef);
53*a9675d00STimo Kreuzer ok_hex(GetWindowWord(hwnd, 4), 0);
54*a9675d00STimo Kreuzer ok_err(ERROR_INVALID_INDEX);
55*a9675d00STimo Kreuzer
56*a9675d00STimo Kreuzer SetLastError(0xdeadbeef);
57*a9675d00STimo Kreuzer ok_hex(SetWindowLong(hwnd, 0, 0x12345678), 0x67564534);
58*a9675d00STimo Kreuzer ok_hex(GetWindowLong(hwnd, 0), 0x12345678);
59*a9675d00STimo Kreuzer ok_hex(SetWindowLong(hwnd, 1, 0x23456789), 0x45123456);
60*a9675d00STimo Kreuzer ok_hex(GetWindowLong(hwnd, 1), 0x23456789);
61*a9675d00STimo Kreuzer ok_err(0xdeadbeef);
62*a9675d00STimo Kreuzer ok_hex(SetWindowLong(hwnd, 2, 0x3456789a), 0);
63*a9675d00STimo Kreuzer ok_err(ERROR_INVALID_INDEX);
64*a9675d00STimo Kreuzer SetLastError(0xdeadbeef);
65*a9675d00STimo Kreuzer ok_hex(GetWindowLong(hwnd, 2), 0);
66*a9675d00STimo Kreuzer ok_err(ERROR_INVALID_INDEX);
67*a9675d00STimo Kreuzer
68*a9675d00STimo Kreuzer #ifdef _WIN64
69*a9675d00STimo Kreuzer SetLastError(0xdeadbeef);
70*a9675d00STimo Kreuzer ok_hex(SetWindowLongPtr(hwnd, 0, 123), 0);
71*a9675d00STimo Kreuzer ok_err(ERROR_INVALID_INDEX);
72*a9675d00STimo Kreuzer SetLastError(0xdeadbeef);
73*a9675d00STimo Kreuzer ok_hex(GetWindowLongPtr(hwnd, 0), 0);
74*a9675d00STimo Kreuzer ok_err(ERROR_INVALID_INDEX);
75*a9675d00STimo Kreuzer #endif
76*a9675d00STimo Kreuzer
77*a9675d00STimo Kreuzer }
78