mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 04:37:15 +00:00
parent
203a6babdf
commit
bef841c3ee
4 changed files with 108 additions and 0 deletions
|
@ -8,6 +8,7 @@ list(APPEND SOURCE
|
||||||
CreateWindowEx.c
|
CreateWindowEx.c
|
||||||
DeferWindowPos.c
|
DeferWindowPos.c
|
||||||
DestroyCursorIcon.c
|
DestroyCursorIcon.c
|
||||||
|
DM_REPOSITION.c
|
||||||
DrawIconEx.c
|
DrawIconEx.c
|
||||||
desktop.c
|
desktop.c
|
||||||
EmptyClipboard.c
|
EmptyClipboard.c
|
||||||
|
|
98
modules/rostests/apitests/user32/DM_REPOSITION.c
Normal file
98
modules/rostests/apitests/user32/DM_REPOSITION.c
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* PROJECT: ReactOS API tests
|
||||||
|
* LICENSE: LGPL-2.1+ (https://spdx.org/licenses/LGPL-2.1+)
|
||||||
|
* PURPOSE: Test for DM_REPOSITION
|
||||||
|
* COPYRIGHT: Copyright 2019 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precomp.h"
|
||||||
|
#include <windowsx.h>
|
||||||
|
|
||||||
|
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
|
||||||
|
{
|
||||||
|
RECT rc, rcWork;
|
||||||
|
INT cx, cy;
|
||||||
|
HMONITOR hMon;
|
||||||
|
MONITORINFO mi = { sizeof(mi) };
|
||||||
|
|
||||||
|
/* get monitor info */
|
||||||
|
hMon = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
|
||||||
|
ok(hMon != NULL, "hMon is NULL\n");
|
||||||
|
ok_int(GetMonitorInfoW(hMon, &mi), TRUE);
|
||||||
|
rcWork = mi.rcWork;
|
||||||
|
|
||||||
|
/* get size */
|
||||||
|
GetWindowRect(hwnd, &rc);
|
||||||
|
cx = rc.right - rc.left;
|
||||||
|
cy = rc.bottom - rc.top;
|
||||||
|
|
||||||
|
/* move */
|
||||||
|
ok_int(SetWindowPos(hwnd, NULL, rcWork.left - 80, rcWork.top - 80, 0, 0,
|
||||||
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER |
|
||||||
|
SWP_NOZORDER), TRUE);
|
||||||
|
ok_int(GetWindowRect(hwnd, &rc), TRUE);
|
||||||
|
ok_long(rc.left, rcWork.left - 80);
|
||||||
|
ok_long(rc.top, rcWork.top - 80);
|
||||||
|
ok_long(rc.right, rc.left + cx);
|
||||||
|
ok_long(rc.bottom, rc.top + cy);
|
||||||
|
|
||||||
|
/* reposition */
|
||||||
|
ok_int(SendMessageW(hwnd, DM_REPOSITION, 0, 0), 0);
|
||||||
|
ok_int(GetWindowRect(hwnd, &rc), TRUE);
|
||||||
|
ok_long(rc.left, rcWork.left);
|
||||||
|
ok_long(rc.top, rcWork.top);
|
||||||
|
ok_long(rc.right, rc.left + cx);
|
||||||
|
ok_long(rc.bottom, rc.top + cy);
|
||||||
|
|
||||||
|
/* move */
|
||||||
|
ok_int(SetWindowPos(hwnd, NULL,
|
||||||
|
rcWork.right - cx + 80, rcWork.bottom - cy + 80, 0, 0,
|
||||||
|
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOOWNERZORDER |
|
||||||
|
SWP_NOZORDER), TRUE);
|
||||||
|
ok_int(GetWindowRect(hwnd, &rc), TRUE);
|
||||||
|
ok_long(rc.left, rcWork.right - cx + 80);
|
||||||
|
ok_long(rc.top, rcWork.bottom - cy + 80);
|
||||||
|
ok_long(rc.right, rc.left + cx);
|
||||||
|
ok_long(rc.bottom, rc.top + cy);
|
||||||
|
|
||||||
|
/* reposition */
|
||||||
|
ok_int(SendMessageW(hwnd, DM_REPOSITION, 0, 0), 0);
|
||||||
|
ok_int(GetWindowRect(hwnd, &rc), TRUE);
|
||||||
|
ok_long(rc.left, rcWork.right - cx);
|
||||||
|
ok_long(rc.top, rcWork.bottom - cy - 4);
|
||||||
|
ok_long(rc.right, rc.left + cx);
|
||||||
|
ok_long(rc.bottom, rc.top + cy);
|
||||||
|
|
||||||
|
/* quit */
|
||||||
|
PostMessage(hwnd, WM_COMMAND, IDOK, 0);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
|
||||||
|
{
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case IDOK:
|
||||||
|
case IDCANCEL:
|
||||||
|
EndDialog(hwnd, id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static INT_PTR CALLBACK
|
||||||
|
DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
|
{
|
||||||
|
switch (uMsg)
|
||||||
|
{
|
||||||
|
HANDLE_MSG(hwnd, WM_INITDIALOG, OnInitDialog);
|
||||||
|
HANDLE_MSG(hwnd, WM_COMMAND, OnCommand);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(DM_REPOSITION)
|
||||||
|
{
|
||||||
|
HMODULE hMod = GetModuleHandle(NULL);
|
||||||
|
ok(hMod != NULL, "\n");
|
||||||
|
DialogBox(hMod, TEXT("REPOSITION"), NULL, DialogProc);
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ extern void func_CreateIconFromResourceEx(void);
|
||||||
extern void func_CreateWindowEx(void);
|
extern void func_CreateWindowEx(void);
|
||||||
extern void func_DeferWindowPos(void);
|
extern void func_DeferWindowPos(void);
|
||||||
extern void func_DestroyCursorIcon(void);
|
extern void func_DestroyCursorIcon(void);
|
||||||
|
extern void func_DM_REPOSITION(void);
|
||||||
extern void func_DrawIconEx(void);
|
extern void func_DrawIconEx(void);
|
||||||
extern void func_desktop(void);
|
extern void func_desktop(void);
|
||||||
extern void func_EmptyClipboard(void);
|
extern void func_EmptyClipboard(void);
|
||||||
|
@ -57,6 +58,7 @@ const struct test winetest_testlist[] =
|
||||||
{ "CreateWindowEx", func_CreateWindowEx },
|
{ "CreateWindowEx", func_CreateWindowEx },
|
||||||
{ "DeferWindowPos", func_DeferWindowPos },
|
{ "DeferWindowPos", func_DeferWindowPos },
|
||||||
{ "DestroyCursorIcon", func_DestroyCursorIcon },
|
{ "DestroyCursorIcon", func_DestroyCursorIcon },
|
||||||
|
{ "DM_REPOSITION", func_DM_REPOSITION },
|
||||||
{ "DrawIconEx", func_DrawIconEx },
|
{ "DrawIconEx", func_DrawIconEx },
|
||||||
{ "desktop", func_desktop },
|
{ "desktop", func_desktop },
|
||||||
{ "EmptyClipboard", func_EmptyClipboard },
|
{ "EmptyClipboard", func_EmptyClipboard },
|
||||||
|
|
|
@ -31,3 +31,10 @@ FONT 8, "MS Shell Dlg"
|
||||||
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 65, 98, 60, 14
|
CONTROL "OK", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 65, 98, 60, 14
|
||||||
CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 187, 100, 60, 14
|
CONTROL "Cancel", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 187, 100, 60, 14
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REPOSITION DIALOG 0, 0, 200, 150
|
||||||
|
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||||
|
CAPTION "DM_REPOSITION"
|
||||||
|
FONT 8, "MS Shell Dlg"
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue