1
0
Fork 0
mirror of https://github.com/reactos/reactos.git synced 2025-06-16 21:58:31 +00:00

[USER32_WINETEST] Sync with Wine Staging 1.9.14.

svn path=/trunk/; revision=71963
This commit is contained in:
Amine Khaldi 2016-07-18 15:48:27 +00:00
parent 098b000c86
commit 2e9c3e57e4
12 changed files with 1180 additions and 472 deletions

View file

@ -1192,6 +1192,8 @@ static void create_ico_file(const char *filename, const test_icon_entries_t *tes
ret = WriteFile(file, buf, icon_size, &bytes_written, NULL); ret = WriteFile(file, buf, icon_size, &bytes_written, NULL);
ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n"); ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n");
CloseHandle(file); CloseHandle(file);
HeapFree(GetProcessHeap(), 0, buf);
} }
static void test_LoadImage(void) static void test_LoadImage(void)

View file

@ -201,7 +201,7 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
ReleaseDC( hwnd_cache, hdc ); ReleaseDC( hwnd_cache, hdc );
ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" ); ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" );
@ -215,7 +215,7 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
ReleaseDC( hwnd_cache, hdc ); ReleaseDC( hwnd_cache, hdc );
ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" ); ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" );
@ -223,7 +223,7 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20), ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
"clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box should have been reset %s\n", wine_dbgstr_rect( &rect ));
ReleaseDC( hwnd_cache, hdc ); ReleaseDC( hwnd_cache, hdc );
/* window DC */ /* window DC */
@ -235,19 +235,19 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
ReleaseDC( hwnd_owndc, hdc ); ReleaseDC( hwnd_owndc, hdc );
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
hdc = GetDCEx( hwnd_owndc, 0, DCX_USESTYLE ); hdc = GetDCEx( hwnd_owndc, 0, DCX_USESTYLE );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
ReleaseDC( hwnd_owndc, hdc ); ReleaseDC( hwnd_owndc, hdc );
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
@ -260,7 +260,7 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30, ok( rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
ReleaseDC( hwnd_owndc, hdc ); ReleaseDC( hwnd_owndc, hdc );
ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
@ -269,7 +269,7 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30), ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30),
"clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box should have been reset %s\n", wine_dbgstr_rect( &rect ));
ReleaseDC( hwnd_owndc, hdc ); ReleaseDC( hwnd_owndc, hdc );
/* class DC */ /* class DC */
@ -281,20 +281,20 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
ReleaseDC( hwnd_classdc, hdc ); ReleaseDC( hwnd_classdc, hdc );
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
hdc = GetDCEx( hwnd_classdc, 0, DCX_USESTYLE ); hdc = GetDCEx( hwnd_classdc, 0, DCX_USESTYLE );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
ReleaseDC( hwnd_classdc, hdc ); ReleaseDC( hwnd_classdc, hdc );
ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" );
@ -307,7 +307,7 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30, ok( rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
old_hdc = hdc; old_hdc = hdc;
@ -317,13 +317,13 @@ static void test_dc_visrgn(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30), ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30),
"clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box should have been reset %s\n", wine_dbgstr_rect( &rect ));
ReleaseDC( hwnd_classdc2, hdc ); ReleaseDC( hwnd_classdc2, hdc );
ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
hdc = GetDCEx( hwnd_classdc2, 0, DCX_EXCLUDERGN | DCX_USESTYLE ); hdc = GetDCEx( hwnd_classdc2, 0, DCX_EXCLUDERGN | DCX_USESTYLE );
ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" );
ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30), ok( !(rect.left >= 20 && rect.top >= 20 && rect.right <= 30 && rect.bottom <= 30),
"clip box must have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box must have been reset %s\n", wine_dbgstr_rect( &rect ));
ReleaseDC( hwnd_classdc2, hdc ); ReleaseDC( hwnd_classdc2, hdc );
/* parent DC */ /* parent DC */
@ -360,7 +360,7 @@ static void test_begin_paint(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
EndPaint( hwnd_cache, &ps ); EndPaint( hwnd_cache, &ps );
/* window DC */ /* window DC */
@ -372,22 +372,22 @@ static void test_begin_paint(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ReleaseDC( hwnd_owndc, hdc ); ReleaseDC( hwnd_owndc, hdc );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
ok( GetDC( hwnd_owndc ) == hdc, "got different hdc\n" ); ok( GetDC( hwnd_owndc ) == hdc, "got different hdc\n" );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
EndPaint( hwnd_owndc, &ps ); EndPaint( hwnd_owndc, &ps );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20), ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
"clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box should have been reset %s\n", wine_dbgstr_rect( &rect ));
RedrawWindow( hwnd_owndc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE ); RedrawWindow( hwnd_owndc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
SetRect( &rect, 10, 10, 20, 20 ); SetRect( &rect, 10, 10, 20, 20 );
RedrawWindow( hwnd_owndc, &rect, 0, RDW_INVALIDATE|RDW_ERASE ); RedrawWindow( hwnd_owndc, &rect, 0, RDW_INVALIDATE|RDW_ERASE );
@ -395,12 +395,12 @@ static void test_begin_paint(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20), ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
"clip box should be the whole window %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box should be the whole window %s\n", wine_dbgstr_rect( &rect ));
RedrawWindow( hwnd_owndc, NULL, 0, RDW_ERASENOW ); RedrawWindow( hwnd_owndc, NULL, 0, RDW_ERASENOW );
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20), ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
"clip box should still be the whole window %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box should still be the whole window %s\n", wine_dbgstr_rect( &rect ));
/* class DC */ /* class DC */
@ -411,7 +411,7 @@ static void test_begin_paint(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20, ok( rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
old_hdc = hdc; old_hdc = hdc;
hdc = GetDC( hwnd_classdc2 ); hdc = GetDC( hwnd_classdc2 );
@ -419,7 +419,7 @@ static void test_begin_paint(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20), ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
"clip box should have been reset %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "clip box should have been reset %s\n", wine_dbgstr_rect( &rect ));
ReleaseDC( hwnd_classdc2, hdc ); ReleaseDC( hwnd_classdc2, hdc );
EndPaint( hwnd_classdc, &ps ); EndPaint( hwnd_classdc, &ps );
@ -459,7 +459,7 @@ static void test_scroll_window(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50, ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
EndPaint( hwnd_owndc, &ps ); EndPaint( hwnd_owndc, &ps );
SetViewportExtEx( hdc, 2, 3, NULL ); SetViewportExtEx( hdc, 2, 3, NULL );
@ -470,7 +470,7 @@ static void test_scroll_window(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50, ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
EndPaint( hwnd_owndc, &ps ); EndPaint( hwnd_owndc, &ps );
ScrollWindowEx( hwnd_owndc, -5, -10, NULL, &clip, 0, NULL, SW_INVALIDATE | SW_ERASE ); ScrollWindowEx( hwnd_owndc, -5, -10, NULL, &clip, 0, NULL, SW_INVALIDATE | SW_ERASE );
@ -478,7 +478,7 @@ static void test_scroll_window(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= -5 && rect.top >= 5 && rect.right <= 20 && rect.bottom <= 30, ok( rect.left >= -5 && rect.top >= 5 && rect.right <= 20 && rect.bottom <= 30,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
EndPaint( hwnd_owndc, &ps ); EndPaint( hwnd_owndc, &ps );
SetViewportExtEx( hdc, 1, 1, NULL ); SetViewportExtEx( hdc, 1, 1, NULL );
@ -489,7 +489,7 @@ static void test_scroll_window(void)
SetRectEmpty( &rect ); SetRectEmpty( &rect );
GetClipBox( hdc, &rect ); GetClipBox( hdc, &rect );
ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50, ok( rect.left >= 25 && rect.top >= 25 && rect.right <= 50 && rect.bottom <= 50,
"invalid clip box %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid clip box %s\n", wine_dbgstr_rect( &rect ));
EndPaint( hwnd_owndc, &ps ); EndPaint( hwnd_owndc, &ps );
} }

View file

@ -1284,8 +1284,7 @@ static void test_edit_control_5(void)
assert(hWnd); assert(hWnd);
GetClientRect( hWnd, &rc); GetClientRect( hWnd, &rc);
ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top, ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
"Client rectangle not the expected size (%d,%d,%d,%d)\n", "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
rc.left, rc.top, rc.right, rc.bottom);
len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0); len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(lstrlenA(str) == len, "text shouldn't have been truncated\n"); ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
DestroyWindow(hWnd); DestroyWindow(hWnd);
@ -1299,8 +1298,7 @@ static void test_edit_control_5(void)
assert(hWnd); assert(hWnd);
GetClientRect( hWnd, &rc); GetClientRect( hWnd, &rc);
ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top, ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top,
"Client rectangle not the expected size (%d,%d,%d,%d)\n", "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc ));
rc.left, rc.top, rc.right, rc.bottom);
len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0); len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(lstrlenA(str) == len, "text shouldn't have been truncated\n"); ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
DestroyWindow(hWnd); DestroyWindow(hWnd);
@ -1502,7 +1500,7 @@ static void test_margins(void)
hwEdit = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL); hwEdit = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
ok(hwEdit != NULL, "got %p\n", hwEdit); ok(hwEdit != NULL, "got %p\n", hwEdit);
GetClientRect(hwEdit, &old_rect); GetClientRect(hwEdit, &old_rect);
ok(IsRectEmpty(&old_rect), "got rect %d,%d-%d,%d\n", old_rect.left, old_rect.top, old_rect.right, old_rect.bottom); ok(IsRectEmpty(&old_rect), "got rect %s\n", wine_dbgstr_rect(&old_rect));
old_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0); old_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
ok(old_margins == 0, "got %x\n", old_margins); ok(old_margins == 0, "got %x\n", old_margins);
@ -1517,7 +1515,7 @@ static void test_margins(void)
hwEdit = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, 2, 2, NULL, NULL, NULL, NULL); hwEdit = CreateWindowExA(0, "Edit", "A", WS_POPUP, 0, 0, 2, 2, NULL, NULL, NULL, NULL);
ok(hwEdit != NULL, "got %p\n", hwEdit); ok(hwEdit != NULL, "got %p\n", hwEdit);
GetClientRect(hwEdit, &old_rect); GetClientRect(hwEdit, &old_rect);
ok(!IsRectEmpty(&old_rect), "got rect %d,%d-%d,%d\n", old_rect.left, old_rect.top, old_rect.right, old_rect.bottom); ok(!IsRectEmpty(&old_rect), "got rect %s\n", wine_dbgstr_rect(&old_rect));
old_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0); old_margins = SendMessageA(hwEdit, EM_GETMARGINS, 0, 0);
ok(old_margins == 0, "got %x\n", old_margins); ok(old_margins == 0, "got %x\n", old_margins);

View file

@ -251,18 +251,16 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
ok(dis->CtlType == ODT_LISTBOX, "wrong CtlType %04x\n", dis->CtlType); ok(dis->CtlType == ODT_LISTBOX, "wrong CtlType %04x\n", dis->CtlType);
GetClientRect(dis->hwndItem, &rc_client); GetClientRect(dis->hwndItem, &rc_client);
trace("hwndItem %p client rect (%d,%d-%d,%d)\n", dis->hwndItem, trace("hwndItem %p client rect %s\n", dis->hwndItem, wine_dbgstr_rect(&rc_client));
rc_client.left, rc_client.top, rc_client.right, rc_client.bottom);
GetClipBox(dis->hDC, &rc_clip); GetClipBox(dis->hDC, &rc_clip);
trace("clip rect (%d,%d-%d,%d)\n", rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom); trace("clip rect %s\n", wine_dbgstr_rect(&rc_clip));
ok(EqualRect(&rc_client, &rc_clip) || IsRectEmpty(&rc_clip), ok(EqualRect(&rc_client, &rc_clip) || IsRectEmpty(&rc_clip),
"client rect of the listbox should be equal to the clip box," "client rect of the listbox should be equal to the clip box,"
"or the clip box should be empty\n"); "or the clip box should be empty\n");
trace("rcItem (%d,%d-%d,%d)\n", dis->rcItem.left, dis->rcItem.top, trace("rcItem %s\n", wine_dbgstr_rect(&dis->rcItem));
dis->rcItem.right, dis->rcItem.bottom);
SendMessageA(dis->hwndItem, LB_GETITEMRECT, dis->itemID, (LPARAM)&rc_item); SendMessageA(dis->hwndItem, LB_GETITEMRECT, dis->itemID, (LPARAM)&rc_item);
trace("item rect (%d,%d-%d,%d)\n", rc_item.left, rc_item.top, rc_item.right, rc_item.bottom); trace("item rect %s\n", wine_dbgstr_rect(&rc_item));
ok(EqualRect(&dis->rcItem, &rc_item), "item rects are not equal\n"); ok(EqualRect(&dis->rcItem, &rc_item), "item rects are not equal\n");
break; break;
@ -334,7 +332,7 @@ static void test_ownerdraw(void)
ok(ret == 1, "wrong top index %d\n", ret); ok(ret == 1, "wrong top index %d\n", ret);
SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc); SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
trace("item 0 rect (%d,%d-%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); trace("item 0 rect %s\n", wine_dbgstr_rect(&rc));
ok(!IsRectEmpty(&rc), "empty item rect\n"); ok(!IsRectEmpty(&rc), "empty item rect\n");
ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top); ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);

View file

