Commit dc1a7113 authored by Florian Köberle's avatar Florian Köberle Committed by Alexandre Julliard

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

parent 5ea119a3
...@@ -5228,31 +5228,6 @@ static void test_fullscreen(void) ...@@ -5228,31 +5228,6 @@ static void test_fullscreen(void)
} }
static BOOL test_thick_child_got_minmax; 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 const char * test_thick_child_name;
static LONG test_thick_child_style; static LONG test_thick_child_style;
static LONG test_thick_child_exStyle; static LONG test_thick_child_exStyle;
...@@ -5288,6 +5263,13 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM ...@@ -5288,6 +5263,13 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
test_thick_child_got_minmax = TRUE; 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)) if (test_thick_child_style & (WS_DLGFRAME | WS_BORDER))
{ {
expectedMinTrackX = GetSystemMetrics(SM_CXMINTRACK); expectedMinTrackX = GetSystemMetrics(SM_CXMINTRACK);
...@@ -5295,8 +5277,8 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM ...@@ -5295,8 +5277,8 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
} }
else else
{ {
expectedMinTrackX = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle); expectedMinTrackX = -2 * rect.left;
expectedMinTrackY = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle); expectedMinTrackY = -2 * rect.top;
} }
actualMinTrackX = minmax->ptMinTrackSize.x; actualMinTrackX = minmax->ptMinTrackSize.x;
actualMinTrackY = minmax->ptMinTrackSize.y; actualMinTrackY = minmax->ptMinTrackSize.y;
...@@ -5324,11 +5306,6 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM ...@@ -5324,11 +5306,6 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
expectedMaxTrackX, expectedMaxTrackY, actualMaxTrackX, actualMaxTrackY, expectedMaxTrackX, expectedMaxTrackY, actualMaxTrackX, actualMaxTrackY,
test_thick_child_name); 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; expectedMaxSizeX = rect.right - rect.left;
expectedMaxSizeY = rect.bottom - rect.top; expectedMaxSizeY = rect.bottom - rect.top;
actualMaxSizeX = minmax->ptMaxSize.x; actualMaxSizeX = minmax->ptMaxSize.x;
...@@ -5340,8 +5317,8 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM ...@@ -5340,8 +5317,8 @@ static LRESULT WINAPI test_thick_child_size_winproc(HWND hwnd, UINT msg, WPARAM
test_thick_child_name); test_thick_child_name);
expectedPosX = - getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle); expectedPosX = rect.left;
expectedPosY = expectedPosX; expectedPosY = rect.top;
actualPosX = minmax->ptMaxPosition.x; actualPosX = minmax->ptMaxPosition.x;
actualPosY = minmax->ptMaxPosition.y; actualPosY = minmax->ptMaxPosition.y;
todo_wine todo_wine
...@@ -5361,6 +5338,7 @@ static void test_thick_child_size(HWND parentWindow) ...@@ -5361,6 +5338,7 @@ static void test_thick_child_size(HWND parentWindow)
{ {
BOOL success; BOOL success;
RECT childRect; RECT childRect;
RECT adjustedParentRect;
HWND childWindow; HWND childWindow;
LONG childWidth; LONG childWidth;
LONG childHeight; LONG childHeight;
...@@ -5369,6 +5347,7 @@ static void test_thick_child_size(HWND parentWindow) ...@@ -5369,6 +5347,7 @@ static void test_thick_child_size(HWND parentWindow)
WNDCLASSA cls; WNDCLASSA cls;
LPCTSTR className = "THICK_CHILD_CLASS"; LPCTSTR className = "THICK_CHILD_CLASS";
int i; int i;
LONG adjustedStyle;
static const LONG styles[NUMBER_OF_THICK_CHILD_TESTS] = { static const LONG styles[NUMBER_OF_THICK_CHILD_TESTS] = {
WS_CHILD | WS_VISIBLE | WS_THICKFRAME, WS_CHILD | WS_VISIBLE | WS_THICKFRAME,
WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME, WS_CHILD | WS_VISIBLE | WS_THICKFRAME | WS_DLGFRAME,
...@@ -5457,6 +5436,13 @@ static void test_thick_child_size(HWND parentWindow) ...@@ -5457,6 +5436,13 @@ static void test_thick_child_size(HWND parentWindow)
childWidth = childRect.right - childRect.left; childWidth = childRect.right - childRect.left;
childHeight = childRect.bottom - childRect.top; 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)) if (test_thick_child_style & (WS_DLGFRAME | WS_BORDER))
{ {
expectedWidth = GetSystemMetrics(SM_CXMINTRACK); expectedWidth = GetSystemMetrics(SM_CXMINTRACK);
...@@ -5464,8 +5450,8 @@ static void test_thick_child_size(HWND parentWindow) ...@@ -5464,8 +5450,8 @@ static void test_thick_child_size(HWND parentWindow)
} }
else else
{ {
expectedWidth = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle); expectedWidth = -2 * adjustedParentRect.left;
expectedHeight = 2 * getExpectedBorderSize(test_thick_child_style, test_thick_child_exStyle); expectedHeight = -2 * adjustedParentRect.top;
} }
if (!(test_thick_child_style & (WS_DLGFRAME | WS_BORDER))) if (!(test_thick_child_style & (WS_DLGFRAME | WS_BORDER)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment