[PATCH 1/6] user32/tests: Use AdjustWindowRectEx to calculate minTrack and maxPosition.
Florian Köberle
florian at fkoeberle.de
Sat Jan 24 11:06:37 CST 2009
---
dlls/user32/tests/win.c | 58 +++++++++++++++++-----------------------------
1 files changed, 22 insertions(+), 36 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index c49b65f..9710999 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -5224,31 +5224,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;
@@ -5284,6 +5259,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);
@@ -5291,8 +5273,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;
@@ -5320,11 +5302,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;
@@ -5336,8 +5313,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
@@ -5357,6 +5334,7 @@ static void test_thick_child_size(HWND parentWindow)
{
BOOL success;
RECT childRect;
+ RECT adjustedParentRect;
HWND childWindow;
LONG childWidth;
LONG childHeight;
@@ -5365,6 +5343,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,
@@ -5453,6 +5432,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);
@@ -5460,8 +5446,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)))
--
1.5.4.3
More information about the wine-patches
mailing list