user32/tests: Use AdjustWindowRectEx to calculate minTrack and maxPosition.

This commit is contained in:
Florian Köberle 2009-01-24 18:06:37 +01:00 committed by Alexandre Julliard
parent 5ea119a3d0
commit dc1a7113b5
1 changed files with 22 additions and 36 deletions

View File

@ -5228,31 +5228,6 @@ static void test_fullscreen(void)
}
static BOOL test_thick_child_got_minmax;
static int getExpectedBorderSize(LONG style, LONG exStyle)
{
int border;
if ((exStyle & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) ==
WS_EX_STATICEDGE)
{
border = 1; /* for the outer frame always present */
}
else
{
border = 0;
if ((exStyle & WS_EX_DLGMODALFRAME) ||
(style & (WS_THICKFRAME|WS_DLGFRAME))) border = 2; /* outer */
}
if (style & WS_THICKFRAME)
border += ( GetSystemMetrics (SM_CXFRAME)
- GetSystemMetrics (SM_CXDLGFRAME)); /* The resize border */
if ((style & (WS_BORDER|WS_DLGFRAME)) ||
(exStyle & WS_EX_DLGMODALFRAME))
border++; /* The other border */
return border;
}
static const char * test_thick_child_name;
static LONG test_thick_child_style;
static LONG test_thick_child_exStyle;
@ -5288,6 +5263,13 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
test_thick_child_got_minmax = TRUE;
adjustedStyle = test_thick_child_style;
if ((adjustedStyle & WS_CAPTION) == WS_CAPTION)
adjustedStyle &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
GetClientRect(GetParent(hwnd), &rect);
AdjustWindowRectEx(&rect, adjustedStyle, FALSE, test_thick_child_exStyle);
if (test_thick_child_style & (WS_DLGFRAME | WS_BORDER))
{
expectedMinTrackX = GetSystemMetrics(SM_CXMINTRACK);
@ -5295,8 +5277,8 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
}
else
{
expectedMinTrackX = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle);
expectedMinTrackY = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle);
expectedMinTrackX = -2 * rect.left;
expectedMinTrackY = -2 * rect.top;
}
actualMinTrackX = minmax->ptMinTrackSize.x;
actualMinTrackY = minmax->ptMinTrackSize.y;
@ -5324,11 +5306,6 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
expectedMaxTrackX, expectedMaxTrackY, actualMaxTrackX, actualMaxTrackY,
test_thick_child_name);
adjustedStyle = test_thick_child_style;
if ((adjustedStyle & WS_CAPTION) == WS_CAPTION)
adjustedStyle &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
GetClientRect(GetParent(hwnd), &rect);
AdjustWindowRectEx(&rect, adjustedStyle, FALSE, test_thick_child_exStyle);
expectedMaxSizeX = rect.right - rect.left;
expectedMaxSizeY = rect.bottom - rect.top;
actualMaxSizeX = minmax->ptMaxSize.x;
@ -5340,8 +5317,8 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
test_thick_child_name);
expectedPosX = - getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle);
expectedPosY = expectedPosX;
expectedPosX = rect.left;
expectedPosY = rect.top;
actualPosX = minmax->ptMaxPosition.x;
actualPosY = minmax->ptMaxPosition.y;
todo_wine
@ -5361,6 +5338,7 @@ static void test_thick_child_size(HWND parentWindow)
{
BOOL success;
RECT childRect;
RECT adjustedParentRect;
HWND childWindow;
LONG childWidth;
LONG childHeight;
@ -5369,6 +5347,7 @@ static void test_thick_child_size(HWND parentWindow)
WNDCLASSA cls;
LPCTSTR className = "THICK_CHILD_CLASS";
int i;
LONG adjustedStyle;
static const LONG styles[NUMBER_OF_THICK_CHILD_TESTS] = {
WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME,
@ -5457,6 +5436,13 @@ static void test_thick_child_size(HWND parentWindow)
childWidth = childRect.right - childRect.left;
childHeight = childRect.bottom - childRect.top;
adjustedStyle = styles[i];
if ((adjustedStyle & WS_CAPTION) == WS_CAPTION)
adjustedStyle &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
GetClientRect(GetParent(childWindow), &adjustedParentRect);
AdjustWindowRectEx(&adjustedParentRect, adjustedStyle, FALSE, test_thick_child_exStyle);
if (test_thick_child_style & (WS_DLGFRAME | WS_BORDER))
{
expectedWidth = GetSystemMetrics(SM_CXMINTRACK);
@ -5464,8 +5450,8 @@ static void test_thick_child_size(HWND parentWindow)
}
else
{
expectedWidth = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle);
expectedHeight = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle);
expectedWidth = -2 * adjustedParentRect.left;
expectedHeight = -2 * adjustedParentRect.top;
}
if (!(test_thick_child_style & (WS_DLGFRAME | WS_BORDER)))