From c99ab15017e7ca9d7f01bb44b17984e7d333fb0c Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Thu, 18 Aug 2016 10:20:17 +0000 Subject: [PATCH] [MSCTF_WINETEST] Sync with Wine Staging 1.9.16. CORE-11866 svn path=/trunk/; revision=72291 --- rostests/winetests/msctf/inputprocessor.c | 39 +++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/rostests/winetests/msctf/inputprocessor.c b/rostests/winetests/msctf/inputprocessor.c index 16df012ff79..2096bff539f 100644 --- a/rostests/winetests/msctf/inputprocessor.c +++ b/rostests/winetests/msctf/inputprocessor.c @@ -74,6 +74,7 @@ static INT test_OnPushContext = SINK_UNEXPECTED; static INT test_OnPopContext = SINK_UNEXPECTED; static INT test_KEV_OnSetFocus = SINK_UNEXPECTED; static INT test_ACP_AdviseSink = SINK_UNEXPECTED; +static INT test_ACP_UnadviseSink = SINK_UNEXPECTED; static INT test_ACP_GetStatus = SINK_UNEXPECTED; static INT test_ACP_RequestLock = SINK_UNEXPECTED; static INT test_ACP_GetEndACP = SINK_UNEXPECTED; @@ -232,6 +233,9 @@ static HRESULT WINAPI TextStoreACP_AdviseSink(ITextStoreACP *iface, sink_fire_ok(&test_ACP_AdviseSink,"TextStoreACP_AdviseSink"); + if(ACPSink) + return S_OK; + hr = IUnknown_QueryInterface(punk, &IID_ITextStoreACPSink, (void**)&ACPSink); ok(SUCCEEDED(hr),"Unable to QueryInterface on sink\n"); @@ -245,7 +249,7 @@ static HRESULT WINAPI TextStoreACP_AdviseSink(ITextStoreACP *iface, static HRESULT WINAPI TextStoreACP_UnadviseSink(ITextStoreACP *iface, IUnknown *punk) { - trace("\n"); + sink_fire_ok(&test_ACP_UnadviseSink,"TextStoreACP_UnadviseSink"); return S_OK; } @@ -563,9 +567,9 @@ ITfContext *pic) hr = ITfContext_GetDocumentMgr(pic,&docmgr); ok(SUCCEEDED(hr),"GetDocumentMgr failed\n"); test = (ITfContext*)0xdeadbeef; - ITfDocumentMgr_Release(docmgr); hr = ITfDocumentMgr_GetTop(docmgr,&test); ok(SUCCEEDED(hr),"GetTop failed\n"); + ITfDocumentMgr_Release(docmgr); ok(test == pic, "Wrong context is on top\n"); if (test) ITfContext_Release(test); @@ -969,6 +973,11 @@ static void test_EnumLanguageProfiles(void) { BOOL found = FALSE; IEnumTfLanguageProfiles *ppEnum; + HRESULT hr; + + hr = ITfInputProcessorProfiles_EnumLanguageProfiles(g_ipp, gLangid, NULL); + ok(hr == E_INVALIDARG, "EnumLanguageProfiles failed: %x\n", hr); + if (SUCCEEDED(ITfInputProcessorProfiles_EnumLanguageProfiles(g_ipp,gLangid,&ppEnum))) { TF_LANGUAGEPROFILE profile; @@ -1474,7 +1483,7 @@ static void test_startSession(void) DWORD editCookie; ITfDocumentMgr *dmtest; ITfContext *cxt,*cxt2,*cxt3,*cxtTest; - ITextStoreACP *ts; + ITextStoreACP *ts = NULL; TfClientId cid2 = 0; ITfThreadMgrEx *tmex; @@ -1641,6 +1650,8 @@ static void test_startSession(void) ok(hr == S_FALSE, "ITfContext_GetDocumentMgr wrong rc %x\n",hr); ok(dmtest == NULL,"returned documentmgr should be null\n"); + ITfContext_Release(cxt2); + hr = ITfDocumentMgr_GetTop(g_dm, &cxtTest); ok(SUCCEEDED(hr),"GetTop Failed\n"); ok(cxtTest == cxt, "Wrong context on top\n"); @@ -1651,6 +1662,25 @@ static void test_startSession(void) ok(cxtTest == cxt, "Wrong context on base\n"); ITfContext_Release(cxtTest); + hr = ITfDocumentMgr_CreateContext(g_dm, cid, 0, (IUnknown*)ts, &cxt2, &editCookie); + ok(hr == S_OK,"CreateContext Failed\n"); + + test_OnPushContext = SINK_EXPECTED; + test_ACP_AdviseSink = SINK_EXPECTED; + hr = ITfDocumentMgr_Push(g_dm, cxt2); + ok(hr == S_OK,"Push Failed\n"); + sink_check_ok(&test_OnPushContext,"OnPushContext"); + sink_check_ok(&test_ACP_AdviseSink,"TextStoreACP_AdviseSink"); + + test_ACP_UnadviseSink = SINK_EXPECTED; + cnt = check_context_refcount(cxt2); + test_OnPopContext = SINK_EXPECTED; + hr = ITfDocumentMgr_Pop(g_dm, 0); + ok(hr == S_OK,"Pop Failed\n"); + ok(check_context_refcount(cxt2) < cnt, "Ref count did not decrease\n"); + sink_check_ok(&test_OnPopContext,"OnPopContext"); + sink_check_ok(&test_ACP_UnadviseSink,"TextStoreACP_AdviseSink"); + hr = ITfDocumentMgr_Pop(g_dm, 0); ok(FAILED(hr),"Pop Succeeded\n"); @@ -2320,6 +2350,9 @@ START_TEST(inputprocessor) test_UnregisterCategory(); test_Unregister(); test_profile_mgr(); + + ITextStoreACPSink_Release(ACPSink); + ITfDocumentMgr_Release(g_dm); } else skip("Unable to create InputProcessor\n");