@ -194,11 +194,9 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg,
if (winetest_debug > 1) { if (winetest_debug > 1) {
RECT rc; RECT rc;
GetMenuItemRect( hwnd, (HMENU)pdis->hwndItem, pdis->itemData ,&rc); GetMenuItemRect( hwnd, (HMENU)pdis->hwndItem, pdis->itemData ,&rc);
trace("WM_DRAWITEM received hwnd %p hmenu %p itemdata %ld item %d rc %d,%d-%d,%d itemrc: %d,%d-%d,%d\n", trace("WM_DRAWITEM received hwnd %p hmenu %p itemdata %ld item %d rc %s itemrc: %s\n",
hwnd, pdis->hwndItem, pdis->itemData, pdis->itemID, hwnd, pdis->hwndItem, pdis->itemData, pdis->itemID,
pdis->rcItem.left, pdis->rcItem.top, wine_dbgstr_rect(&pdis->rcItem), wine_dbgstr_rect(&rc));
pdis->rcItem.right,pdis->rcItem.bottom,
rc.left,rc.top,rc.right,rc.bottom);
oldpen=SelectObject( pdis->hDC, GetStockObject( oldpen=SelectObject( pdis->hDC, GetStockObject(
pdis->itemState & ODS_SELECTED ? WHITE_PEN :BLACK_PEN)); pdis->itemState & ODS_SELECTED ? WHITE_PEN :BLACK_PEN));
Rectangle( pdis->hDC, pdis->rcItem.left,pdis->rcItem.top, Rectangle( pdis->hDC, pdis->rcItem.left,pdis->rcItem.top,
@ -347,10 +345,8 @@ static void test_getmenubarinfo(void)
ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi); ret = pGetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi);
ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError()); ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
ok(mbi.rcBar.left == 0 && mbi.rcBar.top == 0 && ok(mbi.rcBar.left == 0 && mbi.rcBar.top == 0 && mbi.rcBar.bottom == 0 && mbi.rcBar.right == 0,
mbi.rcBar.bottom == 0 && mbi.rcBar.right == 0, "rcBar: Expected (0,0)-(0,0), got: %s\n", wine_dbgstr_rect(&mbi.rcBar));
"rcBar: Expected 0,0-0,0, got: %d,%d-%d,%d\n",
mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom);
ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n",
mbi.hMenu, hmenu); mbi.hMenu, hmenu);
ok(mbi.fBarFocused == 0, "fBarFocused: Got %d instead of 0.\n", mbi.fBarFocused); ok(mbi.fBarFocused == 0, "fBarFocused: Got %d instead of 0.\n", mbi.fBarFocused);
@ -381,8 +377,7 @@ static void test_getmenubarinfo(void)
ok(ret, "GetMenuItemRect failed.\n"); ok(ret, "GetMenuItemRect failed.\n");
todo_wine ok(mbi.rcBar.left == rci.left && mbi.rcBar.top == rci.top && todo_wine ok(mbi.rcBar.left == rci.left && mbi.rcBar.top == rci.top &&
mbi.rcBar.bottom == rci.bottom && mbi.rcBar.right == rcw.right - rci.left + rcw.left, mbi.rcBar.bottom == rci.bottom && mbi.rcBar.right == rcw.right - rci.left + rcw.left,
"rcBar: Got %d,%d-%d,%d instead of %d,%d-%d,%d\n", "rcBar: Got %s instead of (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&mbi.rcBar),
mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom,
rci.left, rci.top, rcw.right - rci.left + rcw.left, rci.bottom); rci.left, rci.top, rcw.right - rci.left + rcw.left, rci.bottom);
ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", mbi.hMenu, hmenu); ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", mbi.hMenu, hmenu);
ok(mbi.fBarFocused == 0, "fBarFocused: got %d instead of 0\n", mbi.fBarFocused); ok(mbi.fBarFocused == 0, "fBarFocused: got %d instead of 0\n", mbi.fBarFocused);
@ -393,11 +388,8 @@ static void test_getmenubarinfo(void)
ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError()); ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError());
ret = GetMenuItemRect(hwnd, hmenu, 1, &rci); ret = GetMenuItemRect(hwnd, hmenu, 1, &rci);
ok(ret, "GetMenuItemRect failed.\n"); ok(ret, "GetMenuItemRect failed.\n");
ok(mbi.rcBar.left == rci.left && mbi.rcBar.top == rci.top && ok(EqualRect(&mbi.rcBar, &rci), "rcBar: Got %s instead of %s\n", wine_dbgstr_rect(&mbi.rcBar),
mbi.rcBar.bottom == rci.bottom && mbi.rcBar.right == rci.right, wine_dbgstr_rect(&rci));
"rcBar: Got %d,%d-%d,%d instead of %d,%d-%d,%d\n",
mbi.rcBar.left, mbi.rcBar.top, mbi.rcBar.right, mbi.rcBar.bottom,
rci.left, rci.top, rci.right, rci.bottom);
ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", mbi.hMenu, hmenu); ok(mbi.hMenu == hmenu, "hMenu: Got %p instead of %p\n", mbi.hMenu, hmenu);
ok(mbi.fBarFocused == 0, "fBarFocused: got %d instead of 0\n", mbi.fBarFocused); ok(mbi.fBarFocused == 0, "fBarFocused: got %d instead of 0\n", mbi.fBarFocused);
ok(mbi.fFocused == 0, "fFocused: got %d instead of 0\n", mbi.fFocused); ok(mbi.fFocused == 0, "fFocused: got %d instead of 0\n", mbi.fFocused);
@ -977,9 +969,7 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
GetSystemMetrics(SM_CXMENUCHECK ), GetSystemMetrics(SM_CXMENUCHECK ),
GetSystemMetrics(SM_CYMENUCHECK ),arrowwidth, MOD_avec); GetSystemMetrics(SM_CYMENUCHECK ),arrowwidth, MOD_avec);
if( hbmp == HBMMENU_CALLBACK) if( hbmp == HBMMENU_CALLBACK)
trace( " rc %d,%d-%d,%d bmp.rc %d,%d-%d,%d\n", trace( " rc %s bmp.rc %s\n", wine_dbgstr_rect(&rc), wine_dbgstr_rect(&MOD_rc[0]));
rc.left, rc.top, rc.top, rc.bottom, MOD_rc[0].left,
MOD_rc[0].top,MOD_rc[0].right, MOD_rc[0].bottom);
} }
/* clean up */ /* clean up */
ret = DestroyMenu(submenu); ret = DestroyMenu(submenu);

View file

@ -262,21 +262,21 @@ static void test_ChangeDisplaySettingsEx(void)
/* Resolution change resets clip rect */ /* Resolution change resets clip rect */
ok(GetClipCursor(&r), "GetClipCursor() failed\n"); ok(GetClipCursor(&r), "GetClipCursor() failed\n");
ok(EqualRect(&r, &virt), "Invalid clip rect: (%d %d) x (%d %d)\n", r.left, r.top, r.right, r.bottom); ok(EqualRect(&r, &virt), "Invalid clip rect: %s\n", wine_dbgstr_rect(&r));
if (!ClipCursor(NULL)) continue; if (!ClipCursor(NULL)) continue;
ok(GetClipCursor(&r), "GetClipCursor() failed\n"); ok(GetClipCursor(&r), "GetClipCursor() failed\n");
ok(EqualRect(&r, &virt), "Invalid clip rect: (%d %d) x (%d %d)\n", r.left, r.top, r.right, r.bottom); ok(EqualRect(&r, &virt), "Invalid clip rect: %s\n", wine_dbgstr_rect(&r));
/* This should always work. Primary monitor is at (0,0) */ /* This should always work. Primary monitor is at (0,0) */
SetRect(&r1, 10, 10, 20, 20); SetRect(&r1, 10, 10, 20, 20);
ok(ClipCursor(&r1), "ClipCursor() failed\n"); ok(ClipCursor(&r1), "ClipCursor() failed\n");
ok(GetClipCursor(&r), "GetClipCursor() failed\n"); ok(GetClipCursor(&r), "GetClipCursor() failed\n");
ok(EqualRect(&r, &r1), "Invalid clip rect: (%d %d) x (%d %d)\n", r.left, r.top, r.right, r.bottom); ok(EqualRect(&r, &r1), "Invalid clip rect: %s\n", wine_dbgstr_rect(&r));
SetRect(&r1, 10, 10, 10, 10); SetRect(&r1, 10, 10, 10, 10);
ok(ClipCursor(&r1), "ClipCursor() failed\n"); ok(ClipCursor(&r1), "ClipCursor() failed\n");
ok(GetClipCursor(&r), "GetClipCursor() failed\n"); ok(GetClipCursor(&r), "GetClipCursor() failed\n");
ok(EqualRect(&r, &r1), "Invalid clip rect: (%d %d) x (%d %d)\n", r.left, r.top, r.right, r.bottom); ok(EqualRect(&r, &r1), "Invalid clip rect: %s\n", wine_dbgstr_rect(&r));
SetRect(&r1, 10, 10, 10, 9); SetRect(&r1, 10, 10, 10, 9);
ok(!ClipCursor(&r1), "ClipCursor() succeeded\n"); ok(!ClipCursor(&r1), "ClipCursor() succeeded\n");
/* Windows bug: further clipping fails once an empty rect is set, so we have to reset it */ /* Windows bug: further clipping fails once an empty rect is set, so we have to reset it */
@ -285,9 +285,8 @@ static void test_ChangeDisplaySettingsEx(void)
SetRect(&r1, virt.left - 10, virt.top - 10, virt.right + 20, virt.bottom + 20); SetRect(&r1, virt.left - 10, virt.top - 10, virt.right + 20, virt.bottom + 20);
ok(ClipCursor(&r1), "ClipCursor() failed\n"); ok(ClipCursor(&r1), "ClipCursor() failed\n");
ok(GetClipCursor(&r), "GetClipCursor() failed\n"); ok(GetClipCursor(&r), "GetClipCursor() failed\n");
ok(EqualRect(&r, &virt) || ok(EqualRect(&r, &virt) || broken(EqualRect(&r, &r1)) /* win9x */,
broken(EqualRect(&r, &r1)) /* win9x */, "Invalid clip rect: %s\n", wine_dbgstr_rect(&r));
"Invalid clip rect: (%d %d) x (%d %d)\n", r.left, r.top, r.right, r.bottom);
ClipCursor(&virt); ClipCursor(&virt);
} }
} }
@ -499,13 +498,12 @@ static void test_work_area(void)
ret = pGetMonitorInfoA(hmon, &mi); ret = pGetMonitorInfoA(hmon, &mi);
ok(ret, "GetMonitorInfo error %u\n", GetLastError()); ok(ret, "GetMonitorInfo error %u\n", GetLastError());
ok(mi.dwFlags & MONITORINFOF_PRIMARY, "not a primary monitor\n"); ok(mi.dwFlags & MONITORINFOF_PRIMARY, "not a primary monitor\n");
trace("primary monitor (%d,%d-%d,%d)\n", trace("primary monitor %s\n", wine_dbgstr_rect(&mi.rcMonitor));
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc_work, 0); ret = SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc_work, 0);
ok(ret, "SystemParametersInfo error %u\n", GetLastError()); ok(ret, "SystemParametersInfo error %u\n", GetLastError());
trace("work area (%d,%d-%d,%d)\n", rc_work.left, rc_work.top, rc_work.right, rc_work.bottom); trace("work area %s\n", wine_dbgstr_rect(&rc_work));
ok(EqualRect(&rc_work, &mi.rcWork), "work area is different\n"); ok(EqualRect(&rc_work, &mi.rcWork), "work area is different\n");
hwnd = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,10,10,0,0,0,NULL); hwnd = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,10,10,0,0,0,NULL);
@ -513,16 +511,13 @@ static void test_work_area(void)
ret = GetWindowRect(hwnd, &rc_normal); ret = GetWindowRect(hwnd, &rc_normal);
ok(ret, "GetWindowRect failed\n"); ok(ret, "GetWindowRect failed\n");
trace("normal (%d,%d-%d,%d)\n", rc_normal.left, rc_normal.top, rc_normal.right, rc_normal.bottom); trace("normal %s\n", wine_dbgstr_rect(&rc_normal));
wp.length = sizeof(wp); wp.length = sizeof(wp);
ret = GetWindowPlacement(hwnd, &wp); ret = GetWindowPlacement(hwnd, &wp);
ok(ret, "GetWindowPlacement failed\n"); ok(ret, "GetWindowPlacement failed\n");
trace("min: %d,%d max %d,%d normal %d,%d-%d,%d\n", trace("min: %d,%d max %d,%d normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y,
wp.ptMinPosition.x, wp.ptMinPosition.y, wp.ptMaxPosition.x, wp.ptMaxPosition.y, wine_dbgstr_rect(&wp.rcNormalPosition));
wp.ptMaxPosition.x, wp.ptMaxPosition.y,
wp.rcNormalPosition.left, wp.rcNormalPosition.top,
wp.rcNormalPosition.right, wp.rcNormalPosition.bottom);
OffsetRect(&wp.rcNormalPosition, rc_work.left, rc_work.top); OffsetRect(&wp.rcNormalPosition, rc_work.left, rc_work.top);
todo_wine_if (mi.rcMonitor.left != mi.rcWork.left || todo_wine_if (mi.rcMonitor.left != mi.rcWork.left ||
mi.rcMonitor.top != mi.rcWork.top) /* FIXME: remove once Wine is fixed */ mi.rcMonitor.top != mi.rcWork.top) /* FIXME: remove once Wine is fixed */
@ -535,11 +530,8 @@ static void test_work_area(void)
wp.length = sizeof(wp); wp.length = sizeof(wp);
ret = GetWindowPlacement(hwnd, &wp); ret = GetWindowPlacement(hwnd, &wp);
ok(ret, "GetWindowPlacement failed\n"); ok(ret, "GetWindowPlacement failed\n");
trace("min: %d,%d max %d,%d normal %d,%d-%d,%d\n", trace("min: %d,%d max %d,%d normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y,
wp.ptMinPosition.x, wp.ptMinPosition.y, wp.ptMaxPosition.x, wp.ptMaxPosition.y, wine_dbgstr_rect(&wp.rcNormalPosition));
wp.ptMaxPosition.x, wp.ptMaxPosition.y,
wp.rcNormalPosition.left, wp.rcNormalPosition.top,
wp.rcNormalPosition.right, wp.rcNormalPosition.bottom);
ok(EqualRect(&rc_normal, &wp.rcNormalPosition), "normal pos is different\n"); ok(EqualRect(&rc_normal, &wp.rcNormalPosition), "normal pos is different\n");
DestroyWindow(hwnd); DestroyWindow(hwnd);

