Nikolay Sivov : riched20: A bit more tests for GetChar(), improve tracing.

Alexandre Julliard julliard at wine.codeweavers.com
Thu May 28 08:45:59 CDT 2015


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed May 27 10:10:24 2015 +0300

riched20: A bit more tests for GetChar(), improve tracing.

---

 dlls/riched20/richole.c       |  8 ++++++--
 dlls/riched20/tests/richole.c | 24 ++++++++++++++++++++----
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index e25f2ea..63926e2 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -1468,9 +1468,11 @@ static HRESULT WINAPI ITextRange_fnGetChar(ITextRange *me, LONG *pch)
     ITextRangeImpl *This = impl_from_ITextRange(me);
     ME_Cursor cursor;
 
+    TRACE("(%p)->(%p)\n", This, pch);
+
     if (!This->reOle)
         return CO_E_RELEASED;
-    TRACE("%p\n", pch);
+
     if (!pch)
         return E_INVALIDARG;
 
@@ -3934,9 +3936,11 @@ static HRESULT WINAPI ITextSelection_fnGetChar(ITextSelection *me, LONG *pch)
     ITextSelectionImpl *This = impl_from_ITextSelection(me);
     ME_Cursor *start = NULL, *end = NULL;
 
+    TRACE("(%p)->(%p)\n", This, pch);
+
     if (!This->reOle)
         return CO_E_RELEASED;
-    TRACE("%p\n", pch);
+
     if (!pch)
         return E_INVALIDARG;
 
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 33a433a..3e41ede 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -683,7 +683,7 @@ static void test_ITextRange_GetChar(void)
   ITextDocument *txtDoc = NULL;
   ITextRange *txtRge = NULL;
   HRESULT hres;
-  LONG pch = 0xdeadbeef;
+  LONG pch;
   int first, lim;
   static const CHAR test_text1[] = "TestSomeText";
 
@@ -742,8 +742,16 @@ static void test_ITextRange_GetChar(void)
   ok(hres == S_OK, "got 0x%08x\n", hres);
   hres = ITextRange_GetChar(txtRge, NULL);
   ok(hres == E_INVALIDARG, "ITextRange_GetChar\n");
-  ITextRange_Release(txtRge);
+
   release_interfaces(&w, &reOle, &txtDoc, NULL);
+
+  hres = ITextRange_GetChar(txtRge, NULL);
+  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+
+  hres = ITextRange_GetChar(txtRge, &pch);
+  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+
+  ITextRange_Release(txtRge);
 }
 
 static void test_ITextSelection_GetChar(void)
@@ -753,7 +761,7 @@ static void test_ITextSelection_GetChar(void)
   ITextDocument *txtDoc = NULL;
   ITextSelection *txtSel = NULL;
   HRESULT hres;
-  LONG pch = 0xdeadbeef;
+  LONG pch;
   int first, lim;
   static const CHAR test_text1[] = "TestSomeText";
 
@@ -791,7 +799,15 @@ static void test_ITextSelection_GetChar(void)
   hres = ITextSelection_GetChar(txtSel, NULL);
   ok(hres == E_INVALIDARG, "ITextSelection_GetChar\n");
 
-  release_interfaces(&w, &reOle, &txtDoc, &txtSel);
+  release_interfaces(&w, &reOle, &txtDoc, NULL);
+
+  hres = ITextSelection_GetChar(txtSel, NULL);
+  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+
+  hres = ITextSelection_GetChar(txtSel, &pch);
+  ok(hres == CO_E_RELEASED, "got 0x%08x\n", hres);
+
+  ITextSelection_Release(txtSel);
 }
 
 static void test_ITextRange_GetStart_GetEnd(void)




More information about the wine-cvs mailing list