Go to the source code of this file.
|
#define | test_S_OK(hres, message) ok(hres == S_OK, "%s (0x%lx instead of S_OK)\n",message, hResult); |
|
#define | test_HRES(hres, hresExpected, message) ok(hres == hresExpected, "%s (0x%lx instead of 0x%lx)\n",message, hResult,hresExpected); |
|
◆ test_HRES
◆ test_S_OK
◆ CheckWindowClass()
Definition at line 17 of file menu.cpp.
18{
22 {
25 }
29}
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
int WINAPI GetClassNameW(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPWSTR lpClassName, _In_ int nMaxCount)
Referenced by test_CShellMenu(), and test_CShellMenu_with_DeskBar().
◆ CreateCShellMenu()
Definition at line 61 of file menu.cpp.
62{
64 hResult =
CoCreateInstance(CLSID_MenuBand,
NULL, CLSCTX_INPROC_SERVER, IID_IShellMenu,
reinterpret_cast<void **
>(shellMenu));
65 test_S_OK(hResult,
"Failed to instantiate CLSID_MenuBand");
66 if (!shellMenu)
return FALSE;
67
68 hResult = (*shellMenu)->
QueryInterface(IID_IDockingWindow,
reinterpret_cast<void **
>(dockingMenu));
69 test_S_OK(hResult,
"Failed to query IID_IDockingWindow");
71 test_S_OK(hResult,
"Failed to query IID_IObjectWithSite");
72 if (!dockingMenu || !menuWithSite)
return FALSE;
74}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
const IID IID_IObjectWithSite
Referenced by test_CShellMenu(), test_CShellMenu_callbacks(), test_CShellMenu_params(), and test_CShellMenu_with_DeskBar().
◆ START_TEST()
Definition at line 405 of file menu.cpp.
406{
408
412 test_S_OK(hResult,
"SHGetDesktopFolder failed");
413
421 iteminfo.
cbSize =
sizeof(iteminfo);
427
432}
HRESULT WINAPI SHGetDesktopFolder(IShellFolder **psf)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
@ COINIT_APARTMENTTHREADED
HMENU WINAPI CreatePopupMenu(void)
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
BOOL WINAPI AppendMenuW(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCWSTR)
◆ test_CShellMenu()
Definition at line 160 of file menu.cpp.
161{
168
172
174 {
175 skip(
"failed to create CShellMenuObject\n");
176 delete dummyWindow;
177 return;
178 }
179
181 test_S_OK(hResult,
"SHGetDesktopFolder failed");
182
183 hResult = shellMenu->
Initialize(
NULL, 0, ANCESTORDEFAULT, SMINIT_TOPLEVEL|SMINIT_VERTICAL);
185
187 test_S_OK(hResult,
"SetShellFolder failed");
188
189 hResult = menuWithSite->
SetSite(dummyWindow);
191
192 hResult = dockingMenu->
GetWindow(&hwndToolbar);
194 ok(hwndToolbar !=
NULL,
"GetWindow should return a window\n");
195
200
204 ok(!
IsWindow(hwndToolbar),
"The toolbar window should not exist\n");
205
207}
HRESULT SetSite([in] IUnknown *pUnkSite)
HRESULT GetWindow([out] HWND *phwnd)
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
Referenced by START_TEST().
◆ test_CShellMenu_callbacks()
Definition at line 289 of file menu.cpp.
290{
296
301
303 {
304 skip(
"failed to create CShellMenuObject\n");
305 delete dummyWindow;
306 return;
307 }
308
309 struct _test_info cbtest_info[] = { {1, SMC_CREATE},
310 {2, SMC_GETSFOBJECT},
311 {3, 0x31},
312 {4, SMC_INITMENU},
313 {4, 53},
314 {4, 19},
315 {4, 0x10000000},
316 {4, SMC_NEWITEM},
317 {4, 20},
318 {4, 19},
319 {4, 6},
320 {4, 20},
321 {4, 8},
322 {4, 24},
323 {4, 5},
324 {4, 5},
325 {4, 5}};
326
328
330 hResult = shellMenu->
Initialize(
callback, 0,ANCESTORDEFAULT, SMINIT_TOPLEVEL|SMINIT_VERTICAL);
332
335 test_S_OK(hResult,
"SetShellFolder failed");
336
340
341 hResult = menuWithSite->
SetSite(dummyWindow);
343
347}
HRESULT ShowDW([in] BOOL fShow)
static IPrintDialogCallback callback
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
Referenced by START_TEST().
◆ test_CShellMenu_params()
void test_CShellMenu_params |
( |
| ) |
|
Definition at line 77 of file menu.cpp.
78{
83
93
95 {
96 skip(
"failed to create CShellMenuObject\n");
97 return;
98 }
99
102
104 test_S_OK(hResult,
"GetMenuInfo failed");
105 ok (psmc ==
NULL,
"wrong psmc\n");
106 ok (uId == 11,
"wrong uid\n");
107 ok (uIdAncestor == 22,
"wrong uIdAncestor\n");
108 ok (
dwFlags == 0xdeadbeef,
"wrong dwFlags\n");
109
110 hResult = shellMenu->
Initialize(
NULL, 0, ANCESTORDEFAULT, SMINIT_TOPLEVEL|SMINIT_VERTICAL);
112
113 hResult = dockingMenu->
GetWindow(&hwndToolbar);
115
116 hResult = shellMenu->
GetMenu(&
hmenu, &hwndOwner, &menuFlagss);
118
122
124 hResult = dockingMenu->
GetWindow(&hwndToolbar);
126 ok (hwndToolbar ==
NULL,
"Expected NULL window\n");
127
130
131 hResult = shellMenu->
GetMenu(&
hmenu, &hwndOwner, &menuFlagss);
134
135 hResult = dockingMenu->
GetWindow(&hwndToolbar);
137
139 test_S_OK(hResult,
"SHGetDesktopFolder failed");
140
142 test_S_OK(hResult,
"SetShellFolder failed");
143
146
148 hResult = dockingMenu->
GetWindow(&hwndToolbar);
150 ok (hwndToolbar ==
NULL,
"Expected NULL window\n");
151
154
158}
#define UlongToHandle(ul)
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Referenced by START_TEST().
◆ test_CShellMenu_with_DeskBar()
Definition at line 349 of file menu.cpp.
350{
357
358
360 hResult =
CoCreateInstance(CLSID_MenuDeskBar,
NULL, CLSCTX_INPROC_SERVER, IID_IMenuPopup,
reinterpret_cast<void **
>(&menuPopup));
361 test_S_OK(hResult,
"Failed to instantiate CLSID_MenuDeskBar");
363 test_S_OK(hResult,
"Failed to instantiate CLSID_MenuBandSite");
364 if (!bCreated || !menuPopup || !bandSite)
365 {
366 skip(
"failed to create MenuBandSite object\n");
367 return;
368 }
369
370
371 hResult = shellMenu->
Initialize(
NULL, 0, ANCESTORDEFAULT, SMINIT_TOPLEVEL|SMINIT_VERTICAL);
375 hResult = menuPopup->
SetClient(bandSite);
377 hResult = bandSite->
AddBand(shellMenu);
379
380
384
385 HWND hWndToolbar, hWndToplevel;
386
387
388 hResult = dockingMenu->
GetWindow(&hWndToolbar);
390 ok(hWndToolbar !=
NULL,
"GetWindow should return a window\n");
391
392 hResult = menuPopup->
GetWindow(&hWndToplevel);
394 ok(hWndToolbar !=
NULL,
"GetWindow should return a window\n");
395
397 ok(
GetParent(hwndRealParent) == hWndToplevel,
"Wrong parent\n");
401
403}
const GUID CLSID_MenuBandSite
HRESULT AddBand([in] IUnknown *punk)
HRESULT SetClient([in] IUnknown *punkClient)
HWND WINAPI GetDesktopWindow(void)
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
Referenced by START_TEST().