Benjamin Arai : oleaut32: Added test to check if olefont: IFont_QueryInterface increments ref counter.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Aug 12 06:10:40 CDT 2006


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

Author: Benjamin Arai <me at benjaminarai.com>
Date:   Fri Aug 11 17:38:27 2006 -0700

oleaut32: Added test to check if olefont:IFont_QueryInterface increments ref counter.

---

 dlls/oleaut32/tests/olefont.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c
index bd5fb73..42eb332 100644
--- a/dlls/oleaut32/tests/olefont.c
+++ b/dlls/oleaut32/tests/olefont.c
@@ -119,6 +119,7 @@ void test_QueryInterface(void)
         LPVOID pvObj = NULL;
         HRESULT hres;
         IFont*  font = NULL;
+        LONG ret;
 
         hres = pOleCreateFontIndirect(NULL, &IID_IFont, &pvObj);
         font = pvObj;
@@ -129,10 +130,17 @@ void test_QueryInterface(void)
         pvObj = NULL;
         hres = IFont_QueryInterface( font, &IID_IFont, &pvObj);
 
+        /* Test if QueryInterface increments ref counter for IFONTs */
+        ret = IFont_AddRef(font);
+        ok(ret == 3, "IFont_QI expected ref value 3 but instead got %12lu\n",ret);
+        IFont_Release(font);
+
         ok(hres == S_OK,"IFont_QI does not return S_OK, but 0x%08lx\n", hres);
         ok(pvObj != NULL,"IFont_QI does return NULL, instead of a ptr\n");
 
-	IFont_Release(font);
+        /* Orignial ref and QueryInterface ref both have to be released */
+        IFont_Release(font);
+        IFont_Release(font);
 }
 
 void test_type_info(void)




More information about the wine-cvs mailing list