Aric Stewart : msctf/tests: Test EnumDocumentMgrs.

Alexandre Julliard julliard at winehq.org
Fri Jul 10 08:52:07 CDT 2009


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri Jul 10 07:38:45 2009 -0500

msctf/tests: Test EnumDocumentMgrs.

---

 dlls/msctf/tests/inputprocessor.c |   45 +++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/dlls/msctf/tests/inputprocessor.c b/dlls/msctf/tests/inputprocessor.c
index 9b266ba..d35d391 100644
--- a/dlls/msctf/tests/inputprocessor.c
+++ b/dlls/msctf/tests/inputprocessor.c
@@ -1142,6 +1142,39 @@ static void test_EnumContexts(ITfDocumentMgr *dm, ITfContext *search)
         ok(!found,"Found an ITfContext we should should not have\n");
 }
 
+static void test_EnumDocumentMgr(ITfThreadMgr *tm, ITfDocumentMgr *search, ITfDocumentMgr *absent)
+{
+    HRESULT hr;
+    IEnumTfDocumentMgrs* pEnum;
+    BOOL found = FALSE;
+    BOOL notfound = TRUE;
+
+    hr = ITfThreadMgr_EnumDocumentMgrs(tm,&pEnum);
+    ok(SUCCEEDED(hr),"EnumDocumentMgrs failed\n");
+    if (SUCCEEDED(hr))
+    {
+        ULONG fetched;
+        ITfDocumentMgr *dm;
+        while (IEnumTfDocumentMgrs_Next(pEnum, 1, &dm, &fetched) == S_OK)
+        {
+            if (!search)
+                found = TRUE;
+            else if (search == dm)
+                found = TRUE;
+            if (absent && dm == absent)
+                notfound = FALSE;
+            ITfDocumentMgr_Release(dm);
+        }
+        IEnumTfDocumentMgrs_Release(pEnum);
+    }
+    if (search)
+        ok(found,"Did not find proper ITfDocumentMgr\n");
+    else
+        ok(!found,"Found an ITfDocumentMgr we should should not have\n");
+    if (absent)
+        ok(notfound,"Found an ITfDocumentMgr we believe should be absent\n");
+}
+
 static inline int check_context_refcount(ITfContext *iface)
 {
     IUnknown_AddRef(iface);
@@ -1174,9 +1207,21 @@ static void test_startSession(void)
     hr = ITfThreadMgr_Deactivate(g_tm);
     ok(SUCCEEDED(hr),"Failed to Deactivate\n");
 
+    test_EnumDocumentMgr(g_tm,NULL,NULL);
+
     hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&g_dm);
     ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n");
 
+    test_EnumDocumentMgr(g_tm,g_dm,NULL);
+
+    hr = ITfThreadMgr_CreateDocumentMgr(g_tm,&dmtest);
+    ok(SUCCEEDED(hr),"CreateDocumentMgr failed\n");
+
+    test_EnumDocumentMgr(g_tm,dmtest,NULL);
+
+    ITfDocumentMgr_Release(dmtest);
+    test_EnumDocumentMgr(g_tm,g_dm,dmtest);
+
     hr = ITfThreadMgr_GetFocus(g_tm,&dmtest);
     ok(SUCCEEDED(hr),"GetFocus Failed\n");
     ok(dmtest == NULL,"Initial focus not null\n");




More information about the wine-cvs mailing list