File diff suppressed because it is too large Load diff

View file

@ -222,11 +222,8 @@ static void test_GetScrollBarInfo(void)
ok( ret, "The GetWindowRect() call should not fail.\n" ); ok( ret, "The GetWindowRect() call should not fail.\n" );
ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)), ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)),
"unexpected rgstate(0x%x)\n", sbi.rgstate[0]); "unexpected rgstate(0x%x)\n", sbi.rgstate[0]);
ok( EqualRect(&rect, &sbi.rcScrollBar), ok(EqualRect(&rect, &sbi.rcScrollBar), "WindowRect %s != rcScrollBar %s\n",
"WindowRect(%d, %d, %d, %d) != rcScrollBar(%d, %d, %d, %d)\n", wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar));
rect.top, rect.left, rect.bottom, rect.right,
sbi.rcScrollBar.top, sbi.rcScrollBar.left,
sbi.rcScrollBar.bottom, sbi.rcScrollBar.right );
/* Test windows horizontal and vertical scrollbar to make sure rcScrollBar /* Test windows horizontal and vertical scrollbar to make sure rcScrollBar
* is still returned in screen coordinates by moving the window, and * is still returned in screen coordinates by moving the window, and
@ -243,11 +240,8 @@ static void test_GetScrollBarInfo(void)
OffsetRect(&rect, 5, 5); OffsetRect(&rect, 5, 5);
ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi); ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi);
ok( ret, "The GetScrollBarInfo() call should not fail.\n" ); ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
ok( EqualRect(&rect, &sbi.rcScrollBar), ok(EqualRect(&rect, &sbi.rcScrollBar), "PreviousRect %s != CurrentRect %s\n",
"PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n", wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar));
rect.top, rect.left, rect.bottom, rect.right,
sbi.rcScrollBar.top, sbi.rcScrollBar.left,
sbi.rcScrollBar.bottom, sbi.rcScrollBar.right );
sbi.cbSize = sizeof(sbi); sbi.cbSize = sizeof(sbi);
ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi); ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi);
@ -260,11 +254,8 @@ static void test_GetScrollBarInfo(void)
OffsetRect(&rect, 5, 5); OffsetRect(&rect, 5, 5);
ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi); ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi);
ok( ret, "The GetScrollBarInfo() call should not fail.\n" ); ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
ok( EqualRect(&rect, &sbi.rcScrollBar), ok(EqualRect(&rect, &sbi.rcScrollBar), "PreviousRect %s != CurrentRect %s\n",
"PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n", wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar));
rect.top, rect.left, rect.bottom, rect.right,
sbi.rcScrollBar.top, sbi.rcScrollBar.left,
sbi.rcScrollBar.bottom, sbi.rcScrollBar.right );
DestroyWindow(hScroll); DestroyWindow(hScroll);
DestroyWindow(hMainWnd); DestroyWindow(hMainWnd);

View file

@ -33,9 +33,6 @@
static HWND hMainWnd; static HWND hMainWnd;
#define expect_eq(expr, value, type, fmt) { type val = expr; ok(val == (value), #expr " expected " fmt " got " fmt "\n", (value), val); } #define expect_eq(expr, value, type, fmt) { type val = expr; ok(val == (value), #expr " expected " fmt " got " fmt "\n", (value), val); }
#define expect_rect(r, _left, _top, _right, _bottom) ok(r.left == _left && r.top == _top && \
r.bottom == _bottom && r.right == _right, "Invalid rect (%d,%d) (%d,%d) vs (%d,%d) (%d,%d)\n", \
r.left, r.top, r.right, r.bottom, _left, _top, _right, _bottom);
static int g_nReceivedColorStatic = 0; static int g_nReceivedColorStatic = 0;

View file

@ -115,15 +115,14 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
ok(textheight==0,"Got textheight from DrawTextExA\n"); ok(textheight==0,"Got textheight from DrawTextExA\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, text, 0, &rect, DT_CALCRECT); textheight = DrawTextA(hdc, text, 0, &rect, DT_CALCRECT);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextA\n"); ok(textheight==0,"Got textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
@ -131,23 +130,19 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
SetLastError( 0); SetLastError( 0);
heightcheck = textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT, NULL );
ok( EMPTY(rect), ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect));
"rectangle should be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextExA\n"); ok(textheight!=0,"Failed to get textheight from DrawTextExA\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT); textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT);
ok( EMPTY(rect), ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect));
"rectangle should be empty got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight!=0,"Failed to get textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
SetLastError( 0); SetLastError( 0);
heightcheck = textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
ok( EMPTY(rect) || !MODIFIED(rect), ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect));
"rectangle should be empty or not modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
if (!textheight) /* Windows NT 4 */ if (!textheight) /* Windows NT 4 */
{ {
if (conform_xp) if (conform_xp)
@ -159,25 +154,22 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, NULL, -1, &rect, DT_CALCRECT); textheight = DrawTextA(hdc, NULL, -1, &rect, DT_CALCRECT);
ok( EMPTY(rect) || !MODIFIED(rect), ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect));
"rectangle should be empty or NOT modified got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight!=0,"Failed to get textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextExA\n"); ok(textheight==0,"Got textheight from DrawTextExA\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, NULL, 0, &rect, DT_CALCRECT); textheight = DrawTextA(hdc, NULL, 0, &rect, DT_CALCRECT);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextA\n"); ok(textheight==0,"Got textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
@ -186,16 +178,15 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextExA\n"); ok(textheight==0,"Got textheight from DrawTextExA\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, text, 0, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextA(hdc, text, 0, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextA\n"); ok(textheight==0,"Got textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
@ -203,47 +194,44 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
SetLastError( 0); SetLastError( 0);
heightcheck = textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( !EMPTY(rect) && MODIFIED(rect), ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n",
"rectangle should be modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); wine_dbgstr_rect(&rect));
ok(textheight!=0,"Failed to get textheight from DrawTextExA\n"); ok(textheight!=0,"Failed to get textheight from DrawTextExA\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( !EMPTY(rect) && MODIFIED (rect), ok(!EMPTY(rect) && MODIFIED (rect), "rectangle should be modified got %s\n",
"rectangle should be modified got %d,%d-%d,%d\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight!=0,"Failed to get textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
SetLastError( 0); SetLastError( 0);
heightcheck = textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( (!EMPTY(rect) && MODIFIED(rect)) || !MODIFIED(rect), ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n",
"rectangle should be modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); wine_dbgstr_rect(&rect));
if (conform_xp) if (conform_xp)
ok(textheight!=0,"Failed to get textheight from DrawTextExA\n"); ok(textheight!=0,"Failed to get textheight from DrawTextExA\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextA(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( (!EMPTY(rect) && MODIFIED(rect)) || !MODIFIED(rect), ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n",
"rectangle should be modified got %d,%d-%d,%d\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight!=0,"Failed to get textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextExA\n"); ok(textheight==0,"Got textheight from DrawTextExA\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextA(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextA(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextA\n"); ok(textheight==0,"Got textheight from DrawTextA\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
@ -334,39 +322,32 @@ static void test_DrawTextCalcRect(void)
SetLastError( 0); SetLastError( 0);
heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL );
if( GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) { if( GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) {
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT); textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL );
ok( EMPTY(rect), ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect));
"rectangle should be empty got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT); textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT);
ok( EMPTY(rect), ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect));
"rectangle should be empty got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (textheight) /* windows 2000 */ if (textheight) /* windows 2000 */
{ {
if (conform_xp) if (conform_xp)
@ -378,9 +359,8 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT); textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextW\n"); ok(textheight==0,"Got textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
@ -389,16 +369,14 @@ static void test_DrawTextCalcRect(void)
/* Crashes on NT4 */ /* Crashes on NT4 */
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL ); heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight==0,"Got textheight from DrawTextExW\n"); ok(textheight==0,"Got textheight from DrawTextExW\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT); textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight==0,"Got textheight from DrawTextW\n"); ok(textheight==0,"Got textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
} }
@ -407,31 +385,27 @@ static void test_DrawTextCalcRect(void)
/* DT_SINGLELINE tests */ /* DT_SINGLELINE tests */
heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( !EMPTY(rect) && MODIFIED(rect), ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n",
"rectangle should be modified got %d,%d-%d,%d\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( !EMPTY(rect) && MODIFIED(rect), ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n",
"rectangle should be modified got %d,%d-%d,%d\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight!=0,"Failed to get textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
@ -439,33 +413,29 @@ static void test_DrawTextCalcRect(void)
/* Crashes on NT4 */ /* Crashes on NT4 */
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight==0,"Got textheight from DrawTextExW\n"); ok(textheight==0,"Got textheight from DrawTextExW\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
ok(textheight==0,"Got textheight from DrawTextW\n"); ok(textheight==0,"Got textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
} }
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL );
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextExW\n"); ok(textheight==0,"Got textheight from DrawTextExW\n");
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE); textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE);
ok( !EMPTY(rect) && !MODIFIED(rect), ok(!IsRectEmpty(&rect) && !MODIFIED(rect),
"rectangle should NOT be empty and NOT modified got %d,%d-%d,%d\n", "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom );
if (conform_xp) if (conform_xp)
ok(textheight==0,"Got textheight from DrawTextW\n"); ok(textheight==0,"Got textheight from DrawTextW\n");
ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n");
@ -600,8 +570,7 @@ static void test_DrawTextCalcRect(void)
ok(textheight >= heightcheck, "Got unexpected textheight %d\n", textheight); ok(textheight >= heightcheck, "Got unexpected textheight %d\n", textheight);
ok(dtp.iTabLength == 0, "invalid dtp.iTabLength = %i\n",dtp.iTabLength); ok(dtp.iTabLength == 0, "invalid dtp.iTabLength = %i\n",dtp.iTabLength);
ok(rect.left == rect2.left && rect.right != rect2.right && rect.top == rect2.top && rect.bottom == rect2.bottom, ok(rect.left == rect2.left && rect.right != rect2.right && rect.top == rect2.top && rect.bottom == rect2.bottom,
"incorrect rect %d,%d-%d,%d rect2 %d,%d-%d,%d\n", "incorrect rect %s rect2 %s\n", wine_dbgstr_rect(&rect), wine_dbgstr_rect(&rect2));
rect.left, rect.top, rect.right, rect.bottom, rect2.left, rect2.top, rect2.right, rect2.bottom );
SetRect( &rect, 0,0, 10, 10); SetRect( &rect, 0,0, 10, 10);
memset(&dtp, 0, sizeof(dtp)); memset(&dtp, 0, sizeof(dtp));
@ -759,37 +728,84 @@ static void test_DrawState(void)
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
static void test_string_conversions(void) static void test_CharToOem_OemToChar(void)
{ {
char buf[64] = "string"; static const WCHAR helloWorldW[] = {'H','e','l','l','o',' ','W','o','r','l','d',0};
int i; static const WCHAR emptyW[] = {0};
BOOL ret; static const char helloWorld[] = "Hello World";
struct static const struct
{ {
char *src, *dst; BOOL src, dst, ret;
unsigned len; }
BOOL ret; tests[] =
} test[] =
{ {
{ NULL, NULL, 1, FALSE }, { FALSE, FALSE, FALSE },
{ buf, NULL, 1, FALSE }, { TRUE, FALSE, FALSE },
{ NULL, buf, 1, FALSE }, { FALSE, TRUE, FALSE },
{ buf, buf, 1, TRUE } { TRUE, TRUE, TRUE },
}; };
BOOL ret;
int i;
for (i = 0; i < sizeof(test)/sizeof(test[0]); i++) for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
{ {
ret = CharToOemA(test[i].src, test[i].dst); const char *expected = tests[i].ret ? helloWorld : "";
ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); const char *src = tests[i].src ? helloWorld : NULL;
char buf[64], *dst = tests[i].dst ? buf : NULL;
ret = CharToOemBuffA(test[i].src, test[i].dst, test[i].len); memset(buf, 0, sizeof(buf));
ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); ret = CharToOemA(src, dst);
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
ret = OemToCharA(test[i].src, test[i].dst); memset(buf, 0, sizeof(buf));
ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); ret = CharToOemBuffA(src, dst, sizeof(helloWorld));
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
ret = OemToCharBuffA(test[i].src, test[i].dst, test[i].len); memset(buf, 0, sizeof(buf));
ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); ret = OemToCharA(src, dst);
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
memset(buf, 0, sizeof(buf));
ret = OemToCharBuffA(src, dst, sizeof(helloWorld));
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
}
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
{
const char *expected = tests[i].ret ? helloWorld : "";
const WCHAR *src = tests[i].src ? helloWorldW : NULL;
char buf[64], *dst = tests[i].dst ? buf : NULL;
memset(buf, 0, sizeof(buf));
ret = CharToOemW(src, dst);
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
memset(buf, 0, sizeof(buf));
ret = CharToOemBuffW(src, dst, sizeof(helloWorldW)/sizeof(WCHAR));
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!strcmp(buf, expected), "test %d: got '%s'\n", i, buf);
}
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
{
const WCHAR *expected = tests[i].ret ? helloWorldW : emptyW;
const char *src = tests[i].src ? helloWorld : NULL;
WCHAR buf[64], *dst = tests[i].dst ? buf : NULL;
memset(buf, 0, sizeof(buf));
ret = OemToCharW(src, dst);
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!lstrcmpW(buf, expected), "test %d: got '%s'\n", i, wine_dbgstr_w(buf));
memset(buf, 0, sizeof(buf));
ret = OemToCharBuffW(src, dst, sizeof(helloWorld));
ok(ret == tests[i].ret, "test %d: expected %d, got %d\n", i, tests[i].ret, ret);
ok(!lstrcmpW(buf, expected), "test %d: got '%s'\n", i, wine_dbgstr_w(buf));
} }
} }
@ -798,5 +814,5 @@ START_TEST(text)
test_TabbedText(); test_TabbedText();
test_DrawTextCalcRect(); test_DrawTextCalcRect();
test_DrawState(); test_DrawState();
test_string_conversions(); test_CharToOem_OemToChar();
} }

View file

@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define WINE_NO_INLINE_RECT
#include "wine/test.h" #include "wine/test.h"
#include "winbase.h" #include "winbase.h"
#include "wingdi.h" #include "wingdi.h"
@ -75,8 +76,8 @@ static void test_SubtractRect(void)
result = SubtractRect(&rectr, &rect1, &rect2); result = SubtractRect(&rectr, &rect1, &rect2);
ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
ok(result && rectr.left == 50 && rectr.top == 50 && rectr.right ==150 ok(result && rectr.left == 50 && rectr.top == 50 && rectr.right ==150
&& rectr.bottom == 100, "wrong rect subtraction of SubtractRect " && rectr.bottom == 100, "wrong rect subtraction of SubtractRect (dest rect=%s)\n",
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); wine_dbgstr_rect(&rectr));
/* source rect 2 partially overlaps rect 1 */ /* source rect 2 partially overlaps rect 1 */
SetRect(&rect1, 2431, 626, 3427, 1608); SetRect(&rect1, 2431, 626, 3427, 1608);
@ -84,8 +85,8 @@ static void test_SubtractRect(void)
result = SubtractRect(&rectr, &rect1, &rect2); result = SubtractRect(&rectr, &rect1, &rect2);
ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499 ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
&& rectr.bottom == 1608, "wrong rect subtraction of SubtractRect " && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect (dest rect=%s)\n",
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); wine_dbgstr_rect(&rectr));
/* source rect 2 partially overlaps rect 1 - dest is src rect 2 */ /* source rect 2 partially overlaps rect 1 - dest is src rect 2 */
SetRect(&rect1, 2431, 626, 3427, 1608); SetRect(&rect1, 2431, 626, 3427, 1608);
@ -93,26 +94,118 @@ static void test_SubtractRect(void)
result = SubtractRect(&rect2, &rect1, &rect2); result = SubtractRect(&rect2, &rect1, &rect2);
ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n");
ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499 ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499
&& rectr.bottom == 1608, "wrong rect subtraction of SubtractRect " && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect (dest rect=%s)\n",
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); wine_dbgstr_rect(&rectr));
/* source rect 2 completely overlaps rect 1 */ /* source rect 2 completely overlaps rect 1 */
SetRect(&rect1, 250, 250, 400, 500); SetRect(&rect1, 250, 250, 400, 500);
SetRect(&rect2, 50, 50, 1500, 1000); SetRect(&rect2, 50, 50, 1500, 1000);
result = SubtractRect(&rectr, &rect1, &rect2); result = SubtractRect(&rectr, &rect1, &rect2);
ok(!result, "SubtractRect returned TRUE but subtraction should be empty " ok(!result, "SubtractRect returned TRUE but subtraction should be empty (dest rect=%s)\n",
"(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); wine_dbgstr_rect(&rectr));
/* source rect 2 completely overlaps rect 1 - dest is src rect 2 */ /* source rect 2 completely overlaps rect 1 - dest is src rect 2 */
SetRect(&rect1, 250, 250, 400, 500); SetRect(&rect1, 250, 250, 400, 500);
SetRect(&rect2, 50, 50, 1500, 1000); SetRect(&rect2, 50, 50, 1500, 1000);
result = SubtractRect(&rect2, &rect1, &rect2); result = SubtractRect(&rect2, &rect1, &rect2);
ok(!result, "SubtractRect returned TRUE but subtraction should be empty " ok(!result, "SubtractRect returned TRUE but subtraction should be empty (dest rect=%s)\n",
"(dest rect={%d, %d, %d, %d})\n", rect2.left, rect2.top, rect2.right, rect2.bottom); wine_dbgstr_rect(&rect2));
}
static void test_EqualRect(void)
{
RECT rect1, rect2;
BOOL ret;
SetRect(&rect1, 0, 0, 0, 0);
SetRect(&rect2, 1, 1, 1, 1);
ret = EqualRect(NULL, NULL);
ok(!ret, "got %d\n", ret);
ret = EqualRect(&rect1, NULL);
ok(!ret, "got %d\n", ret);
ret = EqualRect(NULL, &rect2);
ok(!ret, "got %d\n", ret);
ret = EqualRect(&rect1, &rect2);
ok(!ret, "got %d\n", ret);
SetRect(&rect1, 0, 0, 10, 10);
SetRect(&rect2, 10, 10, 0, 0);
ret = EqualRect(&rect1, &rect2);
ok(!ret, "got %d\n", ret);
ret = EqualRect(&rect1, &rect1);
ok(ret, "got %d\n", ret);
rect2 = rect1;
ret = EqualRect(&rect1, &rect2);
ok(ret, "got %d\n", ret);
}
static void test_IsRectEmpty(void)
{
BOOL ret;
unsigned int i;
static const struct {
RECT rect;
BOOL ret;
} rtest[] = {
{{0, 0, 0, 0}, TRUE},
{{127, 131, 127, 131}, TRUE},
{{MAXLONG, MAXLONG, MAXLONG, MAXLONG}, TRUE},
{{-1, -1, -1, -1}, TRUE},
{{-2011, -2017, -2011, -2017}, TRUE},
{{MINLONG, MINLONG, MINLONG, MINLONG}, TRUE},
/* Only width or height are 0 */
{{31, 37, 31, 41}, TRUE},
{{881, 883, 887, 883}, TRUE},
{{-1721, 1723, -1721, 7213}, TRUE},
/* Negative width and/or height */
{{11, 13, 5, 7}, TRUE},
{{-11, -13, -19, -23}, TRUE},
{{11, 13, -17, 19}, TRUE},
{{11, 13, 17, 11}, TRUE},
/* Non emty rects */
{{101, 103, 107, 109}, FALSE},
{{1, -9, 7, 3}, FALSE},
{{-109, -107, -103, -101}, FALSE},
};
for (i = 0; i < sizeof(rtest)/sizeof(rtest[0]); i++) {
ret = IsRectEmpty(&rtest[i].rect);
ok(ret == rtest[i].ret, "Test %d: IsRectEmpty returned %s for %s\n", i,
ret ? "TRUE" : "FALSE", wine_dbgstr_rect(&rtest[i].rect));
}
}
static void test_SetRect(void)
{
RECT rect;
BOOL ret;
ret = SetRect(NULL, 0, 0, 0, 0);
ok(!ret, "got %d\n", ret);
ret = SetRect(&rect, 1, 2, 3, 4);
ok(ret, "got %d\n", ret);
ok(rect.left == 1 && rect.top == 2 && rect.right == 3 && rect.bottom == 4,
"got wrong rectangle\n");
ret = SetRect(&rect, 10, 10, 5, 5);
ok(ret, "got %d\n", ret);
ok(rect.left == 10 && rect.top == 10 && rect.right == 5 && rect.bottom == 5,
"got wrong rectangle\n");
} }
START_TEST(uitools) START_TEST(uitools)
{ {
test_FillRect(); test_FillRect();
test_SubtractRect(); test_SubtractRect();
test_EqualRect();
test_IsRectEmpty();
test_SetRect();
} }

View file

@ -807,14 +807,14 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR
if (0) if (0)
{ {
/* Uncomment this once the test succeeds in all cases */ /* Uncomment this once the test succeeds in all cases */
ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d-%d,%d) / (%d,%d-%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom ); wine_dbgstr_rect(&rc2));
GetClientRect(hwnd, &rc2); GetClientRect(hwnd, &rc2);
DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1);
MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2); MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2);
ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d-%d,%d) / (%d,%d-%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom ); wine_dbgstr_rect(&rc2));
} }
break; break;
} }
@ -1078,31 +1078,28 @@ static void test_nonclient_area(HWND hwnd)
if (IsRectEmpty(&rc_window) || IsRectEmpty(&rc_client) || if (IsRectEmpty(&rc_window) || IsRectEmpty(&rc_client) ||
rc_window.right > 32768 || rc_window.bottom > 32768) return; rc_window.right > 32768 || rc_window.bottom > 32768) return;
CopyRect(&rc, &rc_client); rc = rc_client;
MapWindowPoints(hwnd, 0, (LPPOINT)&rc, 2); MapWindowPoints(hwnd, 0, (LPPOINT)&rc, 2);
FixedAdjustWindowRectEx(&rc, style, menu, exstyle); FixedAdjustWindowRectEx(&rc, style, menu, exstyle);
ok(EqualRect(&rc, &rc_window), ok(EqualRect(&rc, &rc_window),
"window rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, win=(%d,%d)-(%d,%d), calc=(%d,%d)-(%d,%d)\n", "window rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, win=%s, calc=%s\n",
style, exstyle, menu, rc_window.left, rc_window.top, rc_window.right, rc_window.bottom, style, exstyle, menu, wine_dbgstr_rect(&rc_window), wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
CopyRect(&rc, &rc_client); rc = rc_client;
MapWindowPoints(hwnd, 0, (LPPOINT)&rc, 2); MapWindowPoints(hwnd, 0, (LPPOINT)&rc, 2);
wine_AdjustWindowRectEx(&rc, style, menu, exstyle); wine_AdjustWindowRectEx(&rc, style, menu, exstyle);
ok(EqualRect(&rc, &rc_window), ok(EqualRect(&rc, &rc_window),
"window rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, win=(%d,%d)-(%d,%d), calc=(%d,%d)-(%d,%d)\n", "window rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, win=%s, calc=%s\n",
style, exstyle, menu, rc_window.left, rc_window.top, rc_window.right, rc_window.bottom, style, exstyle, menu, wine_dbgstr_rect(&rc_window), wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
CopyRect(&rc, &rc_window); rc = rc_window;
DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc);
MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2); MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2);
ok(EqualRect(&rc, &rc_client), ok(EqualRect(&rc, &rc_client),
"client rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d client=(%d,%d)-(%d,%d), calc=(%d,%d)-(%d,%d)\n", "client rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d client=%s, calc=%s\n",
style, exstyle, menu, rc_client.left, rc_client.top, rc_client.right, rc_client.bottom, style, exstyle, menu, wine_dbgstr_rect(&rc_client), wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
/* NULL rectangle shouldn't crash */ /* NULL rectangle shouldn't crash */
ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, 0); ret = DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, 0);
@ -1114,17 +1111,16 @@ static void test_nonclient_area(HWND hwnd)
/* and now test AdjustWindowRectEx and WM_NCCALCSIZE on synthetic data */ /* and now test AdjustWindowRectEx and WM_NCCALCSIZE on synthetic data */
SetRect(&rc_client, 0, 0, 250, 150); SetRect(&rc_client, 0, 0, 250, 150);
CopyRect(&rc_window, &rc_client); rc_window = rc_client;
MapWindowPoints(hwnd, 0, (LPPOINT)&rc_window, 2); MapWindowPoints(hwnd, 0, (LPPOINT)&rc_window, 2);
FixedAdjustWindowRectEx(&rc_window, style, menu, exstyle); FixedAdjustWindowRectEx(&rc_window, style, menu, exstyle);
CopyRect(&rc, &rc_window); rc = rc_window;
DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc);
MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2); MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2);
ok(EqualRect(&rc, &rc_client), ok(EqualRect(&rc, &rc_client),
"synthetic rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, client=(%d,%d)-(%d,%d), calc=(%d,%d)-(%d,%d)\n", "synthetic rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, client=%s, calc=%s\n",
style, exstyle, menu, rc_client.left, rc_client.top, rc_client.right, rc_client.bottom, style, exstyle, menu, wine_dbgstr_rect(&rc_client), wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
} }
static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam) static LRESULT CALLBACK cbt_hook_proc(int nCode, WPARAM wParam, LPARAM lParam)
@ -1777,8 +1773,7 @@ static void MDI_ChildGetMinMaxInfo( HWND client, HWND hwnd, MINMAXINFO* lpMinMax
lpMinMax->ptMaxPosition.x = rect.left; lpMinMax->ptMaxPosition.x = rect.left;
lpMinMax->ptMaxPosition.y = rect.top; lpMinMax->ptMaxPosition.y = rect.top;
trace("max rect (%d,%d - %d, %d)\n", trace("max rect %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
} }
static LRESULT WINAPI mdi_child_wnd_proc_1(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) static LRESULT WINAPI mdi_child_wnd_proc_1(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
@ -1957,16 +1952,14 @@ static LRESULT WINAPI mdi_child_wnd_proc_2(HWND hwnd, UINT msg, WPARAM wparam, L
SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy); SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy);
/* note: winpos coordinates are relative to parent */ /* note: winpos coordinates are relative to parent */
MapWindowPoints(GetParent(hwnd), 0, (LPPOINT)&rc2, 2); MapWindowPoints(GetParent(hwnd), 0, (LPPOINT)&rc2, 2);
ok(EqualRect(&rc1, &rc2), "rects do not match, window=(%d,%d)-(%d,%d) pos=(%d,%d)-(%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match, window=%s pos=%s\n",
rc1.left, rc1.top, rc1.right, rc1.bottom, wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
rc2.left, rc2.top, rc2.right, rc2.bottom);
GetWindowRect(hwnd, &rc1); GetWindowRect(hwnd, &rc1);
GetClientRect(hwnd, &rc2); GetClientRect(hwnd, &rc2);
DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1);
MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2); MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2);
ok(EqualRect(&rc1, &rc2), "rects do not match, window=(%d,%d)-(%d,%d) client=(%d,%d)-(%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match, window=%s client=%s\n",
rc1.left, rc1.top, rc1.right, rc1.bottom, wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
rc2.left, rc2.top, rc2.right, rc2.bottom);
} }
/* fall through */ /* fall through */
case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGING:
@ -2007,11 +2000,11 @@ static LRESULT WINAPI mdi_main_wnd_procA(HWND hwnd, UINT msg, WPARAM wparam, LPA
RECT rc1, rc2; RECT rc1, rc2;
GetWindowRect(hwnd, &rc1); GetWindowRect(hwnd, &rc1);
trace("window: (%d,%d)-(%d,%d)\n", rc1.left, rc1.top, rc1.right, rc1.bottom); trace("window: %s\n", wine_dbgstr_rect(&rc1));
SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy); SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy);
/* note: winpos coordinates are relative to parent */ /* note: winpos coordinates are relative to parent */
MapWindowPoints(GetParent(hwnd), 0, (LPPOINT)&rc2, 2); MapWindowPoints(GetParent(hwnd), 0, (LPPOINT)&rc2, 2);
trace("pos: (%d,%d)-(%d,%d)\n", rc2.left, rc2.top, rc2.right, rc2.bottom); trace("pos: %s\n", wine_dbgstr_rect(&rc2));
ok(EqualRect(&rc1, &rc2), "rects do not match\n"); ok(EqualRect(&rc1, &rc2), "rects do not match\n");
GetWindowRect(hwnd, &rc1); GetWindowRect(hwnd, &rc1);
@ -2366,12 +2359,12 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
SetRect(&rect, 111, 222, 333, 444); SetRect(&rect, 111, 222, 333, 444);
ok(!GetWindowRect(0, &rect), "GetWindowRect succeeded\n"); ok(!GetWindowRect(0, &rect), "GetWindowRect succeeded\n");
ok(rect.left == 111 && rect.top == 222 && rect.right == 333 && rect.bottom == 444, ok(rect.left == 111 && rect.top == 222 && rect.right == 333 && rect.bottom == 444,
"wrong window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "wrong window rect %s\n", wine_dbgstr_rect(&rect));
SetRect(&rect, 111, 222, 333, 444); SetRect(&rect, 111, 222, 333, 444);
ok(!GetClientRect(0, &rect), "GetClientRect succeeded\n"); ok(!GetClientRect(0, &rect), "GetClientRect succeeded\n");
ok(rect.left == 111 && rect.top == 222 && rect.right == 333 && rect.bottom == 444, ok(rect.left == 111 && rect.top == 222 && rect.right == 333 && rect.bottom == 444,
"wrong window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "wrong window rect %s\n", wine_dbgstr_rect(&rect));
GetWindowRect(hwnd, &orig_win_rc); GetWindowRect(hwnd, &orig_win_rc);
@ -2380,21 +2373,21 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ok(ret, "Got %d\n", ret); ok(ret, "Got %d\n", ret);
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
ok( rect.left == 100 && rect.top == 100 && rect.right == 100 && rect.bottom == 100, ok( rect.left == 100 && rect.top == 100 && rect.right == 100 && rect.bottom == 100,
"invalid window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid window rect %s\n", wine_dbgstr_rect(&rect));
GetClientRect( hwnd, &rect ); GetClientRect( hwnd, &rect );
MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 ); MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 );
ok( rect.left == 90 && rect.top == 90 && rect.right == 110 && rect.bottom == 110, ok( rect.left == 90 && rect.top == 90 && rect.right == 110 && rect.bottom == 110,
"invalid client rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid client rect %s\n", wine_dbgstr_rect(&rect));
ret = SetWindowPos(hwnd, 0, 200, 200, 0, 0, SWP_NOZORDER|SWP_FRAMECHANGED); ret = SetWindowPos(hwnd, 0, 200, 200, 0, 0, SWP_NOZORDER|SWP_FRAMECHANGED);
ok(ret, "Got %d\n", ret); ok(ret, "Got %d\n", ret);
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
ok( rect.left == 200 && rect.top == 200 && rect.right == 200 && rect.bottom == 200, ok( rect.left == 200 && rect.top == 200 && rect.right == 200 && rect.bottom == 200,
"invalid window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid window rect %s\n", wine_dbgstr_rect(&rect));
GetClientRect( hwnd, &rect ); GetClientRect( hwnd, &rect );
MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 ); MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 );
ok( rect.left == 210 && rect.top == 210 && rect.right == 190 && rect.bottom == 190, ok( rect.left == 210 && rect.top == 210 && rect.right == 190 && rect.bottom == 190,
"invalid client rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "invalid client rect %s\n", wine_dbgstr_rect(&rect));
ret = SetWindowPos(hwnd, 0, orig_win_rc.left, orig_win_rc.top, ret = SetWindowPos(hwnd, 0, orig_win_rc.left, orig_win_rc.top,
orig_win_rc.right, orig_win_rc.bottom, 0); orig_win_rc.right, orig_win_rc.bottom, 0);
@ -2461,10 +2454,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ret = SetWindowPos(hwnd_child, hwnd2 , 1, 2, 3, 4, 0); ret = SetWindowPos(hwnd_child, hwnd2 , 1, 2, 3, 4, 0);
ok(ret, "Got %d\n", ret); ok(ret, "Got %d\n", ret);
GetWindowRect(hwnd_child, &rc2); GetWindowRect(hwnd_child, &rc2);
ok(rc1.left == rc2.left && rc1.top == rc2.top && ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
rc1.right == rc2.right && rc1.bottom == rc2.bottom,
"(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom);
check_active_state(hwnd2, hwnd2, hwnd2); check_active_state(hwnd2, hwnd2, hwnd2);
/* Same thing the other way around. */ /* Same thing the other way around. */
@ -2472,10 +2462,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ret = SetWindowPos(hwnd2, hwnd_child, 1, 2, 3, 4, 0); ret = SetWindowPos(hwnd2, hwnd_child, 1, 2, 3, 4, 0);
ok(ret, "Got %d\n", ret); ok(ret, "Got %d\n", ret);
GetWindowRect(hwnd2, &rc2); GetWindowRect(hwnd2, &rc2);
ok(rc1.left == rc2.left && rc1.top == rc2.top && ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
rc1.right == rc2.right && rc1.bottom == rc2.bottom,
"(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom);
check_active_state(hwnd2, hwnd2, hwnd2); check_active_state(hwnd2, hwnd2, hwnd2);
/* .. and with these windows. */ /* .. and with these windows. */
@ -2483,10 +2470,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ret = SetWindowPos(hwnd_grandchild, hwnd_child2, 1, 2, 3, 4, 0); ret = SetWindowPos(hwnd_grandchild, hwnd_child2, 1, 2, 3, 4, 0);
ok(ret, "Got %d\n", ret); ok(ret, "Got %d\n", ret);
GetWindowRect(hwnd_grandchild, &rc2); GetWindowRect(hwnd_grandchild, &rc2);
ok(rc1.left == rc2.left && rc1.top == rc2.top && ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
rc1.right == rc2.right && rc1.bottom == rc2.bottom,
"(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom);
check_active_state(hwnd2, hwnd2, hwnd2); check_active_state(hwnd2, hwnd2, hwnd2);
/* Add SWP_NOZORDER and it will be properly resized. */ /* Add SWP_NOZORDER and it will be properly resized. */
@ -2496,8 +2480,8 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
GetWindowRect(hwnd_grandchild, &rc2); GetWindowRect(hwnd_grandchild, &rc2);
ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top && ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top &&
(rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom, (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom,
"(%d, %d, %d, %d) != (%d, %d, %d, %d)\n", "(%d,%d)-(%d,%d) != %s\n", rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6,
rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, rc2.left, rc2.top, rc2.right, rc2.bottom); wine_dbgstr_rect(&rc2));
check_active_state(hwnd2, hwnd2, hwnd2); check_active_state(hwnd2, hwnd2, hwnd2);
/* Given a sibling window, the window is properly resized. */ /* Given a sibling window, the window is properly resized. */
@ -2507,8 +2491,8 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
GetWindowRect(hwnd_child, &rc2); GetWindowRect(hwnd_child, &rc2);
ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top && ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top &&
(rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom, (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom,
"(%d, %d, %d, %d) != (%d, %d, %d, %d)\n", "(%d,%d)-(%d,%d) != %s\n", rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6,
rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, rc2.left, rc2.top, rc2.right, rc2.bottom); wine_dbgstr_rect(&rc2));
check_active_state(hwnd2, hwnd2, hwnd2); check_active_state(hwnd2, hwnd2, hwnd2);
/* Involving the desktop window changes things. */ /* Involving the desktop window changes things. */
@ -2520,10 +2504,7 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2)
ret = SetWindowPos(hwnd_child, hwnd_desktop, 0, 0, 0, 0, 0); ret = SetWindowPos(hwnd_child, hwnd_desktop, 0, 0, 0, 0, 0);
ok(!ret, "Got %d\n", ret); ok(!ret, "Got %d\n", ret);
GetWindowRect(hwnd_child, &rc2); GetWindowRect(hwnd_child, &rc2);
ok(rc1.top == rc2.top && rc1.left == rc2.left && ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2));
rc1.bottom == rc2.bottom && rc1.right == rc2.right,
"(%d, %d, %d, %d) != (%d, %d, %d, %d)\n",
rc1.top, rc1.left, rc1.bottom, rc1.right, rc2.top, rc2.left, rc2.bottom, rc2.right);
check_active_state(hwnd2, hwnd2, hwnd2); check_active_state(hwnd2, hwnd2, hwnd2);
ret = SetWindowPos(hwnd_desktop, hwnd_child, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); ret = SetWindowPos(hwnd_desktop, hwnd_child, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
@ -2877,8 +2858,8 @@ static void test_vis_rgn( HWND hwnd )
trace("win9x, mapping to screen coords\n"); trace("win9x, mapping to screen coords\n");
MapWindowPoints( hwnd, 0, (POINT *)&rgn_rect, 2 ); MapWindowPoints( hwnd, 0, (POINT *)&rgn_rect, 2 );
} }
trace("win: %d,%d-%d,%d\n", win_rect.left, win_rect.top, win_rect.right, win_rect.bottom ); trace("win: %s\n", wine_dbgstr_rect(&win_rect));
trace("rgn: %d,%d-%d,%d\n", rgn_rect.left, rgn_rect.top, rgn_rect.right, rgn_rect.bottom ); trace("rgn: %s\n", wine_dbgstr_rect(&rgn_rect));
ok( win_rect.left <= rgn_rect.left, "rgn left %d not inside win rect %d\n", ok( win_rect.left <= rgn_rect.left, "rgn left %d not inside win rect %d\n",
rgn_rect.left, win_rect.left ); rgn_rect.left, win_rect.left );
ok( win_rect.top <= rgn_rect.top, "rgn top %d not inside win rect %d\n", ok( win_rect.top <= rgn_rect.top, "rgn top %d not inside win rect %d\n",
@ -3625,7 +3606,7 @@ static void test_mouse_input(HWND hwnd)
SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE ); SetWindowPos( hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE );
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("main window %p: (%d,%d)-(%d,%d)\n", hwnd, rc.left, rc.top, rc.right, rc.bottom); trace("main window %p: %s\n", hwnd, wine_dbgstr_rect(&rc));
popup = CreateWindowExA(0, "MainWindowClass", NULL, WS_POPUP, popup = CreateWindowExA(0, "MainWindowClass", NULL, WS_POPUP,
rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top,
@ -3636,7 +3617,7 @@ static void test_mouse_input(HWND hwnd)
SetWindowPos( popup, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE ); SetWindowPos( popup, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE );
GetWindowRect(popup, &rc); GetWindowRect(popup, &rc);
trace("popup window %p: (%d,%d)-(%d,%d)\n", popup, rc.left, rc.top, rc.right, rc.bottom); trace("popup window %p: %s\n", popup, wine_dbgstr_rect(&rc));
x = rc.left + (rc.right - rc.left) / 2; x = rc.left + (rc.right - rc.left) / 2;
y = rc.top + (rc.bottom - rc.top) / 2; y = rc.top + (rc.bottom - rc.top) / 2;
@ -3832,8 +3813,7 @@ static void test_validatergn(HWND hwnd)
ret = GetUpdateRect( child, &rc2, 0); ret = GetUpdateRect( child, &rc2, 0);
ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret); ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret);
ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0, ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0,
"Update rectangle %d,%d-%d,%d is not empty!\n", rc2.left, rc2.top, "Update rectangle %s is not empty!\n", wine_dbgstr_rect(&rc2));
rc2.right, rc2.bottom);
/* now test ValidateRgn */ /* now test ValidateRgn */
InvalidateRect( child, NULL, 1); InvalidateRect( child, NULL, 1);
@ -3844,8 +3824,7 @@ static void test_validatergn(HWND hwnd)
ret = GetUpdateRect( child, &rc2, 0); ret = GetUpdateRect( child, &rc2, 0);
ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret); ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret);
ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0, ok( rc2.left == 0 && rc2.top == 0 && rc2.right == 0 && rc2.bottom == 0,
"Update rectangle %d,%d-%d,%d is not empty!\n", rc2.left, rc2.top, "Update rectangle %s is not empty!\n", wine_dbgstr_rect(&rc2));
rc2.right, rc2.bottom);
DeleteObject( rgn); DeleteObject( rgn);
DestroyWindow( child ); DestroyWindow( child );
@ -3858,8 +3837,7 @@ static void nccalchelper(HWND hwnd, INT x, INT y, RECT *prc)
GetWindowRect( hwnd, prc); GetWindowRect( hwnd, prc);
rc = *prc; rc = *prc;
DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)prc); DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)prc);
trace("window rect is %d,%d - %d,%d, nccalc rect is %d,%d - %d,%d\n", trace("window rect is %s, nccalc rect is %s\n", wine_dbgstr_rect(&rc), wine_dbgstr_rect(prc));
rc.left,rc.top,rc.right,rc.bottom, prc->left,prc->top,prc->right,prc->bottom);
} }
static void test_nccalcscroll(HWND parent) static void test_nccalcscroll(HWND parent)
@ -3875,30 +3853,28 @@ static void test_nccalcscroll(HWND parent)
/* test window too low for a horizontal scroll bar */ /* test window too low for a horizontal scroll bar */
nccalchelper( hwnd, 100, sbheight, &rc1); nccalchelper( hwnd, 100, sbheight, &rc1);
ok( rc1.bottom - rc1.top == sbheight, "Height should be %d size is %d,%d - %d,%d\n", ok( rc1.bottom - rc1.top == sbheight, "Height should be %d size is %s\n", sbheight,
sbheight, rc1.left, rc1.top, rc1.right, rc1.bottom); wine_dbgstr_rect(&rc1));
/* test window just high enough for a horizontal scroll bar */ /* test window just high enough for a horizontal scroll bar */
nccalchelper( hwnd, 100, sbheight + 1, &rc1); nccalchelper( hwnd, 100, sbheight + 1, &rc1);
ok( rc1.bottom - rc1.top == 1, "Height should be %d size is %d,%d - %d,%d\n", ok( rc1.bottom - rc1.top == 1, "Height should be 1 size is %s\n", wine_dbgstr_rect(&rc1));
1, rc1.left, rc1.top, rc1.right, rc1.bottom);
/* test window too narrow for a vertical scroll bar */ /* test window too narrow for a vertical scroll bar */
nccalchelper( hwnd, sbwidth - 1, 100, &rc1); nccalchelper( hwnd, sbwidth - 1, 100, &rc1);
ok( rc1.right - rc1.left == sbwidth - 1 , "Width should be %d size is %d,%d - %d,%d\n", ok( rc1.right - rc1.left == sbwidth - 1 , "Width should be %d size is %s\n", sbwidth - 1,
sbwidth - 1, rc1.left, rc1.top, rc1.right, rc1.bottom); wine_dbgstr_rect(&rc1));
/* test window just wide enough for a vertical scroll bar */ /* test window just wide enough for a vertical scroll bar */
nccalchelper( hwnd, sbwidth, 100, &rc1); nccalchelper( hwnd, sbwidth, 100, &rc1);
ok( rc1.right - rc1.left == 0, "Width should be %d size is %d,%d - %d,%d\n", ok( rc1.right - rc1.left == 0, "Width should be 0 size is %s\n", wine_dbgstr_rect(&rc1));
0, rc1.left, rc1.top, rc1.right, rc1.bottom);
/* same test, but with client edge: not enough width */ /* same test, but with client edge: not enough width */
SetWindowLongA( hwnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE | GetWindowLongA( hwnd, GWL_EXSTYLE)); SetWindowLongA( hwnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE | GetWindowLongA( hwnd, GWL_EXSTYLE));
nccalchelper( hwnd, sbwidth, 100, &rc1); nccalchelper( hwnd, sbwidth, 100, &rc1);
ok( rc1.right - rc1.left == sbwidth - 2 * GetSystemMetrics(SM_CXEDGE), ok( rc1.right - rc1.left == sbwidth - 2 * GetSystemMetrics(SM_CXEDGE),
"Width should be %d size is %d,%d - %d,%d\n", "Width should be %d size is %s\n", sbwidth - 2 * GetSystemMetrics(SM_CXEDGE),
sbwidth - 2 * GetSystemMetrics(SM_CXEDGE), rc1.left, rc1.top, rc1.right, rc1.bottom); wine_dbgstr_rect(&rc1));
DestroyWindow( hwnd); DestroyWindow( hwnd);
} }
@ -4251,15 +4227,65 @@ static void test_window_styles(void)
} }
} }
static HWND root_dialog(HWND hwnd)
{
while ((GetWindowLongA(hwnd, GWL_EXSTYLE) & WS_EX_CONTROLPARENT) &&
(GetWindowLongA(hwnd, GWL_STYLE) & (WS_CHILD|WS_POPUP)) == WS_CHILD)
{
HWND parent = GetParent(hwnd);
/* simple detector for a window being a dialog */
if (!DefDlgProcA(parent, DM_GETDEFID, 0, 0))
break;
hwnd = parent;
if (!(GetWindowLongA(hwnd, GWL_STYLE) & DS_CONTROL))
break;
}
return hwnd;
}
static INT_PTR WINAPI empty_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) static INT_PTR WINAPI empty_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{ {
return 0; return 0;
} }
static LRESULT expected_id;
static INT_PTR WINAPI empty_dlg_proc3(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) static INT_PTR WINAPI empty_dlg_proc3(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{ {
if (msg == WM_INITDIALOG) if (msg == WM_INITDIALOG)
{
HWND parent = GetParent(hwnd);
LRESULT id, ret;
id = DefDlgProcA(parent, DM_GETDEFID, 0, 0);
if (!id || root_dialog(hwnd) == hwnd)
parent = 0;
id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
if (!parent)
ok(id == MAKELONG(IDOK,DC_HASDEFID), "expected (IDOK,DC_HASDEFID), got %08lx\n", id);
else
ok(id == expected_id, "expected %08lx, got %08lx\n", expected_id, id);
ret = DefDlgProcA(hwnd, DM_SETDEFID, 0x3333, 0);
ok(ret, "DefDlgProc(DM_SETDEFID) failed\n");
id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
ok(id == MAKELONG(0x3333,DC_HASDEFID), "expected (0x3333,DC_HASDEFID), got %08lx\n", id);
if (parent)
{
id = DefDlgProcA(parent, DM_GETDEFID, 0, 0);
ok(id == MAKELONG(0x3333,DC_HASDEFID), "expected (0x3333,DC_HASDEFID), got %08lx\n", id);
expected_id = MAKELONG(0x3333,DC_HASDEFID);
}
EndDialog(hwnd, 0); EndDialog(hwnd, 0);
}
return 0; return 0;
} }
@ -4278,6 +4304,16 @@ static INT_PTR WINAPI empty_dlg_proc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
struct dialog_param *param = (struct dialog_param *)lparam; struct dialog_param *param = (struct dialog_param *)lparam;
BOOL parent_is_child; BOOL parent_is_child;
HWND disabled_hwnd; HWND disabled_hwnd;
LRESULT id, ret;
id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
ok(id == MAKELONG(IDOK,DC_HASDEFID), "expected (IDOK,DC_HASDEFID), got %08lx\n", id);
ret = DefDlgProcA(hwnd, DM_SETDEFID, 0x2222, 0);
ok(ret, "DefDlgProc(DM_SETDEFID) failed\n");
id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
ok(id == MAKELONG(0x2222,DC_HASDEFID), "expected (0x2222,DC_HASDEFID), got %08lx\n", id);
expected_id = MAKELONG(0x2222,DC_HASDEFID);
parent_is_child = (GetWindowLongA(param->parent, GWL_STYLE) & (WS_POPUP | WS_CHILD)) == WS_CHILD; parent_is_child = (GetWindowLongA(param->parent, GWL_STYLE) & (WS_POPUP | WS_CHILD)) == WS_CHILD;
@ -4319,6 +4355,25 @@ static INT_PTR WINAPI empty_dlg_proc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM
DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0); DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0);
ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style); ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
param->dlg_data->style |= DS_CONTROL;
DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0);
ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
param->dlg_data->dwExtendedStyle |= WS_EX_CONTROLPARENT;
SetWindowLongA(hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_CONTROLPARENT);
SetWindowLongA(hwnd, GWL_STYLE, style & ~DS_CONTROL);
param->dlg_data->style &= ~DS_CONTROL;
DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0);
ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
SetWindowLongA(hwnd, GWL_STYLE, style | DS_CONTROL);
DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0);
ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
param->dlg_data->style |= DS_CONTROL;
DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, hwnd, empty_dlg_proc3, 0);
ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
EndDialog(hwnd, 0); EndDialog(hwnd, 0);
} }
return 0; return 0;
@ -4337,6 +4392,7 @@ static void check_dialog_style(DWORD style_in, DWORD ex_style_in, DWORD style_ou
DWORD style, ex_style; DWORD style, ex_style;
HWND hwnd, grand_parent = 0, parent = 0; HWND hwnd, grand_parent = 0, parent = 0;
struct dialog_param param; struct dialog_param param;
LRESULT id, ret;
if (style_in & WS_CHILD) if (style_in & WS_CHILD)
{ {
@ -4364,6 +4420,13 @@ static void check_dialog_style(DWORD style_in, DWORD ex_style_in, DWORD style_ou
hwnd = CreateDialogIndirectParamA(GetModuleHandleA(NULL), &dlg_data.dt, parent, empty_dlg_proc, 0); hwnd = CreateDialogIndirectParamA(GetModuleHandleA(NULL), &dlg_data.dt, parent, empty_dlg_proc, 0);
ok(hwnd != 0, "dialog creation failed, style %#x, exstyle %#x\n", style_in, ex_style_in); ok(hwnd != 0, "dialog creation failed, style %#x, exstyle %#x\n", style_in, ex_style_in);
id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
ok(id == MAKELONG(IDOK,DC_HASDEFID), "expected (IDOK,DC_HASDEFID), got %08lx\n", id);
ret = DefDlgProcA(hwnd, DM_SETDEFID, 0x1111, 0);
ok(ret, "DefDlgProc(DM_SETDEFID) failed\n");
id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
ok(id == MAKELONG(0x1111,DC_HASDEFID), "expected (0x1111,DC_HASDEFID), got %08lx\n", id);
flush_events( TRUE ); flush_events( TRUE );
style = GetWindowLongA(hwnd, GWL_STYLE); style = GetWindowLongA(hwnd, GWL_STYLE);
@ -4824,8 +4887,7 @@ static void test_scrollvalidate( HWND parent)
SetRectRgn( tmprgn, 0,93,98,98); SetRectRgn( tmprgn, 0,93,98,98);
CombineRgn( exprgn, exprgn, tmprgn, RGN_OR); CombineRgn( exprgn, exprgn, tmprgn, RGN_OR);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n"); ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
trace("update rect is %d,%d - %d,%d\n", trace("update rect is %s\n", wine_dbgstr_rect(&rcu));
rcu.left,rcu.top,rcu.right,rcu.bottom);
/* now with clipping region */ /* now with clipping region */
SelectClipRgn( hdc, clipping); SelectClipRgn( hdc, clipping);
ScrollDC( hdc, -10, -5, &rc, &cliprc, hrgn, &rcu); ScrollDC( hdc, -10, -5, &rc, &cliprc, hrgn, &rcu);
@ -4837,8 +4899,7 @@ static void test_scrollvalidate( HWND parent)
SetRectRgn( tmprgn, 10,85,90,90); SetRectRgn( tmprgn, 10,85,90,90);
CombineRgn( exprgn, exprgn, tmprgn, RGN_OR); CombineRgn( exprgn, exprgn, tmprgn, RGN_OR);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n"); ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
trace("update rect is %d,%d - %d,%d\n", trace("update rect is %s\n", wine_dbgstr_rect(&rcu));
rcu.left,rcu.top,rcu.right,rcu.bottom);
ReleaseDC( hwnd1, hdc); ReleaseDC( hwnd1, hdc);
/* test scrolling a rect by more than its size */ /* test scrolling a rect by more than its size */
@ -4854,7 +4915,7 @@ static void test_scrollvalidate( HWND parent)
CombineRgn( exprgn, exprgn, tmprgn, RGN_OR); CombineRgn( exprgn, exprgn, tmprgn, RGN_OR);
ok( EqualRgn( exprgn, hrgn), "wrong update region\n"); ok( EqualRgn( exprgn, hrgn), "wrong update region\n");
ok( rcu.left == 20 && rcu.top == 40 && rcu.right == 50 && rcu.bottom == 50, ok( rcu.left == 20 && rcu.top == 40 && rcu.right == 50 && rcu.bottom == 50,
"unexpected update rect: %d,%d - %d,%d\n", rcu.left,rcu.top,rcu.right,rcu.bottom); "unexpected update rect: %s\n", wine_dbgstr_rect(&rcu));
/* test scrolling a window with an update region */ /* test scrolling a window with an update region */
ValidateRect( hwnd1, NULL); ValidateRect( hwnd1, NULL);
@ -5021,12 +5082,11 @@ static void test_scrolldc( HWND parent)
/* test with NULL clip rect */ /* test with NULL clip rect */
ScrollDC( hdc, 20, -20, &rc, NULL, hrgn, &rcu); ScrollDC( hdc, 20, -20, &rc, NULL, hrgn, &rcu);
/*FillRgn(hdc, hrgn, GetStockObject(WHITE_BRUSH));*/ /*FillRgn(hdc, hrgn, GetStockObject(WHITE_BRUSH));*/
trace("update rect: %d,%d - %d,%d\n", trace("update rect: %s\n", wine_dbgstr_rect(&rcu));
rcu.left, rcu.top, rcu.right, rcu.bottom);
if (winetest_debug > 0) dump_region(hrgn); if (winetest_debug > 0) dump_region(hrgn);
SetRect(&rc2, 0, 0, 100, 100); SetRect(&rc2, 0, 0, 100, 100);
ok(EqualRect(&rcu, &rc2), "rects do not match (%d,%d-%d,%d) / (%d,%d-%d,%d)\n", ok(EqualRect(&rcu, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rcu),
rcu.left, rcu.top, rcu.right, rcu.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom); wine_dbgstr_rect(&rc2));
SetRectRgn( exprgn, 0, 0, 20, 80); SetRectRgn( exprgn, 0, 0, 20, 80);
SetRectRgn( tmprgn, 0, 80, 100, 100); SetRectRgn( tmprgn, 0, 80, 100, 100);
@ -5043,8 +5103,7 @@ static void test_scrolldc( HWND parent)
SetRectRgn( tmprgn, 25, 35, 35, 75); SetRectRgn( tmprgn, 25, 35, 35, 75);
CombineRgn(exprgn, exprgn, tmprgn, RGN_OR); CombineRgn(exprgn, exprgn, tmprgn, RGN_OR);
ok(EqualRgn(exprgn, hrgn), "wrong update region\n"); ok(EqualRgn(exprgn, hrgn), "wrong update region\n");
trace("update rect: %d,%d - %d,%d\n", trace("update rect: %s\n", wine_dbgstr_rect(&rcu));
rcu.left, rcu.top, rcu.right, rcu.bottom);
if (winetest_debug > 0) dump_region(hrgn); if (winetest_debug > 0) dump_region(hrgn);
/* clean up */ /* clean up */
@ -5186,9 +5245,8 @@ static void test_AWR_flags(void)
rect2 = rect; rect2 = rect;
AdjustWindowRectEx( &rect, style, FALSE, exstyle ); AdjustWindowRectEx( &rect, style, FALSE, exstyle );
wine_AdjustWindowRectEx( &rect2, style, FALSE, exstyle ); wine_AdjustWindowRectEx( &rect2, style, FALSE, exstyle );
ok( EqualRect( &rect, &rect2 ), "rects do not match: win %d,%d-%d,%d wine %d,%d-%d,%d\n", ok( EqualRect( &rect, &rect2 ), "rects do not match: win %s wine %s\n",
rect.left, rect.top, rect.right, rect.bottom, wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &rect2 ));
rect2.left, rect2.top, rect2.right, rect2.bottom );
} }
} }
} }
@ -5306,18 +5364,16 @@ static LRESULT WINAPI parentdc_window_procA(HWND hwnd, UINT msg, WPARAM wparam,
{ {
case WM_PAINT: case WM_PAINT:
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
CopyRect(&t->client, &rc); t->client = rc;
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("WM_PAINT: hwnd %p, client rect (%d,%d)-(%d,%d), window rect (%d,%d)-(%d,%d)\n", hwnd, trace("WM_PAINT: hwnd %p, client rect %s, window rect %s\n", hwnd,
t->client.left, t->client.top, t->client.right, t->client.bottom, wine_dbgstr_rect(&t->client), wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
BeginPaint(hwnd, &ps); BeginPaint(hwnd, &ps);
CopyRect(&t->paint, &ps.rcPaint); t->paint = ps.rcPaint;
GetClipBox(ps.hdc, &rc); GetClipBox(ps.hdc, &rc);
CopyRect(&t->clip, &rc); t->clip = rc;
trace("clip rect (%d,%d)-(%d,%d), paint rect (%d,%d)-(%d,%d)\n", trace("clip rect %s, paint rect %s\n", wine_dbgstr_rect(&rc),
rc.left, rc.top, rc.right, rc.bottom, wine_dbgstr_rect(&ps.rcPaint));
ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
EndPaint(hwnd, &ps); EndPaint(hwnd, &ps);
return 0; return 0;
} }
@ -5684,8 +5740,8 @@ static LRESULT CALLBACK winsizes_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM
{ {
RECT rect; RECT rect;
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
ok( !rect.left && !rect.top && !rect.right && !rect.bottom, ok( !rect.left && !rect.top && !rect.right && !rect.bottom, "wrong rect %s\n",
"wrong rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); wine_dbgstr_rect( &rect ));
return DefWindowProcA(hwnd, msg, wp, lp); return DefWindowProcA(hwnd, msg, wp, lp);
} }
case WM_NCCREATE: case WM_NCCREATE:
@ -5694,8 +5750,8 @@ static LRESULT CALLBACK winsizes_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM
CREATESTRUCTA *cs = (CREATESTRUCTA *)lp; CREATESTRUCTA *cs = (CREATESTRUCTA *)lp;
RECT rect; RECT rect;
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
trace( "hwnd %p msg %x size %dx%d rect %d,%d-%d,%d\n", trace( "hwnd %p msg %x size %dx%d rect %s\n", hwnd, msg, cs->cx, cs->cy,
hwnd, msg, cs->cx, cs->cy, rect.left, rect.top, rect.right, rect.bottom ); wine_dbgstr_rect( &rect ));
ok( cs->cx == expected_cx || broken(cs->cx == (short)expected_cx), ok( cs->cx == expected_cx || broken(cs->cx == (short)expected_cx),
"wrong x size %d/%d\n", cs->cx, expected_cx ); "wrong x size %d/%d\n", cs->cx, expected_cx );
ok( cs->cy == expected_cy || broken(cs->cy == (short)expected_cy), ok( cs->cy == expected_cy || broken(cs->cy == (short)expected_cy),
@ -5708,18 +5764,15 @@ static LRESULT CALLBACK winsizes_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM
rect.bottom - rect.top == broken_rect.bottom - broken_rect.top) || rect.bottom - rect.top == broken_rect.bottom - broken_rect.top) ||
broken( rect.right - rect.left == (short)broken_rect.right - (short)broken_rect.left && broken( rect.right - rect.left == (short)broken_rect.right - (short)broken_rect.left &&
rect.bottom - rect.top == (short)broken_rect.bottom - (short)broken_rect.top), rect.bottom - rect.top == (short)broken_rect.bottom - (short)broken_rect.top),
"wrong rect %d,%d-%d,%d / %d,%d-%d,%d\n", "wrong rect %s / %s\n", wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &expected_rect ));
rect.left, rect.top, rect.right, rect.bottom,
expected_rect.left, expected_rect.top, expected_rect.right, expected_rect.bottom );
return DefWindowProcA(hwnd, msg, wp, lp); return DefWindowProcA(hwnd, msg, wp, lp);
} }
case WM_NCCALCSIZE: case WM_NCCALCSIZE:
{ {
RECT rect, *r = (RECT *)lp; RECT rect, *r = (RECT *)lp;
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
ok( !memcmp( &rect, r, sizeof(rect) ), ok( EqualRect( &rect, r ), "passed rect %s doesn't match window rect %s\n",
"passed rect %d,%d-%d,%d doesn't match window rect %d,%d-%d,%d\n", wine_dbgstr_rect( r ), wine_dbgstr_rect( &rect ));
r->left, r->top, r->right, r->bottom, rect.left, rect.top, rect.right, rect.bottom );
return DefWindowProcA(hwnd, msg, wp, lp); return DefWindowProcA(hwnd, msg, wp, lp);
} }
default: default:
@ -5976,7 +6029,7 @@ static void test_CreateWindow(void)
ok(!IsRectEmpty(&rc), "parent client rect is empty\n"); ok(!IsRectEmpty(&rc), "parent client rect is empty\n");
InflateRect(&rc, 200, 200); InflateRect(&rc, 200, 200);
trace("creating child with rect (%d,%d-%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); trace("creating child with rect %s\n", wine_dbgstr_rect(&rc));
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
hwnd = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, hwnd = CreateWindowExA(0, "MinMax_WndClass", NULL, WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME,
@ -5993,9 +6046,8 @@ static void test_CreateWindow(void)
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
OffsetRect(&rc, -rc.left, -rc.top); OffsetRect(&rc, -rc.left, -rc.top);
ok(EqualRect(&rc, &rc_minmax), "rects don't match: (%d,%d-%d,%d) and (%d,%d-%d,%d)\n", ok(EqualRect(&rc, &rc_minmax), "rects don't match: %s and %s\n", wine_dbgstr_rect(&rc),
rc.left, rc.top, rc.right, rc.bottom, wine_dbgstr_rect(&rc_minmax));
rc_minmax.left, rc_minmax.top, rc_minmax.right, rc_minmax.bottom);
DestroyWindow(hwnd); DestroyWindow(hwnd);
cls.lpfnWndProc = winsizes_wnd_proc; cls.lpfnWndProc = winsizes_wnd_proc;
@ -6229,9 +6281,8 @@ static void test_ShowWindow(void)
ok(!(style & WS_MINIMIZE), "window should not be minimized\n"); ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ok(!(style & WS_MAXIMIZE), "window should not be maximized\n"); ok(!(style & WS_MAXIMIZE), "window should not be maximized\n");
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain),
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
ret = ShowWindow(hwnd, SW_SHOW); ret = ShowWindow(hwnd, SW_SHOW);
ok(!ret, "not expected ret: %lu\n", ret); ok(!ret, "not expected ret: %lu\n", ret);
@ -6241,9 +6292,8 @@ static void test_ShowWindow(void)
ok(!(style & WS_MINIMIZE), "window should not be minimized\n"); ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ok(!(style & WS_MAXIMIZE), "window should not be maximized\n"); ok(!(style & WS_MAXIMIZE), "window should not be maximized\n");
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain),
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
ret = ShowWindow(hwnd, SW_MINIMIZE); ret = ShowWindow(hwnd, SW_MINIMIZE);
ok(ret, "not expected ret: %lu\n", ret); ok(ret, "not expected ret: %lu\n", ret);
@ -6271,9 +6321,8 @@ static void test_ShowWindow(void)
ok(!(style & WS_MINIMIZE), "window should not be minimized\n"); ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ok(!(style & WS_MAXIMIZE), "window should not be maximized\n"); ok(!(style & WS_MAXIMIZE), "window should not be maximized\n");
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain),
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
ret = EnableWindow(hwnd, FALSE); ret = EnableWindow(hwnd, FALSE);
ok(!ret, "not expected ret: %lu\n", ret); ok(!ret, "not expected ret: %lu\n", ret);
@ -6288,9 +6337,8 @@ static void test_ShowWindow(void)
ok(!(style & WS_MINIMIZE), "window should not be minimized\n"); ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ok(!(style & WS_MAXIMIZE), "window should not be maximized\n"); ok(!(style & WS_MAXIMIZE), "window should not be maximized\n");
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain),
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
ok(!ret, "not expected ret: %lu\n", ret); ok(!ret, "not expected ret: %lu\n", ret);
@ -6300,9 +6348,8 @@ static void test_ShowWindow(void)
ok(!(style & WS_MINIMIZE), "window should not be minimized\n"); ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ok(!(style & WS_MAXIMIZE), "window should not be maximized\n"); ok(!(style & WS_MAXIMIZE), "window should not be maximized\n");
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain),
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
ret = ShowWindow(hwnd, SW_MINIMIZE); ret = ShowWindow(hwnd, SW_MINIMIZE);
ok(ret, "not expected ret: %lu\n", ret); ok(ret, "not expected ret: %lu\n", ret);
@ -6332,9 +6379,8 @@ static void test_ShowWindow(void)
ok(!(style & WS_MINIMIZE), "window should not be minimized\n"); ok(!(style & WS_MINIMIZE), "window should not be minimized\n");
ok(!(style & WS_MAXIMIZE), "window should not be maximized\n"); ok(!(style & WS_MAXIMIZE), "window should not be maximized\n");
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain),
rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0); ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0);
ok(!ret, "not expected ret: %lu\n", ret); ok(!ret, "not expected ret: %lu\n", ret);
@ -6580,16 +6626,14 @@ static void test_GetUpdateRect(void)
SetRectEmpty(&rc2); SetRectEmpty(&rc2);
ret = GetUpdateRect(hgrandparent, &rc1, FALSE); ret = GetUpdateRect(hgrandparent, &rc1, FALSE);
ok(!ret, "GetUpdateRect returned not empty region\n"); ok(!ret, "GetUpdateRect returned not empty region\n");
ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
rc1.left, rc1.top, rc1.right, rc1.bottom, wine_dbgstr_rect(&rc2));
rc2.left, rc2.top, rc2.right, rc2.bottom);
SetRect(&rc2, 10, 10, 40, 40); SetRect(&rc2, 10, 10, 40, 40);
ret = GetUpdateRect(hparent, &rc1, FALSE); ret = GetUpdateRect(hparent, &rc1, FALSE);
ok(ret, "GetUpdateRect returned empty region\n"); ok(ret, "GetUpdateRect returned empty region\n");
ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
rc1.left, rc1.top, rc1.right, rc1.bottom, wine_dbgstr_rect(&rc2));
rc2.left, rc2.top, rc2.right, rc2.bottom);
parent_wm_paint = FALSE; parent_wm_paint = FALSE;
grandparent_wm_paint = FALSE; grandparent_wm_paint = FALSE;
@ -6644,16 +6688,14 @@ static void test_GetUpdateRect(void)
SetRectEmpty(&rc2); SetRectEmpty(&rc2);
ret = GetUpdateRect(hgrandparent, &rc1, FALSE); ret = GetUpdateRect(hgrandparent, &rc1, FALSE);
ok(!ret, "GetUpdateRect returned not empty region\n"); ok(!ret, "GetUpdateRect returned not empty region\n");
ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
rc1.left, rc1.top, rc1.right, rc1.bottom, wine_dbgstr_rect(&rc2));
rc2.left, rc2.top, rc2.right, rc2.bottom);
SetRect(&rc2, 10, 10, 40, 40); SetRect(&rc2, 10, 10, 40, 40);
ret = GetUpdateRect(hparent, &rc1, FALSE); ret = GetUpdateRect(hparent, &rc1, FALSE);
ok(ret, "GetUpdateRect returned empty region\n"); ok(ret, "GetUpdateRect returned empty region\n");
ok(EqualRect(&rc1, &rc2), "rects do not match (%d,%d,%d,%d) / (%d,%d,%d,%d)\n", ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
rc1.left, rc1.top, rc1.right, rc1.bottom, wine_dbgstr_rect(&rc2));
rc2.left, rc2.top, rc2.right, rc2.bottom);
parent_wm_paint = FALSE; parent_wm_paint = FALSE;
grandparent_wm_paint = FALSE; grandparent_wm_paint = FALSE;
@ -6926,11 +6968,11 @@ static void test_hwnd_message(void)
ok( !lstrcmpiA( buffer, "Message" ), "wrong parent class '%s'\n", buffer ); ok( !lstrcmpiA( buffer, "Message" ), "wrong parent class '%s'\n", buffer );
GetWindowRect( parent, &rect ); GetWindowRect( parent, &rect );
ok( rect.left == 0 && rect.right == 100 && rect.top == 0 && rect.bottom == 100, ok( rect.left == 0 && rect.right == 100 && rect.top == 0 && rect.bottom == 100,
"wrong parent rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "wrong parent rect %s\n", wine_dbgstr_rect( &rect ));
} }
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
ok( rect.left == 100 && rect.right == 300 && rect.top == 100 && rect.bottom == 300, ok( rect.left == 100 && rect.right == 300 && rect.top == 100 && rect.bottom == 300,
"wrong window rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); "wrong window rect %s\n", wine_dbgstr_rect( &rect ));
/* test FindWindow behavior */ /* test FindWindow behavior */
@ -7124,8 +7166,7 @@ static LRESULT CALLBACK fullscreen_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPAR
CREATESTRUCTA *cs = (CREATESTRUCTA *)lp; CREATESTRUCTA *cs = (CREATESTRUCTA *)lp;
ok(cs->x == mi.rcMonitor.left && cs->y == mi.rcMonitor.top && ok(cs->x == mi.rcMonitor.left && cs->y == mi.rcMonitor.top &&
cs->cx == mi.rcMonitor.right && cs->cy == mi.rcMonitor.bottom, cs->cx == mi.rcMonitor.right && cs->cy == mi.rcMonitor.bottom,
"expected %d,%d-%d,%d, got %d,%d-%d,%d\n", "expected %s, got (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&mi.rcMonitor),
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
cs->x, cs->y, cs->cx, cs->cy); cs->x, cs->y, cs->cx, cs->cy);
break; break;
} }
@ -7173,9 +7214,7 @@ static void test_fullscreen(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = pGetMonitorInfoA(hmon, &mi); ret = pGetMonitorInfoA(hmon, &mi);
ok(ret, "GetMonitorInfo error %u\n", GetLastError()); ok(ret, "GetMonitorInfo error %u\n", GetLastError());
trace("monitor (%d,%d-%d,%d), work (%d,%d-%d,%d)\n", trace("monitor %s, work %s\n", wine_dbgstr_rect(&mi.rcMonitor), wine_dbgstr_rect(&mi.rcWork));
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom,
mi.rcWork.left, mi.rcWork.top, mi.rcWork.right, mi.rcWork.bottom);
cls.style = 0; cls.style = 0;
cls.lpfnWndProc = fullscreen_wnd_proc; cls.lpfnWndProc = fullscreen_wnd_proc;
@ -7208,10 +7247,10 @@ static void test_fullscreen(void)
GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); trace("%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top && ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom, rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
"%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); "%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
DestroyWindow(hwnd); DestroyWindow(hwnd);
style = t_style[i] | WS_MAXIMIZE; style = t_style[i] | WS_MAXIMIZE;
@ -7220,10 +7259,10 @@ static void test_fullscreen(void)
GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); trace("%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top && ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom, rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
"%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); "%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
DestroyWindow(hwnd); DestroyWindow(hwnd);
style = t_style[i] | WS_MAXIMIZE | WS_CAPTION; style = t_style[i] | WS_MAXIMIZE | WS_CAPTION;
@ -7232,10 +7271,10 @@ static void test_fullscreen(void)
GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); trace("%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top && ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom, rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
"%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); "%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
DestroyWindow(hwnd); DestroyWindow(hwnd);
style = t_style[i] | WS_CAPTION | WS_MAXIMIZEBOX; style = t_style[i] | WS_CAPTION | WS_MAXIMIZEBOX;
@ -7244,10 +7283,10 @@ static void test_fullscreen(void)
GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); trace("%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top && ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom, rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
"%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); "%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
DestroyWindow(hwnd); DestroyWindow(hwnd);
style = t_style[i] | WS_MAXIMIZE | WS_CAPTION | WS_MAXIMIZEBOX; style = t_style[i] | WS_MAXIMIZE | WS_CAPTION | WS_MAXIMIZEBOX;
@ -7256,15 +7295,14 @@ static void test_fullscreen(void)
GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); trace("%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
/* Windows makes a maximized window slightly larger (to hide the borders?) */ /* Windows makes a maximized window slightly larger (to hide the borders?) */
fixup = min(abs(rc.left), abs(rc.top)); fixup = min(abs(rc.left), abs(rc.top));
InflateRect(&rc, -fixup, -fixup); InflateRect(&rc, -fixup, -fixup);
ok(rc.left >= mi.rcMonitor.left && rc.top >= mi.rcMonitor.top && ok(rc.left >= mi.rcMonitor.left && rc.top >= mi.rcMonitor.top &&
rc.right <= mi.rcMonitor.right && rc.bottom <= mi.rcMonitor.bottom, rc.right <= mi.rcMonitor.right && rc.bottom <= mi.rcMonitor.bottom,
"%#x/%#x: window rect %d,%d-%d,%d must be in %d,%d-%d,%d\n", "%#x/%#x: window rect %s must be in %s\n", ex_style, style, wine_dbgstr_rect(&rc),
ex_style, style, rc.left, rc.top, rc.right, rc.bottom, wine_dbgstr_rect(&mi.rcMonitor));
mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom);
DestroyWindow(hwnd); DestroyWindow(hwnd);
style = t_style[i] | WS_MAXIMIZE | WS_MAXIMIZEBOX; style = t_style[i] | WS_MAXIMIZE | WS_MAXIMIZEBOX;
@ -7273,18 +7311,18 @@ static void test_fullscreen(void)
GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL);
ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style);
GetWindowRect(hwnd, &rc); GetWindowRect(hwnd, &rc);
trace("%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); trace("%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
/* Windows makes a maximized window slightly larger (to hide the borders?) */ /* Windows makes a maximized window slightly larger (to hide the borders?) */
fixup = min(abs(rc.left), abs(rc.top)); fixup = min(abs(rc.left), abs(rc.top));
InflateRect(&rc, -fixup, -fixup); InflateRect(&rc, -fixup, -fixup);
if (style & (WS_CHILD | WS_POPUP)) if (style & (WS_CHILD | WS_POPUP))
ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top && ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top &&
rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom, rc.right >= mi.rcMonitor.right && rc.bottom >= mi.rcMonitor.bottom,
"%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); "%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
else else
ok(rc.left >= mi.rcMonitor.left && rc.top >= mi.rcMonitor.top && ok(rc.left >= mi.rcMonitor.left && rc.top >= mi.rcMonitor.top &&
rc.right <= mi.rcMonitor.right && rc.bottom <= mi.rcMonitor.bottom, rc.right <= mi.rcMonitor.right && rc.bottom <= mi.rcMonitor.bottom,
"%#x/%#x: window rect %d,%d-%d,%d\n", ex_style, style, rc.left, rc.top, rc.right, rc.bottom); "%#x/%#x: window rect %s\n", ex_style, style, wine_dbgstr_rect(&rc));
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
} }
@ -7594,8 +7632,7 @@ static void test_winregion(void)
ret = pGetWindowRgnBox(hwnd, &r); ret = pGetWindowRgnBox(hwnd, &r);
ok( ret == SIMPLEREGION, "Expected SIMPLEREGION, got %d\n", ret); ok( ret == SIMPLEREGION, "Expected SIMPLEREGION, got %d\n", ret);
ok( r.left == 2 && r.top == 3 && r.right == 10 && r.bottom == 15, ok( r.left == 2 && r.top == 3 && r.right == 10 && r.bottom == 15,
"Expected (2,3,10,15), got (%d,%d,%d,%d)\n", r.left, r.top, "Expected (2,3)-(10,15), got %s\n", wine_dbgstr_rect( &r ));
r.right, r.bottom);
if (pMirrorRgn) if (pMirrorRgn)
{ {
hrgn = CreateRectRgn(2, 3, 10, 15); hrgn = CreateRectRgn(2, 3, 10, 15);
@ -7608,7 +7645,7 @@ static void test_winregion(void)
ret = GetRgnBox( hrgn, &r ); ret = GetRgnBox( hrgn, &r );
ok( ret == SIMPLEREGION, "GetRgnBox failed %u\n", ret ); ok( ret == SIMPLEREGION, "GetRgnBox failed %u\n", ret );
ok( r.left == width - 10 && r.top == 3 && r.right == width - 2 && r.bottom == 15, ok( r.left == width - 10 && r.top == 3 && r.right == width - 2 && r.bottom == 15,
"Wrong rectangle (%d,%d,%d,%d) for width %d\n", r.left, r.top, r.right, r.bottom, width ); "Wrong rectangle %s for width %d\n", wine_dbgstr_rect( &r ), width );
} }
else win_skip( "MirrorRgn not supported\n" ); else win_skip( "MirrorRgn not supported\n" );
} }
@ -7631,44 +7668,44 @@ static void test_rtl_layout(void)
child = CreateWindowExA(0, "static", NULL, WS_CHILD, 10, 10, 20, 20, parent, 0, 0, NULL); child = CreateWindowExA(0, "static", NULL, WS_CHILD, 10, 10, 20, 20, parent, 0, 0, NULL);
GetWindowRect( parent, &r ); GetWindowRect( parent, &r );
ok( r.left == 100 && r.right == 400, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 100 && r.right == 400, "wrong rect %s\n", wine_dbgstr_rect( &r ));
GetClientRect( parent, &r ); GetClientRect( parent, &r );
ok( r.left == 0 && r.right == 300, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 0 && r.right == 300, "wrong rect %s\n", wine_dbgstr_rect( &r ));
GetClientRect( child, &r ); GetClientRect( child, &r );
ok( r.left == 0 && r.right == 20, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 0 && r.right == 20, "wrong rect %s\n", wine_dbgstr_rect( &r ));
MapWindowPoints( child, parent, (POINT *)&r, 2 ); MapWindowPoints( child, parent, (POINT *)&r, 2 );
ok( r.left == 10 && r.right == 30, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 10 && r.right == 30, "wrong rect %s\n", wine_dbgstr_rect( &r ));
GetWindowRect( child, &r ); GetWindowRect( child, &r );
ok( r.left == 370 && r.right == 390, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 370 && r.right == 390, "wrong rect %s\n", wine_dbgstr_rect( &r ));
MapWindowPoints( NULL, parent, (POINT *)&r, 2 ); MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
ok( r.left == 10 && r.right == 30, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 10 && r.right == 30, "wrong rect %s\n", wine_dbgstr_rect( &r ));
GetWindowRect( child, &r ); GetWindowRect( child, &r );
MapWindowPoints( NULL, parent, (POINT *)&r, 1 ); MapWindowPoints( NULL, parent, (POINT *)&r, 1 );
MapWindowPoints( NULL, parent, (POINT *)&r + 1, 1 ); MapWindowPoints( NULL, parent, (POINT *)&r + 1, 1 );
ok( r.left == 30 && r.right == 10, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 30 && r.right == 10, "wrong rect %s\n", wine_dbgstr_rect( &r ));
pt.x = pt.y = 12; pt.x = pt.y = 12;
MapWindowPoints( child, parent, &pt, 1 ); MapWindowPoints( child, parent, &pt, 1 );
ok( pt.x == 22 && pt.y == 22, "wrong point %d,%d\n", pt.x, pt.y ); ok( pt.x == 22 && pt.y == 22, "wrong point %d,%d\n", pt.x, pt.y );
SetWindowPos( parent, 0, 0, 0, 250, 250, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE ); SetWindowPos( parent, 0, 0, 0, 250, 250, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
GetWindowRect( parent, &r ); GetWindowRect( parent, &r );
ok( r.left == 100 && r.right == 350, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 100 && r.right == 350, "wrong rect %s\n", wine_dbgstr_rect( &r ));
GetWindowRect( child, &r ); GetWindowRect( child, &r );
ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 320 && r.right == 340, "wrong rect %s\n", wine_dbgstr_rect( &r ));
SetWindowLongW( parent, GWL_EXSTYLE, 0 ); SetWindowLongW( parent, GWL_EXSTYLE, 0 );
GetWindowRect( child, &r ); GetWindowRect( child, &r );
ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 320 && r.right == 340, "wrong rect %s\n", wine_dbgstr_rect( &r ));
MapWindowPoints( NULL, parent, (POINT *)&r, 2 ); MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
ok( r.left == 220 && r.right == 240, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 220 && r.right == 240, "wrong rect %s\n", wine_dbgstr_rect( &r ));
SetWindowLongW( parent, GWL_EXSTYLE, WS_EX_LAYOUTRTL ); SetWindowLongW( parent, GWL_EXSTYLE, WS_EX_LAYOUTRTL );
GetWindowRect( child, &r ); GetWindowRect( child, &r );
ok( r.left == 320 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 320 && r.right == 340, "wrong rect %s\n", wine_dbgstr_rect( &r ));
MapWindowPoints( NULL, parent, (POINT *)&r, 2 ); MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
ok( r.left == 10 && r.right == 30, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 10 && r.right == 30, "wrong rect %s\n", wine_dbgstr_rect( &r ));
SetWindowPos( child, 0, 0, 0, 30, 30, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE ); SetWindowPos( child, 0, 0, 0, 30, 30, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE );
GetWindowRect( child, &r ); GetWindowRect( child, &r );
ok( r.left == 310 && r.right == 340, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 310 && r.right == 340, "wrong rect %s\n", wine_dbgstr_rect( &r ));
MapWindowPoints( NULL, parent, (POINT *)&r, 2 ); MapWindowPoints( NULL, parent, (POINT *)&r, 2 );
ok( r.left == 10 && r.right == 40, "wrong rect %d,%d - %d,%d\n", r.left, r.top, r.right, r.bottom ); ok( r.left == 10 && r.right == 40, "wrong rect %s\n", wine_dbgstr_rect( &r ));
DestroyWindow( child ); DestroyWindow( child );
DestroyWindow( parent ); DestroyWindow( parent );
} }