[PATCH 1/3] user: extend conformance test for remote-menu accesses
tkho at ucla.edu
tkho at ucla.edu
Fri Jun 16 13:07:44 CDT 2006
The following series of patches takes the first step to move menu management
into the server by moving POPUPMENU inside the server.
[PATCH 1/3] user: extend conformance test for remote-menu accesses
[PATCH 2/3] server: add calls to get/set menu info
[PATCH 3/3] user: move menu info handling to the server
Thomas Kho
[PATCH 1/3] user: extend conformance test for remote-menu accesses
menu.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 96 insertions(+)
---
Index: dlls/user/tests/menu.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/menu.c,v
retrieving revision 1.24
diff -u -r1.24 menu.c
--- dlls/user/tests/menu.c 23 May 2006 12:48:49 -0000 1.24
+++ dlls/user/tests/menu.c 15 Jun 2006 02:48:45 -0000
@@ -1681,6 +1681,101 @@
DestroyWindow(hWnd);
}
+static void test_menu_remote_process()
+{
+ char wndTitle[30];
+ int nMenu, elapsed = 0;
+ const int timeout = 1000;
+ DWORD oldMenuData;
+ HMENU hMenu;
+ HWND hNotepad;
+ MENUITEMINFO mii;
+ MENUINFO mi;
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
+
+ memset(&si, 0, sizeof(si));
+ si.cb = sizeof(si);
+ ok (CreateProcess(NULL, "notepad.exe", NULL, NULL, FALSE, 0, NULL, NULL,
+ &si, &pi),
+ "CreateProcess error=%ld\n", GetLastError());
+
+ while (elapsed < timeout)
+ {
+ Sleep(50);
+ elapsed += 50;
+
+ hNotepad = GetForegroundWindow();
+ if (!hNotepad)
+ continue;
+ if (GetWindowText(hNotepad, wndTitle, 30) == 0)
+ continue;
+ if (strstr(wndTitle, "Notepad"))
+ break;
+ }
+
+ ok (elapsed < timeout, "notepad window not found\n");
+
+ hMenu = GetMenu(hNotepad);
+ ok (hMenu != NULL, "GetMenu failed\n");
+
+ nMenu = GetMenuItemCount(hMenu);
+ /* notepad.exe menus slightly differ in Wine and Windows */
+ todo_wine ok(nMenu == 4 || nMenu == 5, "nMenu = %d, error=%ld\n", nMenu,
+ GetLastError());
+
+ memset(&mii, 0, sizeof(mii));
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_STRING;
+ mii.dwTypeData = NULL;
+ todo_wine ok (GetMenuItemInfo(hMenu, 0, TRUE, &mii),
+ "error=%ld\n", GetLastError());
+ mii.dwTypeData = malloc(++mii.cch);
+ todo_wine ok (GetMenuItemInfo(hMenu, 0, TRUE, &mii),
+ "error=%ld, dwTypeData='%s'\n", GetLastError(), mii.dwTypeData);
+ todo_wine ok (mii.dwTypeData && !strcmp(mii.dwTypeData, "&File"),
+ "error=%ld, dwTypeData='%s'\n", GetLastError(), mii.dwTypeData);
+ free(mii.dwTypeData);
+
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_STRING;
+ mii.dwTypeData = "&New File Menu";
+ todo_wine ok (SetMenuItemInfo(hMenu, 0, TRUE, &mii), "error=%ld\n",
+ GetLastError());
+ DrawMenuBar(hNotepad);
+
+ memset(&mii, 0, sizeof(mii));
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_STRING;
+ mii.dwTypeData = NULL;
+ todo_wine ok (GetMenuItemInfo(hMenu, 0, TRUE, &mii),
+ "error=%ld\n", GetLastError());
+ mii.dwTypeData = malloc(++mii.cch);
+ todo_wine ok (GetMenuItemInfo(hMenu, 0, TRUE, &mii),
+ "error=%ld, dwTypeData='%s'\n", GetLastError(), mii.dwTypeData);
+ todo_wine ok (mii.dwTypeData && !strcmp(mii.dwTypeData, "&New File Menu"),
+ "error=%ld, dwTypeData='%s'\n", GetLastError(), mii.dwTypeData);
+ free(mii.dwTypeData);
+
+ mi.cbSize = sizeof(MENUINFO);
+ mi.fMask = MIM_MENUDATA;
+ todo_wine ok (GetMenuInfo(hMenu, &mi), "error=%ld\n", GetLastError());
+ oldMenuData = mi.dwMenuData;
+ mi.dwMenuData = !mi.dwMenuData;
+ todo_wine ok (SetMenuInfo(hMenu, &mi), "error=%ld\n", GetLastError());
+ todo_wine ok (GetMenuInfo(hMenu, &mi), "error=%ld\n", GetLastError());
+ ok (oldMenuData != mi.dwMenuData, "oldMenuData=%ld, dwMenuData=%ld\n",
+ oldMenuData, mi.dwMenuData);
+
+ ok (SetMenu(hNotepad, NULL), "error=%ld\n", GetLastError());
+ hMenu = GetMenu(hNotepad);
+ ok (hMenu == NULL, "GetMenu failed\n");
+
+ TerminateProcess(pi.hProcess, 0);
+ CloseHandle(pi.hProcess);
+ CloseHandle(pi.hThread);
+}
+
START_TEST(menu)
{
pSetMenuInfo =
@@ -1697,4 +1792,5 @@
test_menu_search_bycommand();
test_menu_bmp_and_string();
test_menu_input();
+ test_menu_remote_process();
}
More information about the wine-patches
mailing list