Damjan Jovanovic : shell32/tests: Add more tests for Shell_MergeMenus().

Alexandre Julliard julliard at winehq.org
Fri Apr 30 16:03:27 CDT 2021


Module: wine
Branch: master
Commit: 7af66935a02260dd182b228e02f3852a6a7ed1dd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=7af66935a02260dd182b228e02f3852a6a7ed1dd

Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date:   Fri Apr 30 07:39:04 2021 +0200

shell32/tests: Add more tests for Shell_MergeMenus().

Show Shell_MergeMenus() really adds the offset instead of
changing IDs to start with it, and that it really honours
the maximum allowed value.

Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/tests/shlfileop.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c
index 726585e39a2..dc3572abf3d 100644
--- a/dlls/shell32/tests/shlfileop.c
+++ b/dlls/shell32/tests/shlfileop.c
@@ -2661,10 +2661,36 @@ static void test_unicode(void)
 static void
 test_shlmenu(void) {
 	HRESULT hres;
+	HMENU src_menu, dst_menu;
+	int count;
+	MENUITEMINFOA item_info;
+	BOOL bres;
+
 	hres = Shell_MergeMenus (0, 0, 0x42, 0x4242, 0x424242, 0);
 	ok (hres == 0x4242, "expected 0x4242 but got %x\n", hres);
 	hres = Shell_MergeMenus ((HMENU)42, 0, 0x42, 0x4242, 0x424242, 0);
 	ok (hres == 0x4242, "expected 0x4242 but got %x\n", hres);
+
+	src_menu = CreatePopupMenu ();
+	ok (src_menu != NULL, "CreatePopupMenu() failed, error %d\n", GetLastError ());
+	dst_menu = CreatePopupMenu ();
+	ok (dst_menu != NULL, "CreatePopupMenu() failed, error %d\n", GetLastError ());
+	bres = InsertMenuA (src_menu, -1, MF_BYPOSITION | MF_STRING, 10, "item1");
+        ok (bres, "InsertMenuA failed, error %d\n", GetLastError());
+	bres = InsertMenuA (src_menu, -1, MF_BYPOSITION | MF_STRING, 11, "item2");
+        ok (bres, "InsertMenuA failed, error %d\n", GetLastError());
+	hres = Shell_MergeMenus (dst_menu, src_menu, 0, 123, 133, MM_SUBMENUSHAVEIDS);
+	ok (hres == 134, "got %d\n", hres);
+	count = GetMenuItemCount (dst_menu);
+	ok (count == 1, "got %d\n", count);
+	memset (&item_info, 0, sizeof(item_info));
+	item_info.cbSize = sizeof(item_info);
+	item_info.fMask = MIIM_ID;
+	bres = GetMenuItemInfoA (dst_menu, 0, TRUE, &item_info);
+	ok (bres, "GetMenuItemInfoA failed, error %d\n", GetLastError ());
+	ok (item_info.wID == 133, "got %d\n", item_info.wID);
+	DestroyMenu (dst_menu);
+	DestroyMenu (src_menu);
 }
 
 /* Check for old shell32 (4.0.x) */




More information about the wine-cvs mailing list