msctf: Beginning implementation of ITfContext::GetEnd.

This commit is contained in:
Aric Stewart 2009-05-21 13:45:36 -05:00 committed by Alexandre Julliard
parent 6772a07a94
commit 7fa47cd3f5
2 changed files with 44 additions and 3 deletions

View File

@ -321,8 +321,31 @@ static HRESULT WINAPI Context_GetEnd (ITfContext *iface,
TfEditCookie ec, ITfRange **ppEnd)
{
Context *This = (Context *)iface;
FIXME("STUB:(%p)\n",This);
return E_NOTIMPL;
EditCookie *cookie;
LONG end;
TRACE("(%p) %i %p\n",This,ec,ppEnd);
if (!ppEnd)
return E_INVALIDARG;
*ppEnd = NULL;
if (!This->connected)
return TF_E_DISCONNECTED;
if (get_Cookie_magic(ec)!=COOKIE_MAGIC_EDITCOOKIE)
return TF_E_NOLOCK;
if (!This->pITextStoreACP)
{
FIXME("Context does not have a ITextStoreACP\n");
return E_NOTIMPL;
}
cookie = get_Cookie_data(ec);
ITextStoreACP_GetEndACP(This->pITextStoreACP,&end);
return Range_Constructor(iface, This->pITextStoreACP, cookie->lockType, end, end, ppEnd);
}
static HRESULT WINAPI Context_GetActiveView (ITfContext *iface,

View File

@ -57,6 +57,7 @@ static INT test_KEV_OnSetFocus = SINK_UNEXPECTED;
static INT test_ACP_AdviseSink = SINK_UNEXPECTED;
static INT test_ACP_GetStatus = SINK_UNEXPECTED;
static INT test_ACP_RequestLock = SINK_UNEXPECTED;
static INT test_ACP_GetEndACP = SINK_UNEXPECTED;
static INT test_DoEditSession = SINK_UNEXPECTED;
@ -269,7 +270,8 @@ static HRESULT WINAPI TextStoreACP_RetrieveRequestedAttrs(ITextStoreACP *iface,
static HRESULT WINAPI TextStoreACP_GetEndACP(ITextStoreACP *iface,
LONG *pacp)
{
trace("\n");
ok(test_ACP_GetEndACP == SINK_EXPECTED,"Unexpected TextStoreACP_GetEndACP\n");
test_ACP_GetEndACP = SINK_FIRED;
return S_OK;
}
static HRESULT WINAPI TextStoreACP_GetActiveView(ITextStoreACP *iface,
@ -1397,6 +1399,22 @@ TfEditCookie ec)
ok(SUCCEEDED(hr),"Unexpected return code %x\n",hr);
ok(range != NULL,"Range set to NULL\n");
ITfRange_Release(range);
hr = ITfContext_GetEnd(cxt,ec,NULL);
ok(hr == E_INVALIDARG,"Unexpected return code %x\n",hr);
range = (ITfRange*)0xdeaddead;
hr = ITfContext_GetEnd(cxt,0xdeadcafe,&range);
ok(hr == TF_E_NOLOCK,"Unexpected return code %x\n",hr);
ok(range == NULL,"Range not set to NULL\n");
test_ACP_GetEndACP = SINK_EXPECTED;
hr = ITfContext_GetEnd(cxt,ec,&range);
ok(SUCCEEDED(hr),"Unexpected return code %x\n",hr);
ok(range != NULL,"Range set to NULL\n");
ok(test_ACP_GetEndACP == SINK_FIRED, "GetEndACP not fired as expected\n");
ITfRange_Release(range);
ITfContext_Release(cxt);
ITfDocumentMgr_Release(dm);