[PATCH] dwrite/tests: Handle extra refcount in early dwrite versions

Detlef Riekenberg wine.dev at web.de
Mon Apr 29 09:39:21 CDT 2013


The first IDWriteFont_CreateFontFace use two reference in early
dwrite versions, while win8 and updated win7 machines use only one.

Avoid test failures related to this implementation detail.

--
By by ... Detlef
---
 dlls/dwrite/tests/font.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 9138061..415d73c 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -422,6 +422,7 @@ static void test_CreateFontFace(void)
     IDWriteFont *font;
     LOGFONTW logfont;
     HRESULT hr;
+    ULONG firstref;
 
     hr = IDWriteFactory_GetGdiInterop(factory, &interop);
     EXPECT_HR(hr, S_OK);
@@ -445,17 +446,21 @@ if (0) /* crashes on native */
     hr = IDWriteFont_CreateFontFace(font, &fontface);
     ok(hr == S_OK, "got 0x%08x\n", hr);
     EXPECT_REF(font, 1);
-    EXPECT_REF(fontface, 2);
+
+    /* workaround for a different implementation detail:
+       the first IDWriteFont_CreateFontFace use an extra reference in early dwrite versions */
+    firstref = IDWriteFontFace_AddRef(fontface) - 1;
+    IDWriteFontFace_Release(fontface);
 
     hr = IDWriteFont_CreateFontFace(font, &fontface2);
     ok(hr == S_OK, "got 0x%08x\n", hr);
     ok(fontface == fontface2, "got %p, was %p\n", fontface2, fontface);
-    EXPECT_REF(fontface, 3);
+    EXPECT_REF(fontface, (firstref + 1));
     EXPECT_REF(font, 1);
 
     IDWriteFontFace_AddRef(fontface);
     EXPECT_REF(font, 1);
-    EXPECT_REF(fontface, 4);
+    EXPECT_REF(fontface, (firstref + 2));
     IDWriteFontFace_Release(fontface);
     IDWriteFontFace_Release(fontface);
 
-- 
1.7.5.4




More information about the wine-patches mailing list