Aric Stewart : msctf: Beginning implementation of ITfContext::GetEnd.

Alexandre Julliard julliard at winehq.org
Fri May 22 08:25:32 CDT 2009


Module: wine
Branch: master
Commit: 7fa47cd3f50faf4c871c7a6a0e2c6f4651ffe76d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7fa47cd3f50faf4c871c7a6a0e2c6f4651ffe76d

Author: Aric Stewart <aric at codeweavers.com>
Date:   Thu May 21 13:45:36 2009 -0500

msctf: Beginning implementation of ITfContext::GetEnd.

---

 dlls/msctf/context.c              |   27 +++++++++++++++++++++++++--
 dlls/msctf/tests/inputprocessor.c |   20 +++++++++++++++++++-
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/dlls/msctf/context.c b/dlls/msctf/context.c
index ce5463f..8c83798 100644
--- a/dlls/msctf/context.c
+++ b/dlls/msctf/context.c
@@ -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,
diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c
index 2fff504..f488e82 100644
--- a/dlls/msctf/tests/inputprocessor.c
+++ b/dlls/msctf/tests/inputprocessor.c
@@ -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,
@@ -1398,6 +1400,22 @@ TfEditCookie ec)
     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);
     return 0xdeadcafe;




More information about the wine-cvs mailing list