From 0b44e9a64192c2244614dbb3dd42284f95c62dd0 Mon Sep 17 00:00:00 2001 From: Benjamin Arai Date: Fri, 11 Aug 2006 17:38:27 -0700 Subject: [PATCH] oleaut32: Added test to check if olefont:IFont_QueryInterface increments ref counter. --- dlls/oleaut32/tests/olefont.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c index bd5fb73aefc..42eb332344d 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)