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

Benjamin Arai me at benjaminarai.com
Fri Aug 11 19:38:27 CDT 2006


Hi,

ChangeLog:
 - Added conformance test to check if QueryInterface increments ref counter
 - Added missing IFont_Release call to QueryInterface conformance test
 - Conformance test passes in Wine and Windows XP SP2

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

-- 
Benjamin Arai
http://www.benjaminarai.com
-------------- next part --------------

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)
-- 
1.4.0


More information about the wine-patches mailing list