1 /*
2  * PROJECT:     ReactOS API tests
3  * LICENSE:     LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
4  * PURPOSE:     Tests for Get/SetWindowPlacement
5  * COPYRIGHT:   Copyright 2024 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
6  */
7 
8 #include "precomp.h"
9 
10 START_TEST(SetWindowPlacement)
11 {
12     HWND hwnd;
13     WINDOWPLACEMENT wndpl;
14     BOOL ret;
15 
16     hwnd = CreateWindowW(L"BUTTON", L"Button", WS_POPUPWINDOW, 0, 0, 100, 100,
17                          NULL, NULL, GetModuleHandleW(NULL), NULL);
18 
19     SetLastError(0xDEADFACE);
20     wndpl.length = 0xFFFF;
21     ret = GetWindowPlacement(hwnd, &wndpl);
22     ok_int(ret, TRUE);
23     ok_err(0xDEADFACE);
24 
25     SetLastError(0xDEADFACE);
26     wndpl.length = sizeof(wndpl);
27     ret = GetWindowPlacement(hwnd, &wndpl);
28     ok_int(ret, TRUE);
29     ok_err(0xDEADFACE);
30 
31     SetLastError(0xDEADFACE);
32     wndpl.length = 0xFFFF;
33     ret = SetWindowPlacement(hwnd, &wndpl);
34     ok_int(ret, FALSE);
35     ok_err(ERROR_INVALID_PARAMETER);
36 
37     SetLastError(0xDEADFACE);
38     wndpl.length = sizeof(wndpl);
39     ret = SetWindowPlacement(hwnd, &wndpl);
40     ok_int(ret, TRUE);
41     ok_err(ERROR_SUCCESS);
42 
43     DestroyWindow(hwnd);
44 }
45