Commit fa757df8 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

ole32: Add a tests for OleSetMenuDescriptor and the global interface table.

parent 3441615c
......@@ -100,10 +100,42 @@ static void test_CoCreateInstance(void)
ok(hr == CO_E_NOTINITIALIZED, "CoCreateInstance should have returned CO_E_NOTINITIALIZED instead of 0x%08lx\n", hr);
}
static ATOM register_dummy_class(void)
{
WNDCLASS wc =
{
0,
DefWindowProc,
0,
0,
GetModuleHandle(NULL),
NULL,
LoadCursor(NULL, IDC_ARROW),
(HBRUSH)(COLOR_BTNFACE+1),
NULL,
TEXT("WineOleTestClass"),
};
return RegisterClass(&wc);
}
static void test_ole_menu(void)
{
HWND hwndFrame;
HRESULT hr;
hwndFrame = CreateWindow(MAKEINTATOM(register_dummy_class()), "Test", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, NULL);
hr = OleSetMenuDescriptor(NULL, hwndFrame, NULL, NULL, NULL);
todo_wine ok_ole_success(hr, "OleSetMenuDescriptor");
DestroyWindow(hwndFrame);
}
START_TEST(compobj)
{
test_ProgIDFromCLSID();
test_CLSIDFromProgID();
test_CLSIDFromString();
test_CoCreateInstance();
test_ole_menu();
}
......@@ -1959,6 +1959,65 @@ static void test_ROT(void)
ok_no_locks();
}
struct git_params
{
DWORD cookie;
IGlobalInterfaceTable *git;
};
static DWORD CALLBACK get_global_interface_proc(LPVOID pv)
{
HRESULT hr;
struct git_params *params = (struct git_params *)pv;
IClassFactory *cf;
hr = IGlobalInterfaceTable_GetInterfaceFromGlobal(params->git, params->cookie, &IID_IClassFactory, (void **)&cf);
ok(hr == CO_E_NOTINITIALIZED,
"IGlobalInterfaceTable_GetInterfaceFromGlobal should have failed with error CO_E_NOTINITIALIZED instead of 0x%08lx\n",
hr);
CoInitialize(NULL);
hr = IGlobalInterfaceTable_GetInterfaceFromGlobal(params->git, params->cookie, &IID_IClassFactory, (void **)&cf);
todo_wine ok_ole_success(hr, IGlobalInterfaceTable_GetInterfaceFromGlobal);
CoUninitialize();
return hr;
}
static void test_globalinterfacetable(void)
{
HRESULT hr;
IGlobalInterfaceTable *git;
DWORD cookie;
HANDLE thread;
DWORD tid;
struct git_params params;
DWORD ret;
hr = CoCreateInstance(&CLSID_StdGlobalInterfaceTable, NULL, CLSCTX_INPROC_SERVER, &IID_IGlobalInterfaceTable, (void **)&git);
ok_ole_success(hr, CoCreateInstance);
hr = IGlobalInterfaceTable_RegisterInterfaceInGlobal(git, (IUnknown *)&Test_ClassFactory, &IID_IClassFactory, &cookie);
ok_ole_success(hr, IGlobalInterfaceTable_RegisterInterfaceInGlobal);
params.cookie = cookie;
params.git = git;
/* note: params is on stack so we MUST wait for get_global_interface_proc
* to exit before we can return */
thread = CreateThread(NULL, 0, get_global_interface_proc, &params, 0, &tid);
ret = MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_ALLINPUT);
while (ret == WAIT_OBJECT_0 + 1)
{
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
DispatchMessage(&msg);
ret = MsgWaitForMultipleObjects(1, &thread, FALSE, INFINITE, QS_ALLINPUT);
}
CloseHandle(thread);
}
static const char cf_marshaled[] =
{
0x9, 0x0, 0x0, 0x0,
......@@ -2197,7 +2256,7 @@ START_TEST(marshal)
if (0) test_out_of_process_com();
test_ROT();
/* FIXME: test GIT */
test_globalinterfacetable();
test_marshal_CLIPFORMAT();
test_marshal_HWND();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment