mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
[USER32_APITEST]
- Add a test for GetWindowPlacement CORE-9578 svn path=/trunk/; revision=67330
This commit is contained in:
parent
5f0ebedf29
commit
ea06801805
3 changed files with 120 additions and 0 deletions
|
@ -15,6 +15,7 @@ list(APPEND SOURCE
|
||||||
GetPeekMessage.c
|
GetPeekMessage.c
|
||||||
GetSystemMetrics.c
|
GetSystemMetrics.c
|
||||||
GetUserObjectInformation.c
|
GetUserObjectInformation.c
|
||||||
|
GetWindowPlacement.c
|
||||||
InitializeLpkHooks.c
|
InitializeLpkHooks.c
|
||||||
LoadImage.c
|
LoadImage.c
|
||||||
LookupIconIdFromDirectoryEx.c
|
LookupIconIdFromDirectoryEx.c
|
||||||
|
|
117
rostests/apitests/user32/GetWindowPlacement.c
Normal file
117
rostests/apitests/user32/GetWindowPlacement.c
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS API tests
|
||||||
|
* LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
|
||||||
|
* PURPOSE: Test for GetWindowPlacement
|
||||||
|
* PROGRAMMERS: Thomas Faber <thomas.faber@reactos.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <apitest.h>
|
||||||
|
#include <winuser.h>
|
||||||
|
|
||||||
|
#define ALIGN_DOWN_BY(size, align) \
|
||||||
|
((ULONG_PTR)(size) & ~((ULONG_PTR)(align) - 1))
|
||||||
|
|
||||||
|
#define ALIGN_UP_BY(size, align) \
|
||||||
|
(ALIGN_DOWN_BY(((ULONG_PTR)(size) + align - 1), align))
|
||||||
|
|
||||||
|
START_TEST(GetWindowPlacement)
|
||||||
|
{
|
||||||
|
BYTE buffer[sizeof(WINDOWPLACEMENT) + 16];
|
||||||
|
PWINDOWPLACEMENT wp = (PVOID)buffer;
|
||||||
|
DWORD error;
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(NULL, NULL);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == FALSE, "ret = %d\n", ret);
|
||||||
|
ok(error == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", error);
|
||||||
|
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), NULL);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == FALSE, "ret = %d\n", ret);
|
||||||
|
ok(error == ERROR_NOACCESS, "error = %lu\n", error);
|
||||||
|
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), (PVOID)(UINT_PTR)-4);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == FALSE, "ret = %d\n", ret);
|
||||||
|
ok(error == ERROR_NOACCESS, "error = %lu\n", error);
|
||||||
|
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), (PVOID)(ALIGN_UP_BY(buffer, 16) + 1));
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ok(error == 0xfeedfab1, "error = %lu\n", error);
|
||||||
|
|
||||||
|
FillMemory(wp, sizeof(*wp), 0x55);
|
||||||
|
wp->length = 0;
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(NULL, wp);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == FALSE, "ret = %d\n", ret);
|
||||||
|
ok(error == ERROR_INVALID_WINDOW_HANDLE, "error = %lu\n", error);
|
||||||
|
ok(wp->length == 0, "wp.length = %u\n", wp->length);
|
||||||
|
|
||||||
|
FillMemory(wp, sizeof(*wp), 0x55);
|
||||||
|
wp->length = 0;
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), wp);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ok(error == 0xfeedfab1, "error = %lu\n", error);
|
||||||
|
ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
|
||||||
|
ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
|
||||||
|
|
||||||
|
FillMemory(wp, sizeof(*wp), 0x55);
|
||||||
|
wp->length = 1;
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), wp);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ok(error == 0xfeedfab1, "error = %lu\n", error);
|
||||||
|
ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
|
||||||
|
ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
|
||||||
|
|
||||||
|
FillMemory(wp, sizeof(*wp), 0x55);
|
||||||
|
wp->length = sizeof(*wp) - 1;
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), wp);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ok(error == 0xfeedfab1, "error = %lu\n", error);
|
||||||
|
ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
|
||||||
|
ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
|
||||||
|
|
||||||
|
FillMemory(wp, sizeof(*wp), 0x55);
|
||||||
|
wp->length = sizeof(*wp) + 1;
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), wp);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ok(error == 0xfeedfab1, "error = %lu\n", error);
|
||||||
|
ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
|
||||||
|
ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
|
||||||
|
|
||||||
|
FillMemory(wp, sizeof(*wp), 0x55);
|
||||||
|
wp->length = sizeof(*wp);
|
||||||
|
SetLastError(0xfeedfab1);
|
||||||
|
ret = GetWindowPlacement(GetDesktopWindow(), wp);
|
||||||
|
error = GetLastError();
|
||||||
|
ok(ret == TRUE, "ret = %d\n", ret);
|
||||||
|
ok(error == 0xfeedfab1, "error = %lu\n", error);
|
||||||
|
ok(wp->length == sizeof(*wp), "wp.length = %u\n", wp->length);
|
||||||
|
ok(wp->flags == 0, "wp.flags = %x\n", wp->flags);
|
||||||
|
ok(wp->showCmd == SW_SHOWNORMAL, "wp.showCmd = %u\n", wp->showCmd);
|
||||||
|
ok(wp->ptMinPosition.x == (UINT)-1, "wp.ptMinPosition.x = %u\n", wp->ptMinPosition.x);
|
||||||
|
ok(wp->ptMinPosition.y == (UINT)-1, "wp.ptMinPosition.x = %u\n", wp->ptMinPosition.y);
|
||||||
|
ok(wp->ptMaxPosition.x == (UINT)-1, "wp.ptMaxPosition.x = %u\n", wp->ptMaxPosition.x);
|
||||||
|
ok(wp->ptMaxPosition.y == (UINT)-1, "wp.ptMaxPosition.y = %u\n", wp->ptMaxPosition.y);
|
||||||
|
ok(wp->rcNormalPosition.left == 0, "wp.rcNormalPosition.left = %u\n", wp->rcNormalPosition.left);
|
||||||
|
ok(wp->rcNormalPosition.top == 0, "wp.rcNormalPosition.top = %u\n", wp->rcNormalPosition.top);
|
||||||
|
ok(wp->rcNormalPosition.right != 0 &&
|
||||||
|
wp->rcNormalPosition.right != 0x55555555, "wp.rcNormalPosition.right = %u\n", wp->rcNormalPosition.right);
|
||||||
|
ok(wp->rcNormalPosition.bottom != 0 &&
|
||||||
|
wp->rcNormalPosition.bottom != 0x55555555, "wp.rcNormalPosition.bottom = %u\n", wp->rcNormalPosition.bottom);
|
||||||
|
}
|
|
@ -17,6 +17,7 @@ extern void func_GetKeyState(void);
|
||||||
extern void func_GetPeekMessage(void);
|
extern void func_GetPeekMessage(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_InitializeLpkHooks(void);
|
extern void func_InitializeLpkHooks(void);
|
||||||
extern void func_LoadImage(void);
|
extern void func_LoadImage(void);
|
||||||
extern void func_LookupIconIdFromDirectoryEx(void);
|
extern void func_LookupIconIdFromDirectoryEx(void);
|
||||||
|
@ -49,6 +50,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "GetPeekMessage", func_GetPeekMessage },
|
{ "GetPeekMessage", func_GetPeekMessage },
|
||||||
{ "GetSystemMetrics", func_GetSystemMetrics },
|
{ "GetSystemMetrics", func_GetSystemMetrics },
|
||||||
{ "GetUserObjectInformation", func_GetUserObjectInformation },
|
{ "GetUserObjectInformation", func_GetUserObjectInformation },
|
||||||
|
{ "GetWindowPlacement", func_GetWindowPlacement },
|
||||||
{ "InitializeLpkHooks", func_InitializeLpkHooks },
|
{ "InitializeLpkHooks", func_InitializeLpkHooks },
|
||||||
{ "LoadImage", func_LoadImage },
|
{ "LoadImage", func_LoadImage },
|
||||||
{ "LookupIconIdFromDirectoryEx", func_LookupIconIdFromDirectoryEx },
|
{ "LookupIconIdFromDirectoryEx", func_LookupIconIdFromDirectoryEx },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue