[PATCH] dwrite/tests: Add traces to allow debugging font failures.

Francois Gouget fgouget at free.fr
Sun Feb 2 19:05:36 CST 2020


Always trace the iteration counters so one can identify which iteration
is failing.
Also trace the family and font name so one can know which font is
causing the failure. But only do so if extra debugging information is
requested since there can be quite a lot of fonts.

Signed-off-by: Francois Gouget <fgouget at free.fr>
---
 dlls/dwrite/tests/font.c | 52 ++++++++++++++++++++++++++++++----------
 1 file changed, 39 insertions(+), 13 deletions(-)

diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index cdc41ec5a1d..a401ca910f8 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -7903,7 +7903,20 @@ todo_wine
         UINT32 font_count, j;
 
         hr = IDWriteFontCollection1_GetFontFamily(collection, i, &family);
-        ok(hr == S_OK, "Failed to get family, hr %#x.\n", hr);
+        ok(hr == S_OK, "%u Failed to get family, hr %#x.\n", i, hr);
+
+        if (winetest_debug > 1)
+        {
+            IDWriteLocalizedStrings *names;
+            WCHAR familynameW[64];
+
+            hr = IDWriteFontFamily1_GetFamilyNames(family, &names);
+            ok(hr == S_OK, "%u got 0x%08x\n", i, hr);
+
+            get_enus_string(names, familynameW, ARRAY_SIZE(familynameW));
+            IDWriteLocalizedStrings_Release(names);
+            trace("%u family=%s\n", i, wine_dbgstr_w(familynameW));
+        }
 
         font_count = IDWriteFontFamily1_GetFontCount(family);
 
@@ -7912,17 +7925,30 @@ todo_wine
             IDWriteFontFaceReference1 *ref2;
 
             hr = IDWriteFontFamily1_GetFont(family, j, &font3);
-            ok(hr == S_OK, "Failed to get font, hr %#x.\n", hr);
+            ok(hr == S_OK, "%u.%u Failed to get font, hr %#x.\n", i, j, hr);
+
+            if (winetest_debug > 1)
+            {
+                IDWriteLocalizedStrings *names;
+                WCHAR facenameW[64];
+
+                hr = IDWriteFont3_GetFaceNames(font3, &names);
+                ok(hr == S_OK, "%u.%u got 0x%08x\n", i, j, hr);
+
+                get_enus_string(names, facenameW, ARRAY_SIZE(facenameW));
+                IDWriteLocalizedStrings_Release(names);
+                trace("%u.%u facename=%s\n", i, j, wine_dbgstr_w(facenameW));
+            }
 
             hr = IDWriteFont3_GetFontFaceReference(font3, &ref);
-            ok(hr == S_OK, "Failed to get reference object, hr %#x.\n", hr);
+            ok(hr == S_OK, "%u.%u Failed to get reference object, hr %#x.\n", i, j, hr);
 
             hr = IDWriteFont3_GetFontFaceReference(font3, &ref1);
-            ok(hr == S_OK, "Failed to get reference object, hr %#x.\n", hr);
-            ok(ref != ref1, "Unexpected reference object %p, %p.\n", ref1, ref);
+            ok(hr == S_OK, "%u.%u Failed to get reference object, hr %#x.\n", i, j, hr);
+            ok(ref != ref1, "%u.%u Unexpected reference object %p, %p.\n", i, j, ref1, ref);
 
             hr = IDWriteFont3_CreateFontFace(font3, &fontface);
-            ok(hr == S_OK, "Failed to create a fontface, hr %#x.\n", hr);
+            ok(hr == S_OK, "%u.%u Failed to create a fontface, hr %#x.\n", i, j, hr);
 
             /* Fonts present regular properties as axis values, for non-variable fonts too.
                Normally it would include weight/width/slant/italic, but could also contain optical size axis. */
@@ -7931,7 +7957,7 @@ todo_wine
             {
                 UINT32 axis_count = IDWriteFontFaceReference1_GetFontAxisValueCount(ref2);
             todo_wine
-                ok(axis_count > 0, "Unexpected axis value count.\n");
+                ok(axis_count > 0, "%u.%u Unexpected axis value count %d.\n", i, j, axis_count);
                 IDWriteFontFaceReference1_Release(ref2);
             }
 
@@ -7940,25 +7966,25 @@ todo_wine
 
             hr = IDWriteFontFace3_GetFontFaceReference(fontface, &ref);
         todo_wine
-            ok(hr == S_OK, "Failed to get a reference, hr %#x.\n", hr);
+            ok(hr == S_OK, "%u.%u Failed to get a reference, hr %#x.\n", i, j, hr);
 
             hr = IDWriteFontFace3_GetFontFaceReference(fontface, &ref1);
         todo_wine
-            ok(hr == S_OK, "Failed to get a reference, hr %#x.\n", hr);
+            ok(hr == S_OK, "%u.%u Failed to get a reference, hr %#x.\n", i, j, hr);
         if (hr == S_OK)
-            ok(ref == ref1, "Unexpected reference %p, %p.\n", ref1, ref);
+            ok(ref == ref1, "%u.%u Unexpected reference %p, %p.\n", i, j, ref1, ref);
 
         if (hr == S_OK) {
             hr = IDWriteFontFaceReference_CreateFontFace(ref, &fontface1);
-            ok(hr == S_OK, "Failed to create fontface, hr %#x.\n", hr);
-            ok(fontface1 == fontface, "Unexpected fontface %p, %p.\n", fontface1, fontface);
+            ok(hr == S_OK, "%u.%u Failed to create fontface, hr %#x.\n", i, j, hr);
+            ok(fontface1 == fontface, "%u.%u Unexpected fontface %p, %p.\n", i, j, fontface1, fontface);
             IDWriteFontFace3_Release(fontface1);
 
             if (SUCCEEDED(hr = IDWriteFontFaceReference_QueryInterface(ref, &IID_IDWriteFontFaceReference1,
                     (void **)&ref2)))
             {
                 UINT32 axis_count = IDWriteFontFaceReference1_GetFontAxisValueCount(ref2);
-                ok(!axis_count, "Unexpected axis value count.\n");
+                ok(!axis_count, "%u.%u Unexpected axis value count %u.\n", i, j, axis_count);
                 IDWriteFontFaceReference1_Release(ref2);
             }
 
-- 
2.20.1



More information about the wine-devel mailing list