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@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); }
Does any of those tests actually fail? Index access for family/font objects should never fail for valid index, other tests you changed might but on extreme conditions like allocations errors and such. I think additional trace() calls are not great, and should instead print family/face names for failed tests directly, from ok() calls. Tracing indices also becomes useless when you normally run without verbose mode.
I would be interested in fixing failures you're seeing though, and I don't see anything new on the test page.
On Mon, 3 Feb 2020, Nikolay Sivov wrote:
Does any of those tests actually fail? Index access for family/font objects should never fail for valid index, other tests you changed might but on extreme conditions like allocations errors and such. I think additional trace() calls are not great, and should instead print family/face names for failed tests directly, from ok() calls. Tracing indices also becomes useless when you normally run without verbose mode.
That makes each ok() call more complex (longer variable names + wine_dbgstr_w()) but it's doable.
I would be interested in fixing failures you're seeing though, and I don't see anything new on the test page.
Not failures but tons of todos on Linux which is really the same: https://test.winehq.org/data/tests/dwrite:font.html https://test.winehq.org/data/bdf8d94e2a40f82c618ba5587cc82382c5230ac0/linux_...
Now those are mostly because of unimplemented functions so which font they are applied to does not really matter. But still, not having any indication of the parameters that caused a test to fail in a loop is wrong.
On 2/3/20 1:06 PM, Francois Gouget wrote:
On Mon, 3 Feb 2020, Nikolay Sivov wrote:
Does any of those tests actually fail? Index access for family/font objects should never fail for valid index, other tests you changed might but on extreme conditions like allocations errors and such. I think additional trace() calls are not great, and should instead print family/face names for failed tests directly, from ok() calls. Tracing indices also becomes useless when you normally run without verbose mode.
That makes each ok() call more complex (longer variable names + wine_dbgstr_w()) but it's doable.
I would be interested in fixing failures you're seeing though, and I don't see anything new on the test page.
Not failures but tons of todos on Linux which is really the same: https://test.winehq.org/data/tests/dwrite:font.html https://test.winehq.org/data/bdf8d94e2a40f82c618ba5587cc82382c5230ac0/linux_...
Now those are mostly because of unimplemented functions so which font they are applied to does not really matter. But still, not having any indication of the parameters that caused a test to fail in a loop is wrong.
I see. I sent some patches to get rid of todo's by implementing this method.