From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/user32/tests/win.c | 60 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index f899008f394..dd3aff21afa 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -2581,6 +2581,10 @@ static void test_mdi(void) static const DWORD style[] = { 0, WS_HSCROLL, WS_VSCROLL, WS_HSCROLL | WS_VSCROLL }; HWND mdi_hwndMain, mdi_client, mdi_child; CLIENTCREATESTRUCT client_cs; + MENUITEMINFOA item_info; + char item_string[50]; + int count; + BOOL ret; RECT rc; DWORD i; MSG msg; @@ -2777,16 +2781,66 @@ static void test_mdi(void) GetMenuItemCount(frame_menu));
child_menu = CreateMenu(); - SendMessageW(mdi_client, WM_MDISETMENU, 0, (LPARAM)child_menu); + ret = SendMessageW(mdi_client, WM_MDISETMENU, 0, (LPARAM)child_menu); + todo_wine ok(ret == (UINT_PTR)frame_menu, "got %#x\n", ret); + + /* Without this call the menu string won't update. + * Is native skipping a menu update if the menu isn't attached to anything? */ + ret = AppendMenuA(frame_menu, MF_POPUP, (UINT_PTR)child_menu, "menu" ); + ok(ret == TRUE, "got error %lu\n", GetLastError()); + + count = GetMenuItemCount(child_menu); + todo_wine ok(count == 2, "Got count %d.\n", count); + + item_info.cbSize = sizeof(item_info); + item_info.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STATE; + ret = GetMenuItemInfoA(child_menu, 0, TRUE, &item_info); + todo_wine ok(ret == TRUE, "got error %lu\n", GetLastError()); + if (ret) + { + ok(item_info.fType == MF_SEPARATOR, "got type %#x\n", item_info.fType); + ok(!item_info.wID, "got ID %#x\n", item_info.wID); + ok(item_info.fState == MFS_GRAYED, "got state %#x\n", item_info.fState); + } + + item_info.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STATE | MIIM_STRING; + item_info.dwTypeData = item_string; + item_info.cch = sizeof(item_string); + ret = GetMenuItemInfoA(child_menu, 1, TRUE, &item_info); + todo_wine ok(ret == TRUE, "got error %lu\n", GetLastError()); + if (ret) + { + ok(item_info.fType == MF_STRING, "got type %#x\n", item_info.fType); + ok(item_info.wID == 1, "got ID %#x\n", item_info.wID); + ok(item_info.fState == MFS_CHECKED, "got state %#x\n", item_info.fState); + ok(!strcmp(item_string, "&1 MDI child"), "got string %s\n", debugstr_a(item_string)); + } + + ret = SetWindowTextA(mdi_child, "new title"); + ok(ret == TRUE, "got %#x\n", ret); + + item_info.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STATE | MIIM_STRING; + item_info.dwTypeData = item_string; + item_info.cch = sizeof(item_string); + ret = GetMenuItemInfoA(child_menu, 1, TRUE, &item_info); + todo_wine ok(ret == TRUE, "got error %lu\n", GetLastError()); + if (ret) + { + ok(item_info.fType == MF_STRING, "got type %#x\n", item_info.fType); + ok(item_info.wID == 1, "got ID %#x\n", item_info.wID); + ok(item_info.fState == MFS_CHECKED, "got state %#x\n", item_info.fState); + ok(!strcmp(item_string, "&1 new title"), "got string %s\n", debugstr_a(item_string)); + }
- ok(GetMenuItemCount(frame_menu) == 4, "Frame menu should have 4 items after WM_MDISETMENU, but has %u\n", + ok(GetMenuItemCount(frame_menu) == 5, "Frame menu should have 4 items after WM_MDISETMENU, but has %u\n", GetMenuItemCount(frame_menu));
SendMessageW(mdi_child, WM_SIZE, SIZE_RESTORED, 0);
- ok(GetMenuItemCount(frame_menu) == 0, "Frame menu should be empty after child restored, but has %u items\n", + ok(GetMenuItemCount(frame_menu) == 1, "Frame menu should be empty after child restored, but has %u items\n", GetMenuItemCount(frame_menu));
+ RemoveMenu(frame_menu, 0, MF_BYPOSITION); DestroyMenu(child_menu); DestroyWindow(mdi_child); DestroyWindow(mdi_client);
From: Elizabeth Figura zfigura@codeweavers.com
Even if there was not a previous menu. --- dlls/user32/mdi.c | 4 ++-- dlls/user32/tests/win.c | 39 +++++++++++++++------------------------ 2 files changed, 17 insertions(+), 26 deletions(-)
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index f023eb5e39d..dfbb620a17a 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -306,12 +306,12 @@ static LRESULT MDISetMenu( HWND hwnd, HMENU hmenuFrame,
ci->hWindowMenu = hmenuWindow;
- /* Add items to the new Window menu */ ci->nActiveChildren = nActiveChildren_old; - MDI_RefreshMenu(ci); } else ci->hWindowMenu = hmenuWindow; + + MDI_RefreshMenu(ci); }
if (hmenuFrame) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index dd3aff21afa..b820d72782b 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -2790,31 +2790,25 @@ static void test_mdi(void) ok(ret == TRUE, "got error %lu\n", GetLastError());
count = GetMenuItemCount(child_menu); - todo_wine ok(count == 2, "Got count %d.\n", count); + ok(count == 2, "Got count %d.\n", count);
item_info.cbSize = sizeof(item_info); item_info.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STATE; ret = GetMenuItemInfoA(child_menu, 0, TRUE, &item_info); - todo_wine ok(ret == TRUE, "got error %lu\n", GetLastError()); - if (ret) - { - ok(item_info.fType == MF_SEPARATOR, "got type %#x\n", item_info.fType); - ok(!item_info.wID, "got ID %#x\n", item_info.wID); - ok(item_info.fState == MFS_GRAYED, "got state %#x\n", item_info.fState); - } + ok(ret == TRUE, "got error %lu\n", GetLastError()); + ok(item_info.fType == MF_SEPARATOR, "got type %#x\n", item_info.fType); + ok(!item_info.wID, "got ID %#x\n", item_info.wID); + ok(item_info.fState == MFS_GRAYED, "got state %#x\n", item_info.fState);
item_info.fMask = MIIM_ID | MIIM_FTYPE | MIIM_STATE | MIIM_STRING; item_info.dwTypeData = item_string; item_info.cch = sizeof(item_string); ret = GetMenuItemInfoA(child_menu, 1, TRUE, &item_info); - todo_wine ok(ret == TRUE, "got error %lu\n", GetLastError()); - if (ret) - { - ok(item_info.fType == MF_STRING, "got type %#x\n", item_info.fType); - ok(item_info.wID == 1, "got ID %#x\n", item_info.wID); - ok(item_info.fState == MFS_CHECKED, "got state %#x\n", item_info.fState); - ok(!strcmp(item_string, "&1 MDI child"), "got string %s\n", debugstr_a(item_string)); - } + ok(ret == TRUE, "got error %lu\n", GetLastError()); + ok(item_info.fType == MF_STRING, "got type %#x\n", item_info.fType); + ok(item_info.wID == 1, "got ID %#x\n", item_info.wID); + ok(item_info.fState == MFS_CHECKED, "got state %#x\n", item_info.fState); + ok(!strcmp(item_string, "&1 MDI child"), "got string %s\n", debugstr_a(item_string));
ret = SetWindowTextA(mdi_child, "new title"); ok(ret == TRUE, "got %#x\n", ret); @@ -2823,14 +2817,11 @@ static void test_mdi(void) item_info.dwTypeData = item_string; item_info.cch = sizeof(item_string); ret = GetMenuItemInfoA(child_menu, 1, TRUE, &item_info); - todo_wine ok(ret == TRUE, "got error %lu\n", GetLastError()); - if (ret) - { - ok(item_info.fType == MF_STRING, "got type %#x\n", item_info.fType); - ok(item_info.wID == 1, "got ID %#x\n", item_info.wID); - ok(item_info.fState == MFS_CHECKED, "got state %#x\n", item_info.fState); - ok(!strcmp(item_string, "&1 new title"), "got string %s\n", debugstr_a(item_string)); - } + ok(ret == TRUE, "got error %lu\n", GetLastError()); + ok(item_info.fType == MF_STRING, "got type %#x\n", item_info.fType); + ok(item_info.wID == 1, "got ID %#x\n", item_info.wID); + ok(item_info.fState == MFS_CHECKED, "got state %#x\n", item_info.fState); + todo_wine ok(!strcmp(item_string, "&1 new title"), "got string %s\n", debugstr_a(item_string));
ok(GetMenuItemCount(frame_menu) == 5, "Frame menu should have 4 items after WM_MDISETMENU, but has %u\n", GetMenuItemCount(frame_menu));
From: Sebastian Lackner sebastian@fds-team.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=21855 --- dlls/user32/mdi.c | 2 ++ dlls/user32/tests/win.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index dfbb620a17a..e2cecc0bf46 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -1357,6 +1357,7 @@ LRESULT WINAPI DefMDIChildProcA( HWND hwnd, UINT message, DefWindowProcA(hwnd, message, wParam, lParam); if( ci->hwndChildMaximized == hwnd ) MDI_UpdateFrameText( GetParent(client), client, TRUE, NULL ); + MDI_RefreshMenu( ci ); return 1; /* success. FIXME: check text length */
case WM_GETMINMAXINFO: @@ -1397,6 +1398,7 @@ LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message, DefWindowProcW(hwnd, message, wParam, lParam); if( ci->hwndChildMaximized == hwnd ) MDI_UpdateFrameText( GetParent(client), client, TRUE, NULL ); + MDI_RefreshMenu( ci ); return 1; /* success. FIXME: check text length */
case WM_GETMINMAXINFO: diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index b820d72782b..08b0a5c88e7 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -2821,7 +2821,7 @@ static void test_mdi(void) ok(item_info.fType == MF_STRING, "got type %#x\n", item_info.fType); ok(item_info.wID == 1, "got ID %#x\n", item_info.wID); ok(item_info.fState == MFS_CHECKED, "got state %#x\n", item_info.fState); - todo_wine ok(!strcmp(item_string, "&1 new title"), "got string %s\n", debugstr_a(item_string)); + ok(!strcmp(item_string, "&1 new title"), "got string %s\n", debugstr_a(item_string));
ok(GetMenuItemCount(frame_menu) == 5, "Frame menu should have 4 items after WM_MDISETMENU, but has %u\n", GetMenuItemCount(frame_menu));
This merge request was approved by Elizabeth Figura.