msctf/tests: Add multi-threaded apartment test for ITfSource_AdviseSink.
We expect it to fail because the ITfUIElementSink interface is flagged as "local" and cannot be marshalled, and because ITfThreadMgr is flagged with "threading(apartment)" and cannot be instanciated in the MTA. Signed-off-by: Rémi Bernon <rbernon@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7dab372271
commit
b9b834b6ba
|
@ -2511,6 +2511,53 @@ static void test_profile_mgr(void)
|
|||
ITfInputProcessorProfileMgr_Release(ipp_mgr);
|
||||
}
|
||||
|
||||
static DWORD WINAPI test_MultiThreadApartment_Thread(void *param) {
|
||||
ITfThreadMgrEx *thmgr;
|
||||
ITfSource *source;
|
||||
DWORD cookie;
|
||||
HRESULT hr;
|
||||
|
||||
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
ok(SUCCEEDED(hr), "Failed to initialize multi-threaded apartment\n");
|
||||
|
||||
hr = CoCreateInstance(&CLSID_TF_ThreadMgr, NULL, CLSCTX_INPROC_SERVER, &IID_ITfThreadMgrEx, (LPVOID *)&thmgr);
|
||||
ok(SUCCEEDED(hr), "Failed to create ITfThreadMgrEx instance\n");
|
||||
|
||||
hr = ITfThreadMgrEx_QueryInterface(thmgr, &IID_ITfSource, (LPVOID *)&source);
|
||||
ok(SUCCEEDED(hr), "Failed to query ITfSource interface\n");
|
||||
|
||||
hr = ITfSource_AdviseSink(source, &IID_ITfUIElementSink, (IUnknown*)&TfUIElementSink, &cookie);
|
||||
ok(hr == REGDB_E_IIDNOTREG /* native */ || hr == E_NOINTERFACE /* wine */,
|
||||
"Advise ITfUIElementSink should return marshalling failure: %08x\n", hr);
|
||||
|
||||
hr = ITfSource_Release(source);
|
||||
ok(SUCCEEDED(hr), "Failed to Release source\n");
|
||||
|
||||
hr = ITfThreadMgrEx_Release(thmgr);
|
||||
ok(SUCCEEDED(hr), "Failed to Release thread manager\n");
|
||||
|
||||
CoUninitialize();
|
||||
|
||||
return 0xdeadcafe;
|
||||
}
|
||||
|
||||
static void test_MultiThreadApartment(void)
|
||||
{
|
||||
DWORD ret;
|
||||
HANDLE thread;
|
||||
|
||||
thread = CreateThread(0, 0, test_MultiThreadApartment_Thread, 0, 0, 0);
|
||||
ok(thread != NULL, "Failed to create test thread\n");
|
||||
|
||||
ret = WaitForSingleObject(thread, INFINITE);
|
||||
ok(ret == WAIT_OBJECT_0, "Failed to wait for thread completion\n");
|
||||
|
||||
GetExitCodeThread(thread, &ret);
|
||||
ok(ret == 0xdeadcafe, "Thread terminated in an unexpected way\n");
|
||||
|
||||
CloseHandle(thread);
|
||||
}
|
||||
|
||||
START_TEST(inputprocessor)
|
||||
{
|
||||
if (SUCCEEDED(initialize()))
|
||||
|
@ -2540,6 +2587,7 @@ START_TEST(inputprocessor)
|
|||
test_UnregisterCategory();
|
||||
test_Unregister();
|
||||
test_profile_mgr();
|
||||
test_MultiThreadApartment();
|
||||
|
||||
ITextStoreACPSink_Release(ACPSink);
|
||||
ITfDocumentMgr_Release(g_dm);
|
||||
|
|
Loading…
Reference in New Issue