From 2e9c3e57e467de289e0778ff3914311f6feed5f3 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 18 Jul 2016 15:48:27 +0000 Subject: [PATCH] [USER32_WINETEST] Sync with Wine Staging 1.9.14. svn path=/trunk/; revision=71963 --- rostests/winetests/user32/cursoricon.c | 2 + rostests/winetests/user32/dce.c | 54 +- rostests/winetests/user32/edit.c | 10 +- rostests/winetests/user32/listbox.c | 12 +- rostests/winetests/user32/menu.c | 26 +- rostests/winetests/user32/monitor.c | 34 +- rostests/winetests/user32/msg.c | 730 ++++++++++++++++++++++--- rostests/winetests/user32/scroll.c | 21 +- rostests/winetests/user32/static.c | 3 - rostests/winetests/user32/text.c | 242 ++++---- rostests/winetests/user32/uitools.c | 113 +++- rostests/winetests/user32/win.c | 405 +++++++------- 12 files changed, 1180 insertions(+), 472 deletions(-) diff --git a/rostests/winetests/user32/cursoricon.c b/rostests/winetests/user32/cursoricon.c index 5138c5617e1..5f2306aee4f 100644 --- a/rostests/winetests/user32/cursoricon.c +++ b/rostests/winetests/user32/cursoricon.c @@ -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); ok(ret && bytes_written == icon_size, "icon.ico created improperly.\n"); CloseHandle(file); + + HeapFree(GetProcessHeap(), 0, buf); } static void test_LoadImage(void) diff --git a/rostests/winetests/user32/dce.c b/rostests/winetests/user32/dce.c index dfd58a5d295..0ee1283ef47 100755 --- a/rostests/winetests/user32/dce.c +++ b/rostests/winetests/user32/dce.c @@ -201,7 +201,7 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); ReleaseDC( hwnd_cache, hdc ); ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" ); @@ -215,7 +215,7 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); ReleaseDC( hwnd_cache, hdc ); ok( GetRgnBox( hrgn, &rect ) == ERROR, "region must no longer be valid\n" ); @@ -223,7 +223,7 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); /* window DC */ @@ -235,19 +235,19 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); ReleaseDC( hwnd_owndc, hdc ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); ReleaseDC( hwnd_owndc, hdc ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); @@ -260,7 +260,7 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); ReleaseDC( hwnd_owndc, hdc ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); @@ -269,7 +269,7 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); /* class DC */ @@ -281,20 +281,20 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); ReleaseDC( hwnd_classdc, hdc ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); ReleaseDC( hwnd_classdc, hdc ); ok( GetRgnBox( hrgn, &rect ) != ERROR, "region must still be valid\n" ); @@ -307,7 +307,7 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); old_hdc = hdc; @@ -317,13 +317,13 @@ static void test_dc_visrgn(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); hdc = GetDCEx( hwnd_classdc2, 0, DCX_EXCLUDERGN | DCX_USESTYLE ); ok( GetRgnBox( hrgn2, &rect ) != ERROR, "region2 must still be valid\n" ); 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 ); /* parent DC */ @@ -360,7 +360,7 @@ static void test_begin_paint(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); /* window DC */ @@ -372,22 +372,22 @@ static void test_begin_paint(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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" ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); SetRect( &rect, 10, 10, 20, 20 ); RedrawWindow( hwnd_owndc, &rect, 0, RDW_INVALIDATE|RDW_ERASE ); @@ -395,12 +395,12 @@ static void test_begin_paint(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 */ @@ -411,7 +411,7 @@ static void test_begin_paint(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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; hdc = GetDC( hwnd_classdc2 ); @@ -419,7 +419,7 @@ static void test_begin_paint(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); EndPaint( hwnd_classdc, &ps ); @@ -459,7 +459,7 @@ static void test_scroll_window(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); SetViewportExtEx( hdc, 2, 3, NULL ); @@ -470,7 +470,7 @@ static void test_scroll_window(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); 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 ); GetClipBox( hdc, &rect ); 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 ); SetViewportExtEx( hdc, 1, 1, NULL ); @@ -489,7 +489,7 @@ static void test_scroll_window(void) SetRectEmpty( &rect ); GetClipBox( hdc, &rect ); 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 ); } diff --git a/rostests/winetests/user32/edit.c b/rostests/winetests/user32/edit.c index 8f92ff8b953..e725590aedd 100755 --- a/rostests/winetests/user32/edit.c +++ b/rostests/winetests/user32/edit.c @@ -1284,8 +1284,7 @@ static void test_edit_control_5(void) assert(hWnd); GetClientRect( hWnd, &rc); ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top, - "Client rectangle not the expected size (%d,%d,%d,%d)\n", - rc.left, rc.top, rc.right, rc.bottom); + "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc )); len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0); ok(lstrlenA(str) == len, "text shouldn't have been truncated\n"); DestroyWindow(hWnd); @@ -1299,8 +1298,7 @@ static void test_edit_control_5(void) assert(hWnd); GetClientRect( hWnd, &rc); ok( rc.right == rc1.right - rc1.left && rc.bottom == rc1.bottom - rc1.top, - "Client rectangle not the expected size (%d,%d,%d,%d)\n", - rc.left, rc.top, rc.right, rc.bottom); + "Client rectangle not the expected size %s\n", wine_dbgstr_rect( &rc )); len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0); ok(lstrlenA(str) == len, "text shouldn't have been truncated\n"); 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); ok(hwEdit != NULL, "got %p\n", hwEdit); 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); 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); ok(hwEdit != NULL, "got %p\n", hwEdit); 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); ok(old_margins == 0, "got %x\n", old_margins); diff --git a/rostests/winetests/user32/listbox.c b/rostests/winetests/user32/listbox.c index ba400f9b076..91d4675f839 100644 --- a/rostests/winetests/user32/listbox.c +++ b/rostests/winetests/user32/listbox.c @@ -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); GetClientRect(dis->hwndItem, &rc_client); - trace("hwndItem %p client rect (%d,%d-%d,%d)\n", dis->hwndItem, - rc_client.left, rc_client.top, rc_client.right, rc_client.bottom); + trace("hwndItem %p client rect %s\n", dis->hwndItem, wine_dbgstr_rect(&rc_client)); 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), "client rect of the listbox should be equal to the clip box," "or the clip box should be empty\n"); - trace("rcItem (%d,%d-%d,%d)\n", dis->rcItem.left, dis->rcItem.top, - dis->rcItem.right, dis->rcItem.bottom); + trace("rcItem %s\n", wine_dbgstr_rect(&dis->rcItem)); 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"); break; @@ -334,7 +332,7 @@ static void test_ownerdraw(void) ok(ret == 1, "wrong top index %d\n", ret); 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(rc.top < 0, "rc.top is not negative (%d)\n", rc.top); diff --git a/rostests/winetests/user32/menu.c b/rostests/winetests/user32/menu.c index 85a51f56b1e..0460e19d5ef 100755 --- a/rostests/winetests/user32/menu.c +++ b/rostests/winetests/user32/menu.c @@ -194,11 +194,9 @@ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg, if (winetest_debug > 1) { RECT 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, - pdis->rcItem.left, pdis->rcItem.top, - pdis->rcItem.right,pdis->rcItem.bottom, - rc.left,rc.top,rc.right,rc.bottom); + wine_dbgstr_rect(&pdis->rcItem), wine_dbgstr_rect(&rc)); oldpen=SelectObject( pdis->hDC, GetStockObject( pdis->itemState & ODS_SELECTED ? WHITE_PEN :BLACK_PEN)); 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); ok(ret, "GetMenuBarInfo failed with error %d\n", GetLastError()); - ok(mbi.rcBar.left == 0 && mbi.rcBar.top == 0 && - mbi.rcBar.bottom == 0 && mbi.rcBar.right == 0, - "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.rcBar.left == 0 && mbi.rcBar.top == 0 && mbi.rcBar.bottom == 0 && mbi.rcBar.right == 0, + "rcBar: Expected (0,0)-(0,0), got: %s\n", wine_dbgstr_rect(&mbi.rcBar)); 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); @@ -381,8 +377,7 @@ static void test_getmenubarinfo(void) ok(ret, "GetMenuItemRect failed.\n"); 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, - "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, + "rcBar: Got %s instead of (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&mbi.rcBar), 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.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()); ret = GetMenuItemRect(hwnd, hmenu, 1, &rci); ok(ret, "GetMenuItemRect failed.\n"); - ok(mbi.rcBar.left == rci.left && mbi.rcBar.top == rci.top && - mbi.rcBar.bottom == rci.bottom && mbi.rcBar.right == rci.right, - "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(EqualRect(&mbi.rcBar, &rci), "rcBar: Got %s instead of %s\n", wine_dbgstr_rect(&mbi.rcBar), + wine_dbgstr_rect(&rci)); 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.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_CYMENUCHECK ),arrowwidth, MOD_avec); if( hbmp == HBMMENU_CALLBACK) - trace( " rc %d,%d-%d,%d bmp.rc %d,%d-%d,%d\n", - rc.left, rc.top, rc.top, rc.bottom, MOD_rc[0].left, - MOD_rc[0].top,MOD_rc[0].right, MOD_rc[0].bottom); + trace( " rc %s bmp.rc %s\n", wine_dbgstr_rect(&rc), wine_dbgstr_rect(&MOD_rc[0])); } /* clean up */ ret = DestroyMenu(submenu); diff --git a/rostests/winetests/user32/monitor.c b/rostests/winetests/user32/monitor.c index d0c9a8c5cbc..7a039e5ad4e 100644 --- a/rostests/winetests/user32/monitor.c +++ b/rostests/winetests/user32/monitor.c @@ -262,21 +262,21 @@ static void test_ChangeDisplaySettingsEx(void) /* Resolution change resets clip rect */ 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; 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) */ SetRect(&r1, 10, 10, 20, 20); ok(ClipCursor(&r1), "ClipCursor() 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); ok(ClipCursor(&r1), "ClipCursor() 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); ok(!ClipCursor(&r1), "ClipCursor() succeeded\n"); /* 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); ok(ClipCursor(&r1), "ClipCursor() failed\n"); ok(GetClipCursor(&r), "GetClipCursor() failed\n"); - ok(EqualRect(&r, &virt) || - broken(EqualRect(&r, &r1)) /* win9x */, - "Invalid clip rect: (%d %d) x (%d %d)\n", r.left, r.top, r.right, r.bottom); + ok(EqualRect(&r, &virt) || broken(EqualRect(&r, &r1)) /* win9x */, + "Invalid clip rect: %s\n", wine_dbgstr_rect(&r)); ClipCursor(&virt); } } @@ -499,13 +498,12 @@ static void test_work_area(void) ret = pGetMonitorInfoA(hmon, &mi); ok(ret, "GetMonitorInfo error %u\n", GetLastError()); ok(mi.dwFlags & MONITORINFOF_PRIMARY, "not a primary monitor\n"); - trace("primary monitor (%d,%d-%d,%d)\n", - mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom); + trace("primary monitor %s\n", wine_dbgstr_rect(&mi.rcMonitor)); SetLastError(0xdeadbeef); ret = SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc_work, 0); 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"); 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); 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); ret = GetWindowPlacement(hwnd, &wp); ok(ret, "GetWindowPlacement failed\n"); - trace("min: %d,%d max %d,%d normal %d,%d-%d,%d\n", - wp.ptMinPosition.x, wp.ptMinPosition.y, - wp.ptMaxPosition.x, wp.ptMaxPosition.y, - wp.rcNormalPosition.left, wp.rcNormalPosition.top, - wp.rcNormalPosition.right, wp.rcNormalPosition.bottom); + trace("min: %d,%d max %d,%d normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y, + wp.ptMaxPosition.x, wp.ptMaxPosition.y, wine_dbgstr_rect(&wp.rcNormalPosition)); OffsetRect(&wp.rcNormalPosition, rc_work.left, rc_work.top); todo_wine_if (mi.rcMonitor.left != mi.rcWork.left || 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); ret = GetWindowPlacement(hwnd, &wp); ok(ret, "GetWindowPlacement failed\n"); - trace("min: %d,%d max %d,%d normal %d,%d-%d,%d\n", - wp.ptMinPosition.x, wp.ptMinPosition.y, - wp.ptMaxPosition.x, wp.ptMaxPosition.y, - wp.rcNormalPosition.left, wp.rcNormalPosition.top, - wp.rcNormalPosition.right, wp.rcNormalPosition.bottom); + trace("min: %d,%d max %d,%d normal %s\n", wp.ptMinPosition.x, wp.ptMinPosition.y, + wp.ptMaxPosition.x, wp.ptMaxPosition.y, wine_dbgstr_rect(&wp.rcNormalPosition)); ok(EqualRect(&rc_normal, &wp.rcNormalPosition), "normal pos is different\n"); DestroyWindow(hwnd); diff --git a/rostests/winetests/user32/msg.c b/rostests/winetests/user32/msg.c index 82640c88e8f..b4bf217acea 100755 --- a/rostests/winetests/user32/msg.c +++ b/rostests/winetests/user32/msg.c @@ -3,7 +3,7 @@ * * Copyright 1999 Ove Kaaven * Copyright 2003 Dimitrie O. Paun - * Copyright 2004, 2005 Dmitry Timoshkov + * Copyright 2004,2005,2016 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -97,6 +97,22 @@ typedef struct } u; } DRAW_ITEM_STRUCT; +/* encoded MEASUREITEMSTRUCT into a WPARAM */ +typedef struct +{ + union + { + struct + { + UINT CtlType : 4; + UINT CtlID : 4; + UINT itemID : 4; + UINT wParam : 20; + } item; + WPARAM wp; + } u; +} MEASURE_ITEM_STRUCT; + static BOOL test_DestroyWindow_flag; static HWINEVENTHOOK hEvent_hook; static HHOOK hKBD_hook; @@ -1393,6 +1409,33 @@ static const struct message WmModalDialogSeq[] = { { WM_NCDESTROY, sent }, { 0 } }; +static const struct message WmModalDialogSeq_2[] = { + { WM_CANCELMODE, sent }, + { HCBT_SETFOCUS, hook }, + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, + { WM_KILLFOCUS, sent }, + { WM_IME_SETCONTEXT, sent|parent|wparam|optional, 0 }, + { EVENT_OBJECT_STATECHANGE, winevent_hook|wparam|lparam, 0, 0 }, + { WM_ENABLE, sent|wparam, 0 }, + { HCBT_CREATEWND, hook }, + { EVENT_OBJECT_REORDER, winevent_hook|wparam|lparam, 0, 0 }, + { EVENT_OBJECT_CREATE, winevent_hook|wparam|lparam, 0, 0 }, + { WM_SETFONT, sent }, + { WM_INITDIALOG, sent }, + { WM_CHANGEUISTATE, sent|optional }, + { WM_UPDATEUISTATE, sent|optional }, + { WM_ENABLE, sent|wparam, 1 }, + { WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE }, + { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 }, + { WM_CHANGEUISTATE, sent|optional }, + { WM_UPDATEUISTATE, sent|optional }, + { HCBT_DESTROYWND, hook }, + { 0x0090, sent|optional }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, + { WM_DESTROY, sent }, + { WM_NCDESTROY, sent }, + { 0 } +}; /* SetMenu for NonVisible windows with size change*/ static const struct message WmSetMenuNonVisibleSizeChangeSeq[] = { { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, @@ -1715,6 +1758,7 @@ static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD); static BOOL (WINAPI *pUpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD); static UINT_PTR (WINAPI *pSetSystemTimer)(HWND, UINT_PTR, UINT, TIMERPROC); static UINT_PTR (WINAPI *pKillSystemTimer)(HWND, UINT_PTR); +static UINT_PTR (WINAPI *pSetCoalescableTimer)(HWND, UINT_PTR, UINT, TIMERPROC, ULONG); /* kernel32 functions */ static BOOL (WINAPI *pGetCPInfoExA)(UINT, DWORD, LPCPINFOEXA); @@ -1741,6 +1785,7 @@ static void init_procs(void) GET_PROC(user32, UpdateLayeredWindow) GET_PROC(user32, SetSystemTimer) GET_PROC(user32, KillSystemTimer) + GET_PROC(user32, SetCoalescableTimer) GET_PROC(kernel32, GetCPInfoExA) @@ -1785,6 +1830,25 @@ static BOOL ignore_message( UINT message ) message == WM_DWMNCRENDERINGCHANGED); } +static unsigned hash_Ly_W(const WCHAR *str) +{ + unsigned hash = 0; + + for (; *str; str++) + hash = hash * 1664525u + (unsigned char)(*str) + 1013904223u; + + return hash; +} + +static unsigned hash_Ly(const char *str) +{ + unsigned hash = 0; + + for (; *str; str++) + hash = hash * 1664525u + (unsigned char)(*str) + 1013904223u; + + return hash; +} #define add_message(msg) add_message_(__LINE__,msg); static void add_message_(int line, const struct recvd_message *msg) @@ -1889,6 +1953,26 @@ static void add_message_(int line, const struct recvd_message *msg) seq->lParam = di.u.lp; break; } + + case WM_MEASUREITEM: + { + MEASURE_ITEM_STRUCT mi; + MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)msg->lParam; + + sprintf( seq->output, "%s: %p WM_MEASUREITEM: CtlType %#x, CtlID %#x, itemID %#x, itemData %#lx", + msg->descr, msg->hwnd, mis->CtlType, mis->CtlID, + mis->itemID, mis->itemData); + + mi.u.wp = 0; + mi.u.item.CtlType = mis->CtlType; + mi.u.item.CtlID = mis->CtlID; + mi.u.item.itemID = mis->itemID; + mi.u.item.wParam = msg->wParam; + seq->wParam = mi.u.wp; + seq->lParam = mis->itemData ? hash_Ly_W((const WCHAR *)mis->itemData) : 0; + break; + } + default: if (msg->message >= 0xc000) return; /* ignore registered messages */ sprintf( seq->output, "%s: %p %04x wp %08lx lp %08lx", @@ -2342,6 +2426,28 @@ static const struct message WmCreateMDIchildVisibleSeq[] = { { WM_MDIACTIVATE, sent|defwinproc }, { 0 } }; +/* WM_CHILDACTIVATE sent to disabled window */ +static const struct message WmChildActivateDisabledWindowSeq[] = { + { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 }, + { 0 } +}; +/* WM_CHILDACTIVATE sent to enabled window */ +static const struct message WmChildActivateWindowSeq[] = { + { WM_CHILDACTIVATE, sent|wparam|lparam, 0, 0 }, + { WM_NCACTIVATE, sent|wparam|defwinproc, 0 }, + { WM_MDIACTIVATE, sent|defwinproc }, + { WM_WINDOWPOSCHANGING, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, + { WM_WINDOWPOSCHANGED, sent|wparam|defwinproc, SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, + { WM_NCACTIVATE, sent|wparam|defwinproc, 1 }, + { HCBT_SETFOCUS, hook }, + { WM_KILLFOCUS, sent|defwinproc }, + { WM_SETFOCUS, sent }, + { HCBT_SETFOCUS, hook }, + { WM_KILLFOCUS, sent }, + { WM_SETFOCUS, sent|defwinproc }, + { WM_MDIACTIVATE, sent|defwinproc }, + { 0 } +}; /* CreateWindow for MDI child window with invisible parent */ static const struct message WmCreateMDIchildInvisibleParentSeq[] = { { HCBT_CREATEWND, hook }, @@ -3379,7 +3485,7 @@ static void test_mdi_messages(void) BOOL zoomed; RECT rc; HMENU hMenu = CreateMenu(); - DWORD val; + LONG val; if (!mdi_RegisterWindowClasses()) assert(0); @@ -3617,6 +3723,50 @@ static void test_mdi_messages(void) ok(GetActiveWindow() == mdi_frame, "wrong active window %p\n", GetActiveWindow()); ok(GetFocus() == 0, "wrong focus window %p\n", GetFocus()); + trace("Testing WM_CHILDACTIVATE\n"); + + mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child", + WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX | WS_DISABLED, + 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, + mdi_client, 0, GetModuleHandleA(0), NULL); + + mdi_child2 = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child", + WS_CHILD | WS_VISIBLE | WS_MAXIMIZEBOX, + 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, + mdi_client, 0, GetModuleHandleA(0), NULL); + + active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed); + ok(active_child == mdi_child2, "wrong active MDI child %p\n", active_child); + ok(!zoomed, "wrong zoomed state %d\n", zoomed); + + flush_sequence(); + SendMessageW(mdi_child, WM_CHILDACTIVATE, 0, 0); + ok_sequence(WmChildActivateDisabledWindowSeq, "WM_CHILDACTIVATE sent to disabled window", FALSE); + + active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed); + ok(active_child == mdi_child2, "wrong active MDI child %p\n", active_child); + ok(!zoomed, "wrong zoomed state %d\n", zoomed); + flush_sequence(); + + EnableWindow(mdi_child, TRUE); + + active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed); + ok(active_child == mdi_child2, "wrong active MDI child %p\n", active_child); + ok(!zoomed, "wrong zoomed state %d\n", zoomed); + + flush_sequence(); + SendMessageW(mdi_child, WM_CHILDACTIVATE, 0, 0); + ok_sequence(WmChildActivateWindowSeq, "WM_CHILDACTIVATE sent to enabled window", FALSE); + + active_child = (HWND)SendMessageA(mdi_client, WM_MDIGETACTIVE, 0, (LPARAM)&zoomed); + ok(active_child == mdi_child, "wrong active MDI child %p\n", active_child); + ok(!zoomed, "wrong zoomed state %d\n", zoomed); + flush_sequence(); + + DestroyWindow(mdi_child); + DestroyWindow(mdi_child2); + flush_sequence(); + /* test for maximized MDI children */ trace("creating maximized visible MDI child window 1\n"); mdi_child = CreateWindowExA(WS_EX_MDICHILD, "MDI_child_class", "MDI child", @@ -3869,7 +4019,7 @@ static void test_mdi_messages(void) flush_sequence(); val = GetWindowLongA(mdi_client, 0); - ok(val == 0xdeadbeef || broken(val == 0) /* >= Win 2003 */, "Expected 0xdeadbeef, got 0x%x\n", val); + ok(val == 0xdeadbeef || broken(val == 0) /* >= Win Vista */, "Expected 0xdeadbeef, got 0x%x\n", val); DestroyWindow(mdi_client); ok_sequence(WmDestroyMDIclientSeq, "Destroy MDI client window", FALSE); @@ -3970,6 +4120,36 @@ static INT_PTR CALLBACK TestModalDlgProcA(HWND hwnd, UINT message, WPARAM wParam return 0; } +static INT_PTR CALLBACK TestModalDlgProc2(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + struct recvd_message msg; + + if (ignore_message( message )) return 0; + + switch (message) + { + /* ignore */ + case WM_MOUSEMOVE: + case WM_NCMOUSEMOVE: + case WM_NCMOUSELEAVE: + case WM_SETCURSOR: + return 0; + case WM_NCHITTEST: + return HTCLIENT; + } + + msg.hwnd = hwnd; + msg.message = message; + msg.flags = sent|wparam|lparam; + msg.wParam = wParam; + msg.lParam = lParam; + msg.descr = "dialog"; + add_message(&msg); + + if (message == WM_INITDIALOG) EndDialog( hwnd, 0 ); + return 0; +} + static void test_hv_scroll_1(HWND hwnd, INT ctl, DWORD clear, DWORD set, INT min, INT max) { DWORD style, exstyle; @@ -4228,8 +4408,7 @@ static void test_showwindow(void) GetWindowRect(hwnd, &rc); ok( rc.right-rc.left == GetSystemMetrics(SM_CXSCREEN) && rc.bottom-rc.top == GetSystemMetrics(SM_CYSCREEN), - "Invalid maximized size before ShowWindow (%d,%d)-(%d,%d)\n", - rc.left, rc.top, rc.right, rc.bottom); + "Invalid maximized size before ShowWindow %s\n", wine_dbgstr_rect( &rc )); /* Reset window's size & position */ SetWindowPos(hwnd, 0, 10, 10, 200, 200, SWP_NOZORDER | SWP_NOACTIVATE); ok(IsZoomed(hwnd), "window should be maximized\n"); @@ -4243,8 +4422,7 @@ static void test_showwindow(void) GetWindowRect(hwnd, &rc); ok( rc.right-rc.left == GetSystemMetrics(SM_CXSCREEN) && rc.bottom-rc.top == GetSystemMetrics(SM_CYSCREEN), - "Invalid maximized size after ShowWindow (%d,%d)-(%d,%d)\n", - rc.left, rc.top, rc.right, rc.bottom); + "Invalid maximized size after ShowWindow %s\n", wine_dbgstr_rect( &rc )); DestroyWindow(hwnd); flush_sequence(); @@ -5416,6 +5594,35 @@ static const struct message WmSetFontStaticSeq[] = { WM_CTLCOLORSTATIC, sent|defwinproc }, { 0 } }; +static const struct message WmSetTextButtonSeq[] = +{ + { WM_SETTEXT, sent }, + { WM_CTLCOLORBTN, sent|parent }, + { WM_CTLCOLORBTN, sent|parent }, + { WM_COMMAND, sent|parent|optional }, + { WM_DRAWITEM, sent|parent|optional }, + { 0 } +}; +static const struct message WmSetTextStaticSeq[] = +{ + { WM_SETTEXT, sent }, + { WM_CTLCOLORSTATIC, sent|parent }, + { WM_CTLCOLORSTATIC, sent|parent }, + { 0 } +}; +static const struct message WmSetTextGroupSeq[] = +{ + { WM_SETTEXT, sent }, + { WM_CTLCOLORSTATIC, sent|parent }, + { WM_CTLCOLORSTATIC, sent|parent|optional }, /* FIXME: Missing in Wine */ + { WM_CTLCOLORSTATIC, sent|parent|optional }, /* FIXME: Missing in Wine */ + { 0 } +}; +static const struct message WmSetTextInvisibleSeq[] = +{ + { WM_SETTEXT, sent }, + { 0 } +}; static const struct message WmSetStyleButtonSeq[] = { { BM_SETSTYLE, sent }, @@ -5585,51 +5792,63 @@ static void test_button_messages(void) const struct message *lbuttondown; const struct message *lbuttonup; const struct message *setfont; + const struct message *settext; } button[] = { { BS_PUSHBUTTON, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON, WmSetFocusButtonSeq, WmKillFocusButtonSeq, WmSetStyleButtonSeq, WmSetStateButtonSeq, WmSetStateButtonSeq, WmSetCheckIgnoredSeq, - WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq }, + WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq, + WmSetTextButtonSeq }, { BS_DEFPUSHBUTTON, DLGC_BUTTON | DLGC_DEFPUSHBUTTON, WmSetFocusButtonSeq, WmKillFocusButtonSeq, WmSetStyleButtonSeq, WmSetStateButtonSeq, WmSetStateButtonSeq, WmSetCheckIgnoredSeq, - WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq }, + WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq, + WmSetTextButtonSeq }, { BS_CHECKBOX, DLGC_BUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq, WmSetStyleStaticSeq, WmSetStateStaticSeq, WmSetStateStaticSeq, WmSetCheckStaticSeq, - WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq }, + WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq, + WmSetTextStaticSeq }, { BS_AUTOCHECKBOX, DLGC_BUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq, WmSetStyleStaticSeq, WmSetStateStaticSeq, WmSetStateStaticSeq, WmSetCheckStaticSeq, - WmLButtonDownStaticSeq, WmLButtonUpAutoSeq, WmSetFontStaticSeq }, + WmLButtonDownStaticSeq, WmLButtonUpAutoSeq, WmSetFontStaticSeq, + WmSetTextStaticSeq }, { BS_RADIOBUTTON, DLGC_BUTTON | DLGC_RADIOBUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq, WmSetStyleStaticSeq, WmSetStateStaticSeq, WmSetStateStaticSeq, WmSetCheckStaticSeq, - WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq }, + WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq, + WmSetTextStaticSeq }, { BS_3STATE, DLGC_BUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq, WmSetStyleStaticSeq, WmSetStateStaticSeq, WmSetStateStaticSeq, WmSetCheckStaticSeq, - WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq }, + WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq, + WmSetTextStaticSeq }, { BS_AUTO3STATE, DLGC_BUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq, WmSetStyleStaticSeq, WmSetStateStaticSeq, WmSetStateStaticSeq, WmSetCheckStaticSeq, - WmLButtonDownStaticSeq, WmLButtonUpAutoSeq, WmSetFontStaticSeq }, + WmLButtonDownStaticSeq, WmLButtonUpAutoSeq, WmSetFontStaticSeq, + WmSetTextStaticSeq }, { BS_GROUPBOX, DLGC_STATIC, WmSetFocusStaticSeq, WmKillFocusStaticSeq, WmSetStyleStaticSeq, WmSetStateStaticSeq, WmSetStateStaticSeq, WmSetCheckIgnoredSeq, - WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq }, + WmLButtonDownStaticSeq, WmLButtonUpStaticSeq, WmSetFontStaticSeq, + WmSetTextGroupSeq }, { BS_USERBUTTON, DLGC_BUTTON | DLGC_UNDEFPUSHBUTTON, WmSetFocusButtonSeq, WmKillFocusButtonSeq, WmSetStyleUserSeq, WmSetStateUserSeq, WmClearStateButtonSeq, WmSetCheckIgnoredSeq, - WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq }, + WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq, + WmSetTextButtonSeq }, { BS_AUTORADIOBUTTON, DLGC_BUTTON | DLGC_RADIOBUTTON, WmSetFocusStaticSeq, WmKillFocusStaticSeq, WmSetStyleStaticSeq, WmSetStateStaticSeq, WmSetStateStaticSeq, WmSetCheckStaticSeq, - NULL /* avoid infinite loop */, WmLButtonUpBrokenSeq, WmSetFontStaticSeq }, + NULL /* avoid infinite loop */, WmLButtonUpBrokenSeq, WmSetFontStaticSeq, + WmSetTextStaticSeq }, { BS_OWNERDRAW, DLGC_BUTTON, WmSetFocusOwnerdrawSeq, WmKillFocusOwnerdrawSeq, WmSetStyleOwnerdrawSeq, WmSetStateOwnerdrawSeq, WmClearStateOwnerdrawSeq, WmSetCheckIgnoredSeq, - WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq }, + WmLButtonDownSeq, WmLButtonUpSeq, WmSetFontButtonSeq, + WmSetTextButtonSeq }, }; unsigned int i; HWND hwnd, parent; @@ -5763,6 +5982,30 @@ static void test_button_messages(void) while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); ok_sequence(button[i].setcheck, "BM_SETCHECK on a button", FALSE); + SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"Text 1"); + sprintf(desc, "button[%i]: WM_SETTEXT on a visible button", i); + ok_sequence(button[i].settext, desc, FALSE); + + ShowWindow(hwnd, SW_HIDE); + flush_events(); + flush_sequence(); + + SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"Text 2"); + sprintf(desc, "button[%i]: WM_SETTEXT on an invisible button", i); + ok_sequence(WmSetTextInvisibleSeq, desc, FALSE); + + ShowWindow(hwnd, SW_SHOW); + ShowWindow(parent, SW_HIDE); + flush_events(); + flush_sequence(); + + SendMessageA(hwnd, WM_SETTEXT, 0, (LPARAM)"Text 3"); + sprintf(desc, "button[%i]: WM_SETTEXT on an invisible button", i); + ok_sequence(WmSetTextInvisibleSeq, desc, FALSE); + + ShowWindow(parent, SW_SHOW); + flush_events(); + state = SendMessageA(hwnd, BM_GETCHECK, 0, 0); if (button[i].style == BS_PUSHBUTTON || button[i].style == BS_DEFPUSHBUTTON || @@ -6308,9 +6551,8 @@ static void check_update_rgn( HWND hwnd, HRGN hrgn ) } GetRgnBox( update, &r1 ); GetUpdateRect( hwnd, &r2, FALSE ); - ok( r1.left == r2.left && r1.top == r2.top && r1.right == r2.right && r1.bottom == r2.bottom, - "Rectangles are different: %d,%d-%d,%d / %d,%d-%d,%d\n", - r1.left, r1.top, r1.right, r1.bottom, r2.left, r2.top, r2.right, r2.bottom ); + ok( EqualRect( &r1, &r2 ), "Rectangles are different: %s / %s\n", wine_dbgstr_rect( &r1 ), + wine_dbgstr_rect( &r2 )); DeleteObject( tmp ); DeleteObject( update ); @@ -7266,7 +7508,7 @@ static void test_interthread_messages(void) handle = (void*)0xdeadbeef; ret = pGetCurrentActCtx(&handle); - ok(ret, "GetCurentActCtx failed: %u\n", GetLastError()); + ok(ret, "GetCurrentActCtx failed: %u\n", GetLastError()); ok(handle == 0, "active context %p\n", handle); wnd_event.start_event = CreateEventW(NULL, 0, 0, NULL); @@ -7281,7 +7523,7 @@ static void test_interthread_messages(void) handle = 0; ret = pGetCurrentActCtx(&handle); - ok(ret, "GetCurentActCtx failed: %u\n", GetLastError()); + ok(ret, "GetCurrentActCtx failed: %u\n", GetLastError()); ok(handle != 0, "active context %p\n", handle); pReleaseActCtx(handle); @@ -7806,8 +8048,7 @@ static void test_accelerators(void) keybd_event(VK_MENU, 0, 0, 0); keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); pump_msg_loop(hwnd, 0); - /* this test doesn't pass in Wine for managed windows */ - ok_sequence(WmAltPressRelease, "Alt press/release", TRUE); + ok_sequence(WmAltPressRelease, "Alt press/release", FALSE); trace("testing VK_F1 press/release\n"); keybd_event(VK_F1, 0, 0, 0); @@ -7827,7 +8068,7 @@ static void test_accelerators(void) keybd_event(VK_F10, 0, 0, 0); keybd_event(VK_F10, 0, KEYEVENTF_KEYUP, 0); pump_msg_loop(hwnd, 0); - ok_sequence(WmVkF10Seq, "VK_F10 press/release", TRUE); + ok_sequence(WmVkF10Seq, "VK_F10 press/release", FALSE); trace("testing SHIFT+F10 press/release\n"); keybd_event(VK_SHIFT, 0, 0, 0); @@ -8080,8 +8321,8 @@ static LRESULT WINAPI ParentMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam message == WM_PARENTNOTIFY || message == WM_CANCELMODE || message == WM_SETFOCUS || message == WM_KILLFOCUS || message == WM_ENABLE || message == WM_ENTERIDLE || - message == WM_DRAWITEM || message == WM_COMMAND || - message == WM_IME_SETCONTEXT) + message == WM_DRAWITEM || message == WM_MEASUREITEM || + message == WM_COMMAND || message == WM_IME_SETCONTEXT) { switch (message) { @@ -8098,8 +8339,7 @@ static LRESULT WINAPI ParentMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam RECT rc; INT ret = GetClipBox((HDC)wParam, &rc); - trace("WM_ERASEBKGND: GetClipBox()=%d, (%d,%d-%d,%d)\n", - ret, rc.left, rc.top, rc.right, rc.bottom); + trace("WM_ERASEBKGND: GetClipBox()=%d, %s\n", ret, wine_dbgstr_rect(&rc)); break; } } @@ -8808,6 +9048,20 @@ todo_wine KillTimer(NULL, id); /* Note: SetSystemTimer doesn't support a NULL window, see test_timers */ + if (pSetCoalescableTimer) + { + count = 0; + id = pSetCoalescableTimer(NULL, 0, 0, callback_count, 0); + ok(id != 0, "SetCoalescableTimer failed with %u.\n", GetLastError()); + start = GetTickCount(); + while (GetTickCount()-start < 100 && GetMessageA(&msg, NULL, 0, 0)) + DispatchMessageA(&msg); + ok(count > 1, "expected count > 1, got %d.\n", count); + KillTimer(NULL, id); + } + else + win_skip("SetCoalescableTimer not available.\n"); + /* Check what happens when we're running out of timers */ for (i=0; i= 0xc000) + { + ok(ret, "%d: message %04x, got %d, error %d\n", i, messages[i], ret, GetLastError()); + ok(msg.hwnd == hwnd, "%d: got %p\n", i, msg.hwnd); + } + else + { + ok(!ret, "%d: message %04x, got %d, error %d\n", i, messages[i], ret, GetLastError()); + } + + /* post, topmost */ + ret = PostMessageA(HWND_TOPMOST, messages[i], 0, 0); + ok(ret, "%d: got %d, error %d\n", i, ret, GetLastError()); + + memset(&msg, 0xab, sizeof(msg)); + ret = PeekMessageA(&msg, 0, 0, 0, PM_REMOVE); + if (messages[i] < WM_USER || messages[i] >= 0xc000) + { + ok(ret, "%d: message %04x, got %d, error %d\n", i, messages[i], ret, GetLastError()); + ok(msg.hwnd == hwnd, "%d: got %p\n", i, msg.hwnd); + } + else + { + ok(!ret, "%d: got %d, error %d\n", i, ret, GetLastError()); + } + + /* send, broadcast */ + g_broadcast_lparam = 0xdead; + ret = SendMessageTimeoutA(HWND_BROADCAST, messages[i], 0xbaadbeef, 0, SMTO_NORMAL, 2000, NULL); + if (!ret && GetLastError() == ERROR_TIMEOUT) + win_skip("broadcasting test %d, timeout\n", i); + else + { + if (messages[i] < WM_USER || messages[i] >= 0xc000) + { + ok(g_broadcast_lparam == 0xbaadbeef, "%d: message %04x, got %#lx, error %d\n", i, messages[i], + g_broadcast_lparam, GetLastError()); + } + else + { + ok(g_broadcast_lparam == 0xdead, "%d: message %04x, got %#lx, error %d\n", i, messages[i], + g_broadcast_lparam, GetLastError()); + } + } + + /* send, topmost */ + g_broadcast_lparam = 0xdead; + ret = SendMessageTimeoutA(HWND_TOPMOST, messages[i], 0xbaadbeef, 0, SMTO_NORMAL, 2000, NULL); + if (!ret && GetLastError() == ERROR_TIMEOUT) + win_skip("broadcasting test %d, timeout\n", i); + else + { + if (messages[i] < WM_USER || messages[i] >= 0xc000) + { + ok(g_broadcast_lparam == 0xbaadbeef, "%d: message %04x, got %#lx, error %d\n", i, messages[i], + g_broadcast_lparam, GetLastError()); + } + else + { + ok(g_broadcast_lparam == 0xdead, "%d: message %04x, got %#lx, error %d\n", i, messages[i], + g_broadcast_lparam, GetLastError()); + } + } + } + + DestroyWindow(hwnd); +} + static const struct { DWORD exp, broken; @@ -14004,12 +14601,7 @@ static void test_WaitForInputIdle( char *argv0 ) broken(ret == wait_idle_expect[i].broken), "%u: WaitForInputIdle error %08x expected %08x\n", i, ret, wait_idle_expect[i].exp ); - else if (wait_idle_expect[i].todo) - todo_wine - ok( ret == wait_idle_expect[i].exp || broken(ret == wait_idle_expect[i].broken), - "%u: WaitForInputIdle error %08x expected %08x\n", - i, ret, wait_idle_expect[i].exp ); - else + else todo_wine_if (wait_idle_expect[i].todo) ok( ret == wait_idle_expect[i].exp || broken(ret == wait_idle_expect[i].broken), "%u: WaitForInputIdle error %08x expected %08x\n", i, ret, wait_idle_expect[i].exp ); @@ -14092,10 +14684,10 @@ static void test_SetParent(void) ok(child != 0, "Failed to create child window\n"); GetWindowRect(parent1, &rc); - trace("parent1 (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + trace("parent1 %s\n", wine_dbgstr_rect(&rc)); GetWindowRect(child, &rc_old); MapWindowPoints(0, parent1, (POINT *)&rc_old, 2); - trace("child (%d,%d)-(%d,%d)\n", rc_old.left, rc_old.top, rc_old.right, rc_old.bottom); + trace("child %s\n", wine_dbgstr_rect(&rc_old)); flush_sequence(); @@ -14107,14 +14699,13 @@ static void test_SetParent(void) ok(!IsWindowVisible(child), "IsWindowVisible() should return FALSE\n"); GetWindowRect(parent2, &rc); - trace("parent2 (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + trace("parent2 %s\n", wine_dbgstr_rect(&rc)); GetWindowRect(child, &rc); MapWindowPoints(0, parent2, (POINT *)&rc, 2); - trace("child (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + trace("child %s\n", wine_dbgstr_rect(&rc)); - ok(EqualRect(&rc_old, &rc), "rects do not match (%d,%d-%d,%d) / (%d,%d-%d,%d)\n", - rc_old.left, rc_old.top, rc_old.right, rc_old.bottom, - rc.left, rc.top, rc.right, rc.bottom ); + ok(EqualRect(&rc_old, &rc), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc_old), + wine_dbgstr_rect(&rc)); /* WS_POPUP window */ popup = CreateWindowExA(0, "TestWindowClass", NULL, WS_POPUP | WS_VISIBLE, @@ -14122,7 +14713,7 @@ static void test_SetParent(void) ok(popup != 0, "Failed to create popup window\n"); GetWindowRect(popup, &rc_old); - trace("popup (%d,%d)-(%d,%d)\n", rc_old.left, rc_old.top, rc_old.right, rc_old.bottom); + trace("popup %s\n", wine_dbgstr_rect(&rc_old)); flush_sequence(); @@ -14134,14 +14725,13 @@ static void test_SetParent(void) ok(!IsWindowVisible(popup), "IsWindowVisible() should return FALSE\n"); GetWindowRect(child, &rc); - trace("parent2 (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + trace("parent2 %s\n", wine_dbgstr_rect(&rc)); GetWindowRect(popup, &rc); MapWindowPoints(0, child, (POINT *)&rc, 2); - trace("popup (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom); + trace("popup %s\n", wine_dbgstr_rect(&rc)); - ok(EqualRect(&rc_old, &rc), "rects do not match (%d,%d-%d,%d) / (%d,%d-%d,%d)\n", - rc_old.left, rc_old.top, rc_old.right, rc_old.bottom, - rc.left, rc.top, rc.right, rc.bottom ); + ok(EqualRect(&rc_old, &rc), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc_old), + wine_dbgstr_rect(&rc)); DestroyWindow(popup); DestroyWindow(child); @@ -14942,10 +15532,10 @@ static void test_layered_window(void) ok_sequence( WmEmptySeq, "UpdateLayeredWindow", FALSE ); GetWindowRect( hwnd, &rect ); ok( rect.left == 300 && rect.top == 300 && rect.right == 550 && rect.bottom == 550, - "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 )); GetClientRect( hwnd, &rect ); ok( rect.right == client.right - 50 && rect.bottom == client.bottom - 50, - "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + "wrong client rect %s\n", wine_dbgstr_rect( &rect )); size.cx = 150; pos.y = 200; @@ -14954,10 +15544,10 @@ static void test_layered_window(void) ok_sequence( WmEmptySeq, "UpdateLayeredWindow", FALSE ); GetWindowRect( hwnd, &rect ); ok( rect.left == 300 && rect.top == 200 && rect.right == 450 && rect.bottom == 450, - "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 )); GetClientRect( hwnd, &rect ); ok( rect.right == client.right - 150 && rect.bottom == client.bottom - 50, - "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + "wrong client rect %s\n", wine_dbgstr_rect( &rect )); SetWindowLongA( hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME | WS_SYSMENU) ); @@ -14970,11 +15560,11 @@ static void test_layered_window(void) ok_sequence( WmEmptySeq, "UpdateLayeredWindow", FALSE ); GetWindowRect( hwnd, &rect ); ok( rect.left == 200 && rect.top == 200 && rect.right == 400 && rect.bottom == 450, - "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 )); GetClientRect( hwnd, &rect ); ok( (rect.right == 200 && rect.bottom == 250) || broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50), - "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + "wrong client rect %s\n", wine_dbgstr_rect( &rect )); size.cx = 0; ret = pUpdateLayeredWindow( hwnd, 0, &pos, &size, hdc, &src, 0, NULL, ULW_OPAQUE ); @@ -14991,11 +15581,11 @@ static void test_layered_window(void) ok_sequence( WmSetLayeredStyle, "WmSetLayeredStyle", FALSE ); GetWindowRect( hwnd, &rect ); ok( rect.left == 200 && rect.top == 200 && rect.right == 400 && rect.bottom == 450, - "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 )); GetClientRect( hwnd, &rect ); ok( (rect.right == 200 && rect.bottom == 250) || broken(rect.right == client.right - 100 && rect.bottom == client.bottom - 50), - "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + "wrong client rect %s\n", wine_dbgstr_rect( &rect )); SetWindowLongA( hwnd, GWL_EXSTYLE, GetWindowLongA(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED ); info.hwnd = hwnd; @@ -15011,11 +15601,11 @@ static void test_layered_window(void) CloseHandle( thread ); GetWindowRect( hwnd, &rect ); ok( rect.left == 200 && rect.top == 200 && rect.right == 450 && rect.bottom == 500, - "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 )); GetClientRect( hwnd, &rect ); ok( (rect.right == 250 && rect.bottom == 300) || broken(rect.right == client.right - 50 && rect.bottom == client.bottom), - "wrong client rect %d,%d,%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + "wrong client rect %s\n", wine_dbgstr_rect( &rect )); DestroyWindow( hwnd ); DeleteDC( hdc ); @@ -15124,7 +15714,7 @@ static void test_TrackPopupMenuEmpty(void) flush_sequence(); ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL); ok_sequence(WmTrackPopupMenuEmpty, "TrackPopupMenuEmpty", TRUE); - todo_wine ok(ret == 0, "TrackPopupMenu succeeded\n"); + ok(ret == 0, "TrackPopupMenu succeeded\n"); DestroyMenu(hpopupmenu); DestroyWindow(hwnd); @@ -15394,6 +15984,7 @@ START_TEST(msg) test_SetFocus(); test_SetParent(); test_PostMessage(); + test_broadcast(); test_ShowWindow(); test_PeekMessage(); test_PeekMessage2(); @@ -15427,6 +16018,7 @@ START_TEST(msg) test_SendMessageTimeout(); test_edit_messages(); test_quit_message(); + test_notify_message(); test_SetActiveWindow(); if (!pTrackMouseEvent) @@ -15538,6 +16130,7 @@ START_TEST(msg_queue) test_SendMessage_other_thread(1); test_SendMessage_other_thread(2); test_PostMessage(); + test_broadcast(); test_PeekMessage(); test_PeekMessage2(); test_PeekMessage3(); @@ -15545,6 +16138,7 @@ START_TEST(msg_queue) test_DispatchMessage(); test_SendMessageTimeout(); test_quit_message(); + test_notify_message(); test_WaitForInputIdle( test_argv[0] ); test_DestroyWindow(); cleanup_tests(); diff --git a/rostests/winetests/user32/scroll.c b/rostests/winetests/user32/scroll.c index 7691af39735..0bda5dd0f44 100644 --- a/rostests/winetests/user32/scroll.c +++ b/rostests/winetests/user32/scroll.c @@ -222,11 +222,8 @@ static void test_GetScrollBarInfo(void) ok( ret, "The GetWindowRect() call should not fail.\n" ); ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)), "unexpected rgstate(0x%x)\n", sbi.rgstate[0]); - ok( EqualRect(&rect, &sbi.rcScrollBar), - "WindowRect(%d, %d, %d, %d) != rcScrollBar(%d, %d, %d, %d)\n", - rect.top, rect.left, rect.bottom, rect.right, - sbi.rcScrollBar.top, sbi.rcScrollBar.left, - sbi.rcScrollBar.bottom, sbi.rcScrollBar.right ); + ok(EqualRect(&rect, &sbi.rcScrollBar), "WindowRect %s != rcScrollBar %s\n", + wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar)); /* Test windows horizontal and vertical scrollbar to make sure rcScrollBar * is still returned in screen coordinates by moving the window, and @@ -243,11 +240,8 @@ static void test_GetScrollBarInfo(void) OffsetRect(&rect, 5, 5); ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi); ok( ret, "The GetScrollBarInfo() call should not fail.\n" ); - ok( EqualRect(&rect, &sbi.rcScrollBar), - "PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n", - rect.top, rect.left, rect.bottom, rect.right, - sbi.rcScrollBar.top, sbi.rcScrollBar.left, - sbi.rcScrollBar.bottom, sbi.rcScrollBar.right ); + ok(EqualRect(&rect, &sbi.rcScrollBar), "PreviousRect %s != CurrentRect %s\n", + wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar)); sbi.cbSize = sizeof(sbi); ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi); @@ -260,11 +254,8 @@ static void test_GetScrollBarInfo(void) OffsetRect(&rect, 5, 5); ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi); ok( ret, "The GetScrollBarInfo() call should not fail.\n" ); - ok( EqualRect(&rect, &sbi.rcScrollBar), - "PreviousRect(%d, %d, %d, %d) != CurrentRect(%d, %d, %d, %d)\n", - rect.top, rect.left, rect.bottom, rect.right, - sbi.rcScrollBar.top, sbi.rcScrollBar.left, - sbi.rcScrollBar.bottom, sbi.rcScrollBar.right ); + ok(EqualRect(&rect, &sbi.rcScrollBar), "PreviousRect %s != CurrentRect %s\n", + wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar)); DestroyWindow(hScroll); DestroyWindow(hMainWnd); diff --git a/rostests/winetests/user32/static.c b/rostests/winetests/user32/static.c index 841889d63bc..929b50d694e 100644 --- a/rostests/winetests/user32/static.c +++ b/rostests/winetests/user32/static.c @@ -33,9 +33,6 @@ 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_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; diff --git a/rostests/winetests/user32/text.c b/rostests/winetests/user32/text.c index 6bc101724cc..bebf6a062f7 100755 --- a/rostests/winetests/user32/text.c +++ b/rostests/winetests/user32/text.c @@ -115,15 +115,14 @@ static void test_DrawTextCalcRect(void) SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT, NULL ); - ok( !EMPTY(rect) && !MODIFIED(rect), - "rectangle should NOT be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight==0,"Got textheight from DrawTextExA\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, text, 0, &rect, DT_CALCRECT); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextA\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); SetLastError( 0); heightcheck = textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT, NULL ); - ok( EMPTY(rect), - "rectangle should be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextExA\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT); - ok( EMPTY(rect), - "rectangle should be empty got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); SetRect( &rect, 10,10, 100, 100); SetLastError( 0); heightcheck = textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT, NULL ); - ok( EMPTY(rect) || !MODIFIED(rect), - "rectangle should be empty or not modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect)); if (!textheight) /* Windows NT 4 */ { if (conform_xp) @@ -159,25 +154,22 @@ static void test_DrawTextCalcRect(void) SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, NULL, -1, &rect, DT_CALCRECT); - ok( EMPTY(rect) || !MODIFIED(rect), - "rectangle should be empty or NOT modified got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT, NULL ); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextExA\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, NULL, 0, &rect, DT_CALCRECT); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextA\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); heightcheck = textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( !EMPTY(rect) && !MODIFIED(rect), - "rectangle should NOT be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextExA\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, text, 0, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextA\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); SetLastError( 0); heightcheck = textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( !EMPTY(rect) && MODIFIED(rect), - "rectangle should be modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n", + wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextExA\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( !EMPTY(rect) && MODIFIED (rect), - "rectangle should be modified got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(!EMPTY(rect) && MODIFIED (rect), "rectangle should be modified got %s\n", + wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); SetRect( &rect, 10,10, 100, 100); SetLastError( 0); heightcheck = textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( (!EMPTY(rect) && MODIFIED(rect)) || !MODIFIED(rect), - "rectangle should be modified got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n", + wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight!=0,"Failed to get textheight from DrawTextExA\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( (!EMPTY(rect) && MODIFIED(rect)) || !MODIFIED(rect), - "rectangle should be modified got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n", + wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight!=0,"Failed to get textheight from DrawTextA\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextExA\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextA(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextA\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); @@ -334,39 +322,32 @@ static void test_DrawTextCalcRect(void) SetLastError( 0); heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL ); if( GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) { - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL ); - ok( EMPTY(rect), - "rectangle should be empty got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT); - ok( EMPTY(rect), - "rectangle should be empty got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(EMPTY(rect), "rectangle should be empty got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL ); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (textheight) /* windows 2000 */ { if (conform_xp) @@ -378,9 +359,8 @@ static void test_DrawTextCalcRect(void) SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextW\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); @@ -389,16 +369,14 @@ static void test_DrawTextCalcRect(void) /* Crashes on NT4 */ SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL ); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight==0,"Got textheight from DrawTextExW\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight==0,"Got textheight from DrawTextW\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); } @@ -407,31 +385,27 @@ static void test_DrawTextCalcRect(void) /* DT_SINGLELINE tests */ heightcheck = textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, textW, 0, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( !EMPTY(rect) && MODIFIED(rect), - "rectangle should be modified got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n", + wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextExW\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( !EMPTY(rect) && MODIFIED(rect), - "rectangle should be modified got %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom ); + ok(!EMPTY(rect) && MODIFIED(rect), "rectangle should be modified got %s\n", + wine_dbgstr_rect(&rect)); ok(textheight!=0,"Failed to get textheight from DrawTextW\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); @@ -439,33 +413,29 @@ static void test_DrawTextCalcRect(void) /* Crashes on NT4 */ SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight==0,"Got textheight from DrawTextExW\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, NULL, -1, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); ok(textheight==0,"Got textheight from DrawTextW\n"); ok(textheight == heightcheck,"DrawTextEx and DrawText differ in return\n"); } SetRect( &rect, 10,10, 100, 100); heightcheck = textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE, NULL ); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextExW\n"); SetRect( &rect, 10,10, 100, 100); textheight = DrawTextW(hdc, NULL, 0, &rect, DT_CALCRECT|DT_SINGLELINE); - ok( !EMPTY(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 ); + ok(!IsRectEmpty(&rect) && !MODIFIED(rect), + "rectangle should NOT be empty and NOT modified got %s\n", wine_dbgstr_rect(&rect)); if (conform_xp) ok(textheight==0,"Got textheight from DrawTextW\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(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, - "incorrect rect %d,%d-%d,%d rect2 %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom, rect2.left, rect2.top, rect2.right, rect2.bottom ); + "incorrect rect %s rect2 %s\n", wine_dbgstr_rect(&rect), wine_dbgstr_rect(&rect2)); SetRect( &rect, 0,0, 10, 10); memset(&dtp, 0, sizeof(dtp)); @@ -759,37 +728,84 @@ static void test_DrawState(void) DestroyWindow(hwnd); } -static void test_string_conversions(void) +static void test_CharToOem_OemToChar(void) { - char buf[64] = "string"; - int i; - BOOL ret; - struct + static const WCHAR helloWorldW[] = {'H','e','l','l','o',' ','W','o','r','l','d',0}; + static const WCHAR emptyW[] = {0}; + static const char helloWorld[] = "Hello World"; + static const struct { - char *src, *dst; - unsigned len; - BOOL ret; - } test[] = + BOOL src, dst, ret; + } + tests[] = { - { NULL, NULL, 1, FALSE }, - { buf, NULL, 1, FALSE }, - { NULL, buf, 1, FALSE }, - { buf, buf, 1, TRUE } + { FALSE, FALSE, FALSE }, + { TRUE, FALSE, FALSE }, + { FALSE, TRUE, FALSE }, + { 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); - ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); + const char *expected = tests[i].ret ? helloWorld : ""; + 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); - ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); + memset(buf, 0, sizeof(buf)); + 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); - ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); + memset(buf, 0, sizeof(buf)); + 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); - ok(ret == test[i].ret, "%d: expected %d, got %d\n", i, test[i].ret, ret); + memset(buf, 0, sizeof(buf)); + 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_DrawTextCalcRect(); test_DrawState(); - test_string_conversions(); + test_CharToOem_OemToChar(); } diff --git a/rostests/winetests/user32/uitools.c b/rostests/winetests/user32/uitools.c index e1ddf2b685d..27a41793fdd 100644 --- a/rostests/winetests/user32/uitools.c +++ b/rostests/winetests/user32/uitools.c @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define WINE_NO_INLINE_RECT #include "wine/test.h" #include "winbase.h" #include "wingdi.h" @@ -75,8 +76,8 @@ static void test_SubtractRect(void) result = SubtractRect(&rectr, &rect1, &rect2); ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); ok(result && rectr.left == 50 && rectr.top == 50 && rectr.right ==150 - && rectr.bottom == 100, "wrong rect subtraction of SubtractRect " - "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + && rectr.bottom == 100, "wrong rect subtraction of SubtractRect (dest rect=%s)\n", + wine_dbgstr_rect(&rectr)); /* source rect 2 partially overlaps rect 1 */ SetRect(&rect1, 2431, 626, 3427, 1608); @@ -84,8 +85,8 @@ static void test_SubtractRect(void) result = SubtractRect(&rectr, &rect1, &rect2); ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499 - && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect " - "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect (dest rect=%s)\n", + wine_dbgstr_rect(&rectr)); /* source rect 2 partially overlaps rect 1 - dest is src rect 2 */ SetRect(&rect1, 2431, 626, 3427, 1608); @@ -93,26 +94,118 @@ static void test_SubtractRect(void) result = SubtractRect(&rect2, &rect1, &rect2); ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499 - && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect " - "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect (dest rect=%s)\n", + wine_dbgstr_rect(&rectr)); /* source rect 2 completely overlaps rect 1 */ SetRect(&rect1, 250, 250, 400, 500); SetRect(&rect2, 50, 50, 1500, 1000); result = SubtractRect(&rectr, &rect1, &rect2); - ok(!result, "SubtractRect returned TRUE but subtraction should be empty " - "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + ok(!result, "SubtractRect returned TRUE but subtraction should be empty (dest rect=%s)\n", + wine_dbgstr_rect(&rectr)); /* source rect 2 completely overlaps rect 1 - dest is src rect 2 */ SetRect(&rect1, 250, 250, 400, 500); SetRect(&rect2, 50, 50, 1500, 1000); result = SubtractRect(&rect2, &rect1, &rect2); - ok(!result, "SubtractRect returned TRUE but subtraction should be empty " - "(dest rect={%d, %d, %d, %d})\n", rect2.left, rect2.top, rect2.right, rect2.bottom); + ok(!result, "SubtractRect returned TRUE but subtraction should be empty (dest rect=%s)\n", + 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) { test_FillRect(); test_SubtractRect(); + test_EqualRect(); + test_IsRectEmpty(); + test_SetRect(); } diff --git a/rostests/winetests/user32/win.c b/rostests/winetests/user32/win.c index 74c9ec8bd4d..8cabb90d908 100644 --- a/rostests/winetests/user32/win.c +++ b/rostests/winetests/user32/win.c @@ -807,14 +807,14 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR if (0) { /* 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", - rc1.left, rc1.top, rc1.right, rc1.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom ); + ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1), + wine_dbgstr_rect(&rc2)); GetClientRect(hwnd, &rc2); DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2); - ok(EqualRect(&rc1, &rc2), "rects do not match (%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 ); + ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1), + wine_dbgstr_rect(&rc2)); } break; } @@ -1078,31 +1078,28 @@ static void test_nonclient_area(HWND hwnd) if (IsRectEmpty(&rc_window) || IsRectEmpty(&rc_client) || rc_window.right > 32768 || rc_window.bottom > 32768) return; - CopyRect(&rc, &rc_client); + rc = rc_client; MapWindowPoints(hwnd, 0, (LPPOINT)&rc, 2); FixedAdjustWindowRectEx(&rc, style, menu, exstyle); 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", - style, exstyle, menu, rc_window.left, rc_window.top, rc_window.right, rc_window.bottom, - rc.left, rc.top, rc.right, rc.bottom); + "window rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, win=%s, calc=%s\n", + style, exstyle, menu, wine_dbgstr_rect(&rc_window), wine_dbgstr_rect(&rc)); - CopyRect(&rc, &rc_client); + rc = rc_client; MapWindowPoints(hwnd, 0, (LPPOINT)&rc, 2); wine_AdjustWindowRectEx(&rc, style, menu, exstyle); 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", - style, exstyle, menu, rc_window.left, rc_window.top, rc_window.right, rc_window.bottom, - rc.left, rc.top, rc.right, rc.bottom); + "window rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, win=%s, calc=%s\n", + style, exstyle, menu, wine_dbgstr_rect(&rc_window), wine_dbgstr_rect(&rc)); - CopyRect(&rc, &rc_window); + rc = rc_window; DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2); 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", - style, exstyle, menu, rc_client.left, rc_client.top, rc_client.right, rc_client.bottom, - rc.left, rc.top, rc.right, rc.bottom); + "client rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d client=%s, calc=%s\n", + style, exstyle, menu, wine_dbgstr_rect(&rc_client), wine_dbgstr_rect(&rc)); /* NULL rectangle shouldn't crash */ 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 */ SetRect(&rc_client, 0, 0, 250, 150); - CopyRect(&rc_window, &rc_client); + rc_window = rc_client; MapWindowPoints(hwnd, 0, (LPPOINT)&rc_window, 2); FixedAdjustWindowRectEx(&rc_window, style, menu, exstyle); - CopyRect(&rc, &rc_window); + rc = rc_window; DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc); MapWindowPoints(0, hwnd, (LPPOINT)&rc, 2); 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", - style, exstyle, menu, rc_client.left, rc_client.top, rc_client.right, rc_client.bottom, - rc.left, rc.top, rc.right, rc.bottom); + "synthetic rect does not match: style:exstyle=0x%08x:0x%08x, menu=%d, client=%s, calc=%s\n", + style, exstyle, menu, wine_dbgstr_rect(&rc_client), wine_dbgstr_rect(&rc)); } 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.y = rect.top; - trace("max rect (%d,%d - %d, %d)\n", - rect.left, rect.top, rect.right, rect.bottom); + trace("max rect %s\n", wine_dbgstr_rect(&rect)); } 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); /* note: winpos coordinates are relative to parent */ 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", - rc1.left, rc1.top, rc1.right, rc1.bottom, - rc2.left, rc2.top, rc2.right, rc2.bottom); + ok(EqualRect(&rc1, &rc2), "rects do not match, window=%s pos=%s\n", + wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); GetWindowRect(hwnd, &rc1); GetClientRect(hwnd, &rc2); DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)&rc1); 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", - rc1.left, rc1.top, rc1.right, rc1.bottom, - rc2.left, rc2.top, rc2.right, rc2.bottom); + ok(EqualRect(&rc1, &rc2), "rects do not match, window=%s client=%s\n", + wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); } /* fall through */ case WM_WINDOWPOSCHANGING: @@ -2007,11 +2000,11 @@ static LRESULT WINAPI mdi_main_wnd_procA(HWND hwnd, UINT msg, WPARAM wparam, LPA RECT rc1, rc2; 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); /* note: winpos coordinates are relative to parent */ 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"); GetWindowRect(hwnd, &rc1); @@ -2366,12 +2359,12 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2) SetRect(&rect, 111, 222, 333, 444); ok(!GetWindowRect(0, &rect), "GetWindowRect succeeded\n"); 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); ok(!GetClientRect(0, &rect), "GetClientRect succeeded\n"); 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); @@ -2380,21 +2373,21 @@ static void test_SetWindowPos(HWND hwnd, HWND hwnd2) ok(ret, "Got %d\n", ret); GetWindowRect( hwnd, &rect ); 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 ); MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 ); 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); ok(ret, "Got %d\n", ret); GetWindowRect( hwnd, &rect ); 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 ); MapWindowPoints( hwnd, 0, (POINT *)&rect, 2 ); 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, 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); ok(ret, "Got %d\n", ret); GetWindowRect(hwnd_child, &rc2); - ok(rc1.left == rc2.left && rc1.top == rc2.top && - 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); + ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); check_active_state(hwnd2, hwnd2, hwnd2); /* 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); ok(ret, "Got %d\n", ret); GetWindowRect(hwnd2, &rc2); - ok(rc1.left == rc2.left && rc1.top == rc2.top && - 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); + ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); check_active_state(hwnd2, hwnd2, hwnd2); /* .. 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); ok(ret, "Got %d\n", ret); GetWindowRect(hwnd_grandchild, &rc2); - ok(rc1.left == rc2.left && rc1.top == rc2.top && - 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); + ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); check_active_state(hwnd2, hwnd2, hwnd2); /* 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); ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top && (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom, - "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n", - rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, rc2.left, rc2.top, rc2.right, rc2.bottom); + "(%d,%d)-(%d,%d) != %s\n", rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, + wine_dbgstr_rect(&rc2)); check_active_state(hwnd2, hwnd2, hwnd2); /* 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); ok((rc1.left+1) == rc2.left && (rc1.top+2) == rc2.top && (rc1.left+4) == rc2.right && (rc1.top+6) == rc2.bottom, - "(%d, %d, %d, %d) != (%d, %d, %d, %d)\n", - rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, rc2.left, rc2.top, rc2.right, rc2.bottom); + "(%d,%d)-(%d,%d) != %s\n", rc1.left+1, rc1.top+2, rc1.left+4, rc1.top+6, + wine_dbgstr_rect(&rc2)); check_active_state(hwnd2, hwnd2, hwnd2); /* 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); ok(!ret, "Got %d\n", ret); GetWindowRect(hwnd_child, &rc2); - ok(rc1.top == rc2.top && rc1.left == rc2.left && - 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); + ok(EqualRect(&rc1, &rc2), "%s != %s\n", wine_dbgstr_rect(&rc1), wine_dbgstr_rect(&rc2)); check_active_state(hwnd2, hwnd2, hwnd2); 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"); 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("rgn: %d,%d-%d,%d\n", rgn_rect.left, rgn_rect.top, rgn_rect.right, rgn_rect.bottom ); + trace("win: %s\n", wine_dbgstr_rect(&win_rect)); + 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", rgn_rect.left, win_rect.left ); 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 ); 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, 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 ); 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; y = rc.top + (rc.bottom - rc.top) / 2; @@ -3832,8 +3813,7 @@ static void test_validatergn(HWND hwnd) ret = GetUpdateRect( child, &rc2, 0); ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret); 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, - rc2.right, rc2.bottom); + "Update rectangle %s is not empty!\n", wine_dbgstr_rect(&rc2)); /* now test ValidateRgn */ InvalidateRect( child, NULL, 1); @@ -3844,8 +3824,7 @@ static void test_validatergn(HWND hwnd) ret = GetUpdateRect( child, &rc2, 0); ok( !ret, "Expected GetUpdateRect to return zero, got %d\n", ret); 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, - rc2.right, rc2.bottom); + "Update rectangle %s is not empty!\n", wine_dbgstr_rect(&rc2)); DeleteObject( rgn); DestroyWindow( child ); @@ -3858,8 +3837,7 @@ static void nccalchelper(HWND hwnd, INT x, INT y, RECT *prc) GetWindowRect( hwnd, prc); rc = *prc; DefWindowProcA(hwnd, WM_NCCALCSIZE, 0, (LPARAM)prc); - trace("window rect is %d,%d - %d,%d, nccalc rect is %d,%d - %d,%d\n", - rc.left,rc.top,rc.right,rc.bottom, prc->left,prc->top,prc->right,prc->bottom); + trace("window rect is %s, nccalc rect is %s\n", wine_dbgstr_rect(&rc), wine_dbgstr_rect(prc)); } 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 */ nccalchelper( hwnd, 100, sbheight, &rc1); - ok( rc1.bottom - rc1.top == sbheight, "Height should be %d size is %d,%d - %d,%d\n", - sbheight, rc1.left, rc1.top, rc1.right, rc1.bottom); + ok( rc1.bottom - rc1.top == sbheight, "Height should be %d size is %s\n", sbheight, + wine_dbgstr_rect(&rc1)); /* test window just high enough for a horizontal scroll bar */ nccalchelper( hwnd, 100, sbheight + 1, &rc1); - ok( rc1.bottom - rc1.top == 1, "Height should be %d size is %d,%d - %d,%d\n", - 1, rc1.left, rc1.top, rc1.right, rc1.bottom); + ok( rc1.bottom - rc1.top == 1, "Height should be 1 size is %s\n", wine_dbgstr_rect(&rc1)); /* test window too narrow for a vertical scroll bar */ nccalchelper( hwnd, sbwidth - 1, 100, &rc1); - ok( rc1.right - rc1.left == sbwidth - 1 , "Width should be %d size is %d,%d - %d,%d\n", - sbwidth - 1, rc1.left, rc1.top, rc1.right, rc1.bottom); + ok( rc1.right - rc1.left == sbwidth - 1 , "Width should be %d size is %s\n", sbwidth - 1, + wine_dbgstr_rect(&rc1)); /* test window just wide enough for a vertical scroll bar */ nccalchelper( hwnd, sbwidth, 100, &rc1); - ok( rc1.right - rc1.left == 0, "Width should be %d size is %d,%d - %d,%d\n", - 0, rc1.left, rc1.top, rc1.right, rc1.bottom); + ok( rc1.right - rc1.left == 0, "Width should be 0 size is %s\n", wine_dbgstr_rect(&rc1)); /* same test, but with client edge: not enough width */ SetWindowLongA( hwnd, GWL_EXSTYLE, WS_EX_CLIENTEDGE | GetWindowLongA( hwnd, GWL_EXSTYLE)); nccalchelper( hwnd, sbwidth, 100, &rc1); ok( rc1.right - rc1.left == sbwidth - 2 * GetSystemMetrics(SM_CXEDGE), - "Width should be %d size is %d,%d - %d,%d\n", - sbwidth - 2 * GetSystemMetrics(SM_CXEDGE), rc1.left, rc1.top, rc1.right, rc1.bottom); + "Width should be %d size is %s\n", sbwidth - 2 * GetSystemMetrics(SM_CXEDGE), + wine_dbgstr_rect(&rc1)); 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) { return 0; } +static LRESULT expected_id; + static INT_PTR WINAPI empty_dlg_proc3(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { 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); + } 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; BOOL parent_is_child; 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; @@ -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); 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); } 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; HWND hwnd, grand_parent = 0, parent = 0; struct dialog_param param; + LRESULT id, ret; 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); 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 ); style = GetWindowLongA(hwnd, GWL_STYLE); @@ -4824,8 +4887,7 @@ static void test_scrollvalidate( HWND parent) SetRectRgn( tmprgn, 0,93,98,98); CombineRgn( exprgn, exprgn, tmprgn, RGN_OR); ok( EqualRgn( exprgn, hrgn), "wrong update region\n"); - trace("update rect is %d,%d - %d,%d\n", - rcu.left,rcu.top,rcu.right,rcu.bottom); + trace("update rect is %s\n", wine_dbgstr_rect(&rcu)); /* now with clipping region */ SelectClipRgn( hdc, clipping); ScrollDC( hdc, -10, -5, &rc, &cliprc, hrgn, &rcu); @@ -4837,8 +4899,7 @@ static void test_scrollvalidate( HWND parent) SetRectRgn( tmprgn, 10,85,90,90); CombineRgn( exprgn, exprgn, tmprgn, RGN_OR); ok( EqualRgn( exprgn, hrgn), "wrong update region\n"); - trace("update rect is %d,%d - %d,%d\n", - rcu.left,rcu.top,rcu.right,rcu.bottom); + trace("update rect is %s\n", wine_dbgstr_rect(&rcu)); ReleaseDC( hwnd1, hdc); /* 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); ok( EqualRgn( exprgn, hrgn), "wrong update region\n"); 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 */ ValidateRect( hwnd1, NULL); @@ -5021,12 +5082,11 @@ static void test_scrolldc( HWND parent) /* test with NULL clip rect */ ScrollDC( hdc, 20, -20, &rc, NULL, hrgn, &rcu); /*FillRgn(hdc, hrgn, GetStockObject(WHITE_BRUSH));*/ - trace("update rect: %d,%d - %d,%d\n", - rcu.left, rcu.top, rcu.right, rcu.bottom); + trace("update rect: %s\n", wine_dbgstr_rect(&rcu)); if (winetest_debug > 0) dump_region(hrgn); SetRect(&rc2, 0, 0, 100, 100); - ok(EqualRect(&rcu, &rc2), "rects do not match (%d,%d-%d,%d) / (%d,%d-%d,%d)\n", - rcu.left, rcu.top, rcu.right, rcu.bottom, rc2.left, rc2.top, rc2.right, rc2.bottom); + ok(EqualRect(&rcu, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rcu), + wine_dbgstr_rect(&rc2)); SetRectRgn( exprgn, 0, 0, 20, 80); SetRectRgn( tmprgn, 0, 80, 100, 100); @@ -5043,8 +5103,7 @@ static void test_scrolldc( HWND parent) SetRectRgn( tmprgn, 25, 35, 35, 75); CombineRgn(exprgn, exprgn, tmprgn, RGN_OR); ok(EqualRgn(exprgn, hrgn), "wrong update region\n"); - trace("update rect: %d,%d - %d,%d\n", - rcu.left, rcu.top, rcu.right, rcu.bottom); + trace("update rect: %s\n", wine_dbgstr_rect(&rcu)); if (winetest_debug > 0) dump_region(hrgn); /* clean up */ @@ -5186,9 +5245,8 @@ static void test_AWR_flags(void) rect2 = rect; AdjustWindowRectEx( &rect, 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", - rect.left, rect.top, rect.right, rect.bottom, - rect2.left, rect2.top, rect2.right, rect2.bottom ); + ok( EqualRect( &rect, &rect2 ), "rects do not match: win %s wine %s\n", + wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &rect2 )); } } } @@ -5306,18 +5364,16 @@ static LRESULT WINAPI parentdc_window_procA(HWND hwnd, UINT msg, WPARAM wparam, { case WM_PAINT: GetClientRect(hwnd, &rc); - CopyRect(&t->client, &rc); + t->client = rc; GetWindowRect(hwnd, &rc); - trace("WM_PAINT: hwnd %p, client rect (%d,%d)-(%d,%d), window rect (%d,%d)-(%d,%d)\n", hwnd, - t->client.left, t->client.top, t->client.right, t->client.bottom, - rc.left, rc.top, rc.right, rc.bottom); + trace("WM_PAINT: hwnd %p, client rect %s, window rect %s\n", hwnd, + wine_dbgstr_rect(&t->client), wine_dbgstr_rect(&rc)); BeginPaint(hwnd, &ps); - CopyRect(&t->paint, &ps.rcPaint); + t->paint = ps.rcPaint; GetClipBox(ps.hdc, &rc); - CopyRect(&t->clip, &rc); - trace("clip rect (%d,%d)-(%d,%d), paint rect (%d,%d)-(%d,%d)\n", - rc.left, rc.top, rc.right, rc.bottom, - ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom); + t->clip = rc; + trace("clip rect %s, paint rect %s\n", wine_dbgstr_rect(&rc), + wine_dbgstr_rect(&ps.rcPaint)); EndPaint(hwnd, &ps); return 0; } @@ -5684,8 +5740,8 @@ static LRESULT CALLBACK winsizes_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM { RECT rect; GetWindowRect( hwnd, &rect ); - ok( !rect.left && !rect.top && !rect.right && !rect.bottom, - "wrong rect %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom ); + ok( !rect.left && !rect.top && !rect.right && !rect.bottom, "wrong rect %s\n", + wine_dbgstr_rect( &rect )); return DefWindowProcA(hwnd, msg, wp, lp); } case WM_NCCREATE: @@ -5694,8 +5750,8 @@ static LRESULT CALLBACK winsizes_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM CREATESTRUCTA *cs = (CREATESTRUCTA *)lp; RECT rect; GetWindowRect( hwnd, &rect ); - trace( "hwnd %p msg %x size %dx%d rect %d,%d-%d,%d\n", - hwnd, msg, cs->cx, cs->cy, rect.left, rect.top, rect.right, rect.bottom ); + trace( "hwnd %p msg %x size %dx%d rect %s\n", hwnd, msg, cs->cx, cs->cy, + wine_dbgstr_rect( &rect )); ok( cs->cx == expected_cx || broken(cs->cx == (short)expected_cx), "wrong x size %d/%d\n", cs->cx, expected_cx ); 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) || 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), - "wrong rect %d,%d-%d,%d / %d,%d-%d,%d\n", - rect.left, rect.top, rect.right, rect.bottom, - expected_rect.left, expected_rect.top, expected_rect.right, expected_rect.bottom ); + "wrong rect %s / %s\n", wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &expected_rect )); return DefWindowProcA(hwnd, msg, wp, lp); } case WM_NCCALCSIZE: { RECT rect, *r = (RECT *)lp; GetWindowRect( hwnd, &rect ); - ok( !memcmp( &rect, r, sizeof(rect) ), - "passed rect %d,%d-%d,%d doesn't match window rect %d,%d-%d,%d\n", - r->left, r->top, r->right, r->bottom, rect.left, rect.top, rect.right, rect.bottom ); + ok( EqualRect( &rect, r ), "passed rect %s doesn't match window rect %s\n", + wine_dbgstr_rect( r ), wine_dbgstr_rect( &rect )); return DefWindowProcA(hwnd, msg, wp, lp); } default: @@ -5976,7 +6029,7 @@ static void test_CreateWindow(void) ok(!IsRectEmpty(&rc), "parent client rect is empty\n"); 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); 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); 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", - rc.left, rc.top, rc.right, rc.bottom, - rc_minmax.left, rc_minmax.top, rc_minmax.right, rc_minmax.bottom); + ok(EqualRect(&rc, &rc_minmax), "rects don't match: %s and %s\n", wine_dbgstr_rect(&rc), + wine_dbgstr_rect(&rc_minmax)); DestroyWindow(hwnd); 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_MAXIMIZE), "window should not be maximized\n"); GetWindowRect(hwnd, &rc); - ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain), + wine_dbgstr_rect(&rc)); ret = ShowWindow(hwnd, SW_SHOW); 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_MAXIMIZE), "window should not be maximized\n"); GetWindowRect(hwnd, &rc); - ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain), + wine_dbgstr_rect(&rc)); ret = ShowWindow(hwnd, SW_MINIMIZE); 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_MAXIMIZE), "window should not be maximized\n"); GetWindowRect(hwnd, &rc); - ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain), + wine_dbgstr_rect(&rc)); ret = EnableWindow(hwnd, FALSE); 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_MAXIMIZE), "window should not be maximized\n"); GetWindowRect(hwnd, &rc); - ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain), + wine_dbgstr_rect(&rc)); ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0); 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_MAXIMIZE), "window should not be maximized\n"); GetWindowRect(hwnd, &rc); - ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain), + wine_dbgstr_rect(&rc)); ret = ShowWindow(hwnd, SW_MINIMIZE); 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_MAXIMIZE), "window should not be maximized\n"); GetWindowRect(hwnd, &rc); - ok(EqualRect(&rcMain, &rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", - rcMain.left, rcMain.top, rcMain.right, rcMain.bottom, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rcMain, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rcMain), + wine_dbgstr_rect(&rc)); ret = DefWindowProcA(hwnd, WM_SYSCOMMAND, SC_CLOSE, 0); ok(!ret, "not expected ret: %lu\n", ret); @@ -6580,16 +6626,14 @@ static void test_GetUpdateRect(void) SetRectEmpty(&rc2); ret = GetUpdateRect(hgrandparent, &rc1, FALSE); 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", - rc1.left, rc1.top, rc1.right, rc1.bottom, - rc2.left, rc2.top, rc2.right, rc2.bottom); + ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1), + wine_dbgstr_rect(&rc2)); SetRect(&rc2, 10, 10, 40, 40); ret = GetUpdateRect(hparent, &rc1, FALSE); ok(ret, "GetUpdateRect returned empty region\n"); - ok(EqualRect(&rc1, &rc2), "rects do not match (%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); + ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1), + wine_dbgstr_rect(&rc2)); parent_wm_paint = FALSE; grandparent_wm_paint = FALSE; @@ -6644,16 +6688,14 @@ static void test_GetUpdateRect(void) SetRectEmpty(&rc2); ret = GetUpdateRect(hgrandparent, &rc1, FALSE); 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", - rc1.left, rc1.top, rc1.right, rc1.bottom, - rc2.left, rc2.top, rc2.right, rc2.bottom); + ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1), + wine_dbgstr_rect(&rc2)); SetRect(&rc2, 10, 10, 40, 40); ret = GetUpdateRect(hparent, &rc1, FALSE); ok(ret, "GetUpdateRect returned empty region\n"); - ok(EqualRect(&rc1, &rc2), "rects do not match (%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); + ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1), + wine_dbgstr_rect(&rc2)); parent_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 ); GetWindowRect( parent, &rect ); 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 ); 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 */ @@ -7124,8 +7166,7 @@ static LRESULT CALLBACK fullscreen_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPAR CREATESTRUCTA *cs = (CREATESTRUCTA *)lp; ok(cs->x == mi.rcMonitor.left && cs->y == mi.rcMonitor.top && cs->cx == mi.rcMonitor.right && cs->cy == mi.rcMonitor.bottom, - "expected %d,%d-%d,%d, got %d,%d-%d,%d\n", - mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom, + "expected %s, got (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&mi.rcMonitor), cs->x, cs->y, cs->cx, cs->cy); break; } @@ -7173,9 +7214,7 @@ static void test_fullscreen(void) SetLastError(0xdeadbeef); ret = pGetMonitorInfoA(hmon, &mi); ok(ret, "GetMonitorInfo error %u\n", GetLastError()); - trace("monitor (%d,%d-%d,%d), work (%d,%d-%d,%d)\n", - mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom, - mi.rcWork.left, mi.rcWork.top, mi.rcWork.right, mi.rcWork.bottom); + trace("monitor %s, work %s\n", wine_dbgstr_rect(&mi.rcMonitor), wine_dbgstr_rect(&mi.rcWork)); cls.style = 0; cls.lpfnWndProc = fullscreen_wnd_proc; @@ -7208,10 +7247,10 @@ static void test_fullscreen(void) GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); 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 && 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); style = t_style[i] | WS_MAXIMIZE; @@ -7220,10 +7259,10 @@ static void test_fullscreen(void) GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); 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 && 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); style = t_style[i] | WS_MAXIMIZE | WS_CAPTION; @@ -7232,10 +7271,10 @@ static void test_fullscreen(void) GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); 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 && 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); style = t_style[i] | WS_CAPTION | WS_MAXIMIZEBOX; @@ -7244,10 +7283,10 @@ static void test_fullscreen(void) GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); 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 && 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); style = t_style[i] | WS_MAXIMIZE | WS_CAPTION | WS_MAXIMIZEBOX; @@ -7256,15 +7295,14 @@ static void test_fullscreen(void) GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); 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?) */ fixup = min(abs(rc.left), abs(rc.top)); InflateRect(&rc, -fixup, -fixup); ok(rc.left >= mi.rcMonitor.left && rc.top >= mi.rcMonitor.top && 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", - ex_style, style, rc.left, rc.top, rc.right, rc.bottom, - mi.rcMonitor.left, mi.rcMonitor.top, mi.rcMonitor.right, mi.rcMonitor.bottom); + "%#x/%#x: window rect %s must be in %s\n", ex_style, style, wine_dbgstr_rect(&rc), + wine_dbgstr_rect(&mi.rcMonitor)); DestroyWindow(hwnd); style = t_style[i] | WS_MAXIMIZE | WS_MAXIMIZEBOX; @@ -7273,18 +7311,18 @@ static void test_fullscreen(void) GetDesktopWindow(), 0, GetModuleHandleA(NULL), NULL); ok(hwnd != 0, "%d: CreateWindowExA(%#x/%#x) failed\n", i, ex_style, style); 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?) */ fixup = min(abs(rc.left), abs(rc.top)); InflateRect(&rc, -fixup, -fixup); if (style & (WS_CHILD | WS_POPUP)) ok(rc.left <= mi.rcMonitor.left && rc.top <= mi.rcMonitor.top && 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 ok(rc.left >= mi.rcMonitor.left && rc.top >= mi.rcMonitor.top && 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); } } @@ -7594,8 +7632,7 @@ static void test_winregion(void) ret = pGetWindowRgnBox(hwnd, &r); ok( ret == SIMPLEREGION, "Expected SIMPLEREGION, got %d\n", ret); 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, - r.right, r.bottom); + "Expected (2,3)-(10,15), got %s\n", wine_dbgstr_rect( &r )); if (pMirrorRgn) { hrgn = CreateRectRgn(2, 3, 10, 15); @@ -7608,7 +7645,7 @@ static void test_winregion(void) ret = GetRgnBox( hrgn, &r ); ok( ret == SIMPLEREGION, "GetRgnBox failed %u\n", ret ); 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" ); } @@ -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); 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 ); - 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 ); - 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 ); - 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 ); - 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 ); - 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 ); MapWindowPoints( NULL, parent, (POINT *)&r, 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; MapWindowPoints( child, parent, &pt, 1 ); 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 ); 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 ); - 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 ); 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 ); - 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 ); 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 ); - 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 ); 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 ); - 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( parent ); }