dwrite/tests: Use winetest context for some tests.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-08-18 16:52:32 +03:00 committed by Alexandre Julliard
parent 6553a66ba1
commit eba92fd3a7
2 changed files with 280 additions and 230 deletions

View file

@ -2164,7 +2164,8 @@ static void test_ApplyCharacterSpacing(void)
return; return;
} }
for (i = 0; i < ARRAY_SIZE(spacing_tests); i++) { for (i = 0; i < ARRAY_SIZE(spacing_tests); ++i)
{
const struct spacing_test *ptr = spacing_tests + i; const struct spacing_test *ptr = spacing_tests + i;
DWRITE_GLYPH_OFFSET offsets[3]; DWRITE_GLYPH_OFFSET offsets[3];
UINT32 glyph_count; UINT32 glyph_count;
@ -2196,6 +2197,8 @@ static void test_ApplyCharacterSpacing(void)
props[0].isClusterStart = props[1].isClusterStart = 1; props[0].isClusterStart = props[1].isClusterStart = 1;
} }
winetest_push_context("Test %u", i);
hr = IDWriteTextAnalyzer1_ApplyCharacterSpacing(analyzer1, hr = IDWriteTextAnalyzer1_ApplyCharacterSpacing(analyzer1,
ptr->leading, ptr->leading,
ptr->trailing, ptr->trailing,
@ -2208,35 +2211,35 @@ static void test_ApplyCharacterSpacing(void)
props, props,
advances, advances,
offsets); offsets);
ok(hr == (ptr->min_advance < 0.0f ? E_INVALIDARG : S_OK), "%d: got 0x%08x\n", i, hr); ok(hr == (ptr->min_advance < 0.0f ? E_INVALIDARG : S_OK), "Unexpected hr %#x.\n", hr);
if (hr == S_OK) { if (hr == S_OK) {
ok(ptr->modified_advances[0] == advances[0], "%d: got advance[0] %.2f, expected %.2f\n", i, advances[0], ptr->modified_advances[0]); ok(ptr->modified_advances[0] == advances[0], "Got advance[0] %.2f, expected %.2f.\n", advances[0], ptr->modified_advances[0]);
ok(ptr->modified_advances[1] == advances[1], "%d: got advance[1] %.2f, expected %.2f\n", i, advances[1], ptr->modified_advances[1]); ok(ptr->modified_advances[1] == advances[1], "Got advance[1] %.2f, expected %.2f.\n", advances[1], ptr->modified_advances[1]);
if (glyph_count > 2) if (glyph_count > 2)
ok(ptr->modified_advances[2] == advances[2], "%d: got advance[2] %.2f, expected %.2f\n", i, advances[2], ptr->modified_advances[2]); ok(ptr->modified_advances[2] == advances[2], "Got advance[2] %.2f, expected %.2f.\n", advances[2], ptr->modified_advances[2]);
ok(ptr->modified_offsets[0] == offsets[0].advanceOffset, "%d: got offset[0] %.2f, expected %.2f\n", i, ok(ptr->modified_offsets[0] == offsets[0].advanceOffset, "Got offset[0] %.2f, expected %.2f.\n",
offsets[0].advanceOffset, ptr->modified_offsets[0]); offsets[0].advanceOffset, ptr->modified_offsets[0]);
ok(ptr->modified_offsets[1] == offsets[1].advanceOffset, "%d: got offset[1] %.2f, expected %.2f\n", i, ok(ptr->modified_offsets[1] == offsets[1].advanceOffset, "Got offset[1] %.2f, expected %.2f.\n",
offsets[1].advanceOffset, ptr->modified_offsets[1]); offsets[1].advanceOffset, ptr->modified_offsets[1]);
if (glyph_count > 2) if (glyph_count > 2)
ok(ptr->modified_offsets[2] == offsets[2].advanceOffset, "%d: got offset[2] %.2f, expected %.2f\n", i, ok(ptr->modified_offsets[2] == offsets[2].advanceOffset, "Got offset[2] %.2f, expected %.2f.\n",
offsets[2].advanceOffset, ptr->modified_offsets[2]); offsets[2].advanceOffset, ptr->modified_offsets[2]);
ok(offsets[0].ascenderOffset == 23.0, "%d: unexpected ascenderOffset %.2f\n", i, offsets[0].ascenderOffset); ok(offsets[0].ascenderOffset == 23.0, "Unexpected ascenderOffset %.2f.\n", offsets[0].ascenderOffset);
ok(offsets[1].ascenderOffset == 32.0, "%d: unexpected ascenderOffset %.2f\n", i, offsets[1].ascenderOffset); ok(offsets[1].ascenderOffset == 32.0, "Unexpected ascenderOffset %.2f.\n", offsets[1].ascenderOffset);
ok(offsets[2].ascenderOffset == 31.0, "%d: unexpected ascenderOffset %.2f\n", i, offsets[2].ascenderOffset); ok(offsets[2].ascenderOffset == 31.0, "Unexpected ascenderOffset %.2f.\n", offsets[2].ascenderOffset);
} }
else { else {
ok(ptr->modified_advances[0] == advances[0], "%d: got advance[0] %.2f, expected %.2f\n", i, advances[0], ptr->modified_advances[0]); ok(ptr->modified_advances[0] == advances[0], "Got advance[0] %.2f, expected %.2f.\n", advances[0], ptr->modified_advances[0]);
ok(ptr->modified_advances[1] == advances[1], "%d: got advance[1] %.2f, expected %.2f\n", i, advances[1], ptr->modified_advances[1]); ok(ptr->modified_advances[1] == advances[1], "Got advance[1] %.2f, expected %.2f.\n", advances[1], ptr->modified_advances[1]);
ok(ptr->offsets[0] == offsets[0].advanceOffset, "%d: got offset[0] %.2f, expected %.2f\n", i, ok(ptr->offsets[0] == offsets[0].advanceOffset, "Got offset[0] %.2f, expected %.2f.\n",
offsets[0].advanceOffset, ptr->modified_offsets[0]); offsets[0].advanceOffset, ptr->modified_offsets[0]);
ok(ptr->offsets[1] == offsets[1].advanceOffset, "%d: got offset[1] %.2f, expected %.2f\n", i, ok(ptr->offsets[1] == offsets[1].advanceOffset, "Got offset[1] %.2f, expected %.2f.\n",
offsets[1].advanceOffset, ptr->modified_offsets[1]); offsets[1].advanceOffset, ptr->modified_offsets[1]);
ok(offsets[0].ascenderOffset == 23.0, "%d: unexpected ascenderOffset %.2f\n", i, offsets[0].ascenderOffset); ok(offsets[0].ascenderOffset == 23.0, "Unexpected ascenderOffset %.2f.\n", offsets[0].ascenderOffset);
ok(offsets[1].ascenderOffset == 32.0, "%d: unexpected ascenderOffset %.2f\n", i, offsets[1].ascenderOffset); ok(offsets[1].ascenderOffset == 32.0, "Unexpected ascenderOffset %.2f.\n", offsets[1].ascenderOffset);
} }
/* same, with argument aliasing */ /* same, with argument aliasing */
@ -2262,37 +2265,41 @@ static void test_ApplyCharacterSpacing(void)
props, props,
advances, advances,
offsets); offsets);
ok(hr == (ptr->min_advance < 0.0f ? E_INVALIDARG : S_OK), "%d: got 0x%08x\n", i, hr); ok(hr == (ptr->min_advance < 0.0f ? E_INVALIDARG : S_OK), "Unexpected hr %#x.\n", hr);
if (hr == S_OK) { if (hr == S_OK)
ok(ptr->modified_advances[0] == advances[0], "%d: got advance[0] %.2f, expected %.2f\n", i, advances[0], ptr->modified_advances[0]); {
ok(ptr->modified_advances[1] == advances[1], "%d: got advance[1] %.2f, expected %.2f\n", i, advances[1], ptr->modified_advances[1]); ok(ptr->modified_advances[0] == advances[0], "Got advance[0] %.2f, expected %.2f.\n", advances[0], ptr->modified_advances[0]);
ok(ptr->modified_advances[1] == advances[1], "Got advance[1] %.2f, expected %.2f.\n", advances[1], ptr->modified_advances[1]);
if (glyph_count > 2) if (glyph_count > 2)
ok(ptr->modified_advances[2] == advances[2], "%d: got advance[2] %.2f, expected %.2f\n", i, advances[2], ptr->modified_advances[2]); ok(ptr->modified_advances[2] == advances[2], "Got advance[2] %.2f, expected %.2f.\n", advances[2], ptr->modified_advances[2]);
ok(ptr->modified_offsets[0] == offsets[0].advanceOffset, "%d: got offset[0] %.2f, expected %.2f\n", i, ok(ptr->modified_offsets[0] == offsets[0].advanceOffset, "Got offset[0] %.2f, expected %.2f.\n",
offsets[0].advanceOffset, ptr->modified_offsets[0]); offsets[0].advanceOffset, ptr->modified_offsets[0]);
ok(ptr->modified_offsets[1] == offsets[1].advanceOffset, "%d: got offset[1] %.2f, expected %.2f\n", i, ok(ptr->modified_offsets[1] == offsets[1].advanceOffset, "Got offset[1] %.2f, expected %.2f.\n",
offsets[1].advanceOffset, ptr->modified_offsets[1]); offsets[1].advanceOffset, ptr->modified_offsets[1]);
if (glyph_count > 2) if (glyph_count > 2)
ok(ptr->modified_offsets[2] == offsets[2].advanceOffset, "%d: got offset[2] %.2f, expected %.2f\n", i, ok(ptr->modified_offsets[2] == offsets[2].advanceOffset, "Got offset[2] %.2f, expected %.2f.\n",
offsets[2].advanceOffset, ptr->modified_offsets[2]); offsets[2].advanceOffset, ptr->modified_offsets[2]);
ok(offsets[0].ascenderOffset == 23.0f, "%d: unexpected ascenderOffset %.2f\n", i, offsets[0].ascenderOffset); ok(offsets[0].ascenderOffset == 23.0f, "Unexpected ascenderOffset %.2f.\n", offsets[0].ascenderOffset);
ok(offsets[1].ascenderOffset == 32.0f, "%d: unexpected ascenderOffset %.2f\n", i, offsets[1].ascenderOffset); ok(offsets[1].ascenderOffset == 32.0f, "Unexpected ascenderOffset %.2f.\n", offsets[1].ascenderOffset);
ok(offsets[2].ascenderOffset == 31.0f, "%d: unexpected ascenderOffset %.2f\n", i, offsets[2].ascenderOffset); ok(offsets[2].ascenderOffset == 31.0f, "Unexpected ascenderOffset %.2f.\n", offsets[2].ascenderOffset);
} }
else { else
{
/* with aliased advances original values are retained */ /* with aliased advances original values are retained */
ok(ptr->advances[0] == advances[0], "%d: got advance[0] %.2f, expected %.2f\n", i, advances[0], ptr->advances[0]); ok(ptr->advances[0] == advances[0], "Got advance[0] %.2f, expected %.2f.\n", advances[0], ptr->advances[0]);
ok(ptr->advances[1] == advances[1], "%d: got advance[1] %.2f, expected %.2f\n", i, advances[1], ptr->advances[1]); ok(ptr->advances[1] == advances[1], "Got advance[1] %.2f, expected %.2f.\n", advances[1], ptr->advances[1]);
ok(ptr->offsets[0] == offsets[0].advanceOffset, "%d: got offset[0] %.2f, expected %.2f\n", i, ok(ptr->offsets[0] == offsets[0].advanceOffset, "Got offset[0] %.2f, expected %.2f.\n",
offsets[0].advanceOffset, ptr->modified_offsets[0]); offsets[0].advanceOffset, ptr->modified_offsets[0]);
ok(ptr->offsets[1] == offsets[1].advanceOffset, "%d: got offset[1] %.2f, expected %.2f\n", i, ok(ptr->offsets[1] == offsets[1].advanceOffset, "Got offset[1] %.2f, expected %.2f.\n",
offsets[1].advanceOffset, ptr->modified_offsets[1]); offsets[1].advanceOffset, ptr->modified_offsets[1]);
ok(offsets[0].ascenderOffset == 23.0f, "%d: unexpected ascenderOffset %.2f\n", i, offsets[0].ascenderOffset); ok(offsets[0].ascenderOffset == 23.0f, "Unexpected ascenderOffset %.2f.\n", offsets[0].ascenderOffset);
ok(offsets[1].ascenderOffset == 32.0f, "%d: unexpected ascenderOffset %.2f\n", i, offsets[1].ascenderOffset); ok(offsets[1].ascenderOffset == 32.0f, "Unexpected ascenderOffset %.2f.\n", offsets[1].ascenderOffset);
} }
winetest_pop_context();
} }
IDWriteTextAnalyzer1_Release(analyzer1); IDWriteTextAnalyzer1_Release(analyzer1);

View file

@ -2133,56 +2133,61 @@ static void check_font_metrics(const WCHAR *nameW, IDWriteFontFace *fontface, co
else else
IDWriteFontFace_GetMetrics(fontface, (DWRITE_FONT_METRICS *)&metrics); IDWriteFontFace_GetMetrics(fontface, (DWRITE_FONT_METRICS *)&metrics);
ok(metrics.designUnitsPerEm == expected->designUnitsPerEm, "font %s: designUnitsPerEm %u, expected %u\n", winetest_push_context("Font %s", wine_dbgstr_w(nameW));
wine_dbgstr_w(nameW), metrics.designUnitsPerEm, expected->designUnitsPerEm);
ok(metrics.ascent == expected->ascent, "font %s: ascent %u, expected %u\n", wine_dbgstr_w(nameW), metrics.ascent,
expected->ascent);
ok(metrics.descent == expected->descent, "font %s: descent %u, expected %u\n", wine_dbgstr_w(nameW),
metrics.descent, expected->descent);
ok(metrics.lineGap == expected->lineGap, "font %s: lineGap %d, expected %d\n", wine_dbgstr_w(nameW),
metrics.lineGap, expected->lineGap);
ok(metrics.underlinePosition == expected->underlinePosition, "font %s: underlinePosition %d, expected %d\n",
wine_dbgstr_w(nameW), metrics.underlinePosition, expected->underlinePosition);
ok(metrics.underlineThickness == expected->underlineThickness, "font %s: underlineThickness %u, "
"expected %u\n", wine_dbgstr_w(nameW), metrics.underlineThickness, expected->underlineThickness);
ok(metrics.strikethroughPosition == expected->strikethroughPosition, "font %s: strikethroughPosition %d, expected %d\n",
wine_dbgstr_w(nameW), metrics.strikethroughPosition, expected->strikethroughPosition);
ok(metrics.strikethroughThickness == expected->strikethroughThickness, "font %s: strikethroughThickness %u, "
"expected %u\n", wine_dbgstr_w(nameW), metrics.strikethroughThickness, expected->strikethroughThickness);
if (has_metrics1) { ok(metrics.designUnitsPerEm == expected->designUnitsPerEm, "designUnitsPerEm %u, expected %u.\n",
metrics.designUnitsPerEm, expected->designUnitsPerEm);
ok(metrics.ascent == expected->ascent, "ascent %u, expected %u.\n", metrics.ascent, expected->ascent);
ok(metrics.descent == expected->descent, "descent %u, expected %u.\n", metrics.descent, expected->descent);
ok(metrics.lineGap == expected->lineGap, "lineGap %d, expected %d.\n", metrics.lineGap, expected->lineGap);
ok(metrics.underlinePosition == expected->underlinePosition, "underlinePosition %d, expected %d.\n",
metrics.underlinePosition, expected->underlinePosition);
ok(metrics.underlineThickness == expected->underlineThickness, "underlineThickness %u, expected %u.\n",
metrics.underlineThickness, expected->underlineThickness);
ok(metrics.strikethroughPosition == expected->strikethroughPosition, "strikethroughPosition %d, expected %d.\n",
metrics.strikethroughPosition, expected->strikethroughPosition);
ok(metrics.strikethroughThickness == expected->strikethroughThickness, "strikethroughThickness %u, "
"expected %u.\n", metrics.strikethroughThickness, expected->strikethroughThickness);
if (has_metrics1)
{
/* For simulated faces metrics are adjusted. Enable tests when exact pattern is understood. */ /* For simulated faces metrics are adjusted. Enable tests when exact pattern is understood. */
if (simulations & DWRITE_FONT_SIMULATIONS_OBLIQUE) if (simulations & DWRITE_FONT_SIMULATIONS_OBLIQUE)
{
winetest_pop_context();
return; return;
}
ok(metrics.hasTypographicMetrics == expected->hasTypographicMetrics, "font %s: hasTypographicMetrics %d, " ok(metrics.hasTypographicMetrics == expected->hasTypographicMetrics, "hasTypographicMetrics %d, "
"expected %d\n", wine_dbgstr_w(nameW), metrics.hasTypographicMetrics, expected->hasTypographicMetrics); "expected %d.\n", metrics.hasTypographicMetrics, expected->hasTypographicMetrics);
ok(metrics.glyphBoxLeft == expected->glyphBoxLeft, "font %s: glyphBoxLeft %d, expected %d\n", ok(metrics.glyphBoxLeft == expected->glyphBoxLeft, "glyphBoxLeft %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.glyphBoxLeft, expected->glyphBoxLeft); metrics.glyphBoxLeft, expected->glyphBoxLeft);
ok(metrics.glyphBoxTop == expected->glyphBoxTop, "font %s: glyphBoxTop %d, expected %d\n", ok(metrics.glyphBoxTop == expected->glyphBoxTop, "glyphBoxTop %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.glyphBoxTop, expected->glyphBoxTop); metrics.glyphBoxTop, expected->glyphBoxTop);
ok(metrics.glyphBoxRight == expected->glyphBoxRight, "font %s: glyphBoxRight %d, expected %d\n", ok(metrics.glyphBoxRight == expected->glyphBoxRight, "glyphBoxRight %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.glyphBoxRight, expected->glyphBoxRight); metrics.glyphBoxRight, expected->glyphBoxRight);
ok(metrics.glyphBoxBottom == expected->glyphBoxBottom, "font %s: glyphBoxBottom %d, expected %d\n", ok(metrics.glyphBoxBottom == expected->glyphBoxBottom, "glyphBoxBottom %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.glyphBoxBottom, expected->glyphBoxBottom); metrics.glyphBoxBottom, expected->glyphBoxBottom);
ok(metrics.subscriptPositionX == expected->subscriptPositionX, "font %s: subscriptPositionX %d, expected %d\n", ok(metrics.subscriptPositionX == expected->subscriptPositionX, "subscriptPositionX %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.subscriptPositionX, expected->subscriptPositionX); metrics.subscriptPositionX, expected->subscriptPositionX);
ok(metrics.subscriptPositionY == expected->subscriptPositionY, "font %s: subscriptPositionY %d, expected %d\n", ok(metrics.subscriptPositionY == expected->subscriptPositionY, "subscriptPositionY %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.subscriptPositionY, expected->subscriptPositionY); metrics.subscriptPositionY, expected->subscriptPositionY);
ok(metrics.subscriptSizeX == expected->subscriptSizeX, "font %s: subscriptSizeX %d, expected %d\n", ok(metrics.subscriptSizeX == expected->subscriptSizeX, "subscriptSizeX %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.subscriptSizeX, expected->subscriptSizeX); metrics.subscriptSizeX, expected->subscriptSizeX);
ok(metrics.subscriptSizeY == expected->subscriptSizeY, "font %s: subscriptSizeY %d, expected %d\n", ok(metrics.subscriptSizeY == expected->subscriptSizeY, "subscriptSizeY %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.subscriptSizeY, expected->subscriptSizeY); metrics.subscriptSizeY, expected->subscriptSizeY);
ok(metrics.superscriptPositionX == expected->superscriptPositionX, "font %s: superscriptPositionX %d, expected %d\n", ok(metrics.superscriptPositionX == expected->superscriptPositionX, "superscriptPositionX %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.superscriptPositionX, expected->superscriptPositionX); metrics.superscriptPositionX, expected->superscriptPositionX);
ok(metrics.superscriptPositionY == expected->superscriptPositionY, "font %s: superscriptPositionY %d, expected %d\n", ok(metrics.superscriptPositionY == expected->superscriptPositionY, "superscriptPositionY %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.superscriptPositionY, expected->superscriptPositionY); metrics.superscriptPositionY, expected->superscriptPositionY);
ok(metrics.superscriptSizeX == expected->superscriptSizeX, "font %s: superscriptSizeX %d, expected %d\n", ok(metrics.superscriptSizeX == expected->superscriptSizeX, "superscriptSizeX %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.superscriptSizeX, expected->superscriptSizeX); metrics.superscriptSizeX, expected->superscriptSizeX);
ok(metrics.superscriptSizeY == expected->superscriptSizeY, "font %s: superscriptSizeY %d, expected %d\n", ok(metrics.superscriptSizeY == expected->superscriptSizeY, "superscriptSizeY %d, expected %d.\n",
wine_dbgstr_w(nameW), metrics.superscriptSizeY, expected->superscriptSizeY); metrics.superscriptSizeY, expected->superscriptSizeY);
} }
winetest_pop_context();
} }
static void get_enus_string(IDWriteLocalizedStrings *strings, WCHAR *buff, UINT32 size) static void get_enus_string(IDWriteLocalizedStrings *strings, WCHAR *buff, UINT32 size)
@ -2873,21 +2878,22 @@ if (0) /* crashes on native */
sim = IDWriteFontFace_GetSimulations(fontface); sim = IDWriteFontFace_GetSimulations(fontface);
get_logfont_from_font(font, &lf); get_logfont_from_font(font, &lf);
ok(logfont.lfWeight == lf.lfWeight, "%s: unexpected lfWeight %d, expected lfWeight %d, font weight %d, " winetest_push_context("Font %s", wine_dbgstr_w(nameW));
"bold simulation %s\n", wine_dbgstr_w(nameW), logfont.lfWeight, lf.lfWeight, IDWriteFont_GetWeight(font),
sim & DWRITE_FONT_SIMULATIONS_BOLD ? "yes" : "no");
ok(logfont.lfItalic == lf.lfItalic, "%s: unexpected italic flag %d, oblique simulation %s\n",
wine_dbgstr_w(nameW), logfont.lfItalic, sim & DWRITE_FONT_SIMULATIONS_OBLIQUE ? "yes" : "no");
ok(!lstrcmpW(logfont.lfFaceName, lf.lfFaceName), "%s: unexpected facename %s, expected %s\n",
wine_dbgstr_w(nameW), wine_dbgstr_w(logfont.lfFaceName), wine_dbgstr_w(lf.lfFaceName));
ok(logfont.lfOutPrecision == OUT_OUTLINE_PRECIS, "%s: unexpected output precision %d\n", wine_dbgstr_w(nameW), ok(logfont.lfWeight == lf.lfWeight, "Unexpected lfWeight %d, expected lfWeight %d, font weight %d, "
logfont.lfOutPrecision); "bold simulation %s.\n", logfont.lfWeight, lf.lfWeight, IDWriteFont_GetWeight(font),
ok(logfont.lfClipPrecision == CLIP_DEFAULT_PRECIS, "%s: unexpected clipping precision %d\n", wine_dbgstr_w(nameW), sim & DWRITE_FONT_SIMULATIONS_BOLD ? "yes" : "no");
logfont.lfClipPrecision); ok(logfont.lfItalic == lf.lfItalic, "Unexpected italic flag %d, oblique simulation %s.\n",
ok(logfont.lfQuality == DEFAULT_QUALITY, "%s: unexpected quality %d\n", wine_dbgstr_w(nameW), logfont.lfQuality); logfont.lfItalic, sim & DWRITE_FONT_SIMULATIONS_OBLIQUE ? "yes" : "no");
ok(logfont.lfPitchAndFamily == DEFAULT_PITCH, "%s: unexpected pitch %d\n", wine_dbgstr_w(nameW), ok(!lstrcmpW(logfont.lfFaceName, lf.lfFaceName), "Unexpected facename %s, expected %s\n",
logfont.lfPitchAndFamily); wine_dbgstr_w(logfont.lfFaceName), wine_dbgstr_w(lf.lfFaceName));
ok(logfont.lfOutPrecision == OUT_OUTLINE_PRECIS, "Unexpected output precision %d.\n", logfont.lfOutPrecision);
ok(logfont.lfClipPrecision == CLIP_DEFAULT_PRECIS, "Unexpected clipping precision %d.\n", logfont.lfClipPrecision);
ok(logfont.lfQuality == DEFAULT_QUALITY, "Unexpected quality %d.\n", logfont.lfQuality);
ok(logfont.lfPitchAndFamily == DEFAULT_PITCH, "Unexpected pitch %d.\n", logfont.lfPitchAndFamily);
winetest_pop_context();
IDWriteFontFace_Release(fontface); IDWriteFontFace_Release(fontface);
IDWriteFont_Release(font); IDWriteFont_Release(font);
@ -4840,22 +4846,23 @@ if (0) { /* crashes on native */
sim = IDWriteFont_GetSimulations(font); sim = IDWriteFont_GetSimulations(font);
get_logfont_from_font(font, &lf); winetest_push_context("Font %s", wine_dbgstr_w(nameW));
ok(logfont.lfWeight == lf.lfWeight, "%s: unexpected lfWeight %d, expected lfWeight %d, font weight %d, "
"bold simulation %s\n", wine_dbgstr_w(nameW), logfont.lfWeight, lf.lfWeight, IDWriteFont_GetWeight(font),
sim & DWRITE_FONT_SIMULATIONS_BOLD ? "yes" : "no");
ok(logfont.lfItalic == lf.lfItalic, "%s: unexpected italic flag %d, oblique simulation %s\n",
wine_dbgstr_w(nameW), logfont.lfItalic, sim & DWRITE_FONT_SIMULATIONS_OBLIQUE ? "yes" : "no");
ok(!lstrcmpW(logfont.lfFaceName, lf.lfFaceName), "%s: unexpected facename %s, expected %s\n",
wine_dbgstr_w(nameW), wine_dbgstr_w(logfont.lfFaceName), wine_dbgstr_w(lf.lfFaceName));
ok(logfont.lfOutPrecision == OUT_OUTLINE_PRECIS, "%s: unexpected output precision %d\n", wine_dbgstr_w(nameW), get_logfont_from_font(font, &lf);
logfont.lfOutPrecision); ok(logfont.lfWeight == lf.lfWeight, "Unexpected lfWeight %d, expected lfWeight %d, font weight %d, "
ok(logfont.lfClipPrecision == CLIP_DEFAULT_PRECIS, "%s: unexpected clipping precision %d\n", wine_dbgstr_w(nameW), "bold simulation %s.\n", logfont.lfWeight, lf.lfWeight, IDWriteFont_GetWeight(font),
logfont.lfClipPrecision); sim & DWRITE_FONT_SIMULATIONS_BOLD ? "yes" : "no");
ok(logfont.lfQuality == DEFAULT_QUALITY, "%s: unexpected quality %d\n", wine_dbgstr_w(nameW), logfont.lfQuality); ok(logfont.lfItalic == lf.lfItalic, "Unexpected italic flag %d, oblique simulation %s.\n",
ok(logfont.lfPitchAndFamily == DEFAULT_PITCH, "%s: unexpected pitch %d\n", wine_dbgstr_w(nameW), logfont.lfItalic, sim & DWRITE_FONT_SIMULATIONS_OBLIQUE ? "yes" : "no");
logfont.lfPitchAndFamily); ok(!lstrcmpW(logfont.lfFaceName, lf.lfFaceName), "Unexpected facename %s, expected %s.\n",
wine_dbgstr_w(logfont.lfFaceName), wine_dbgstr_w(lf.lfFaceName));
ok(logfont.lfOutPrecision == OUT_OUTLINE_PRECIS, "Unexpected output precision %d.\n", logfont.lfOutPrecision);
ok(logfont.lfClipPrecision == CLIP_DEFAULT_PRECIS, "Unexpected clipping precision %d.\n", logfont.lfClipPrecision);
ok(logfont.lfQuality == DEFAULT_QUALITY, "Unexpected quality %d.\n", logfont.lfQuality);
ok(logfont.lfPitchAndFamily == DEFAULT_PITCH, "Unexpected pitch %d.\n", logfont.lfPitchAndFamily);
winetest_pop_context();
IDWriteFont_Release(font); IDWriteFont_Release(font);
} }
@ -6206,79 +6213,77 @@ static BOOL get_vdmx_size(const struct VDMX_group *group, int emsize, int *a, in
static void test_metrics_cmp(FLOAT emsize, const DWRITE_FONT_METRICS *metrics, const DWRITE_FONT_METRICS1 *expected) static void test_metrics_cmp(FLOAT emsize, const DWRITE_FONT_METRICS *metrics, const DWRITE_FONT_METRICS1 *expected)
{ {
ok(metrics->designUnitsPerEm == expected->designUnitsPerEm, "%.2f: emsize: got %u expect %u\n", winetest_push_context("Size %.2f", emsize);
emsize, metrics->designUnitsPerEm, expected->designUnitsPerEm);
ok(metrics->ascent == expected->ascent, "%.2f a: got %u expect %u\n", ok(metrics->designUnitsPerEm == expected->designUnitsPerEm, "got %u expect %u.\n",
emsize, metrics->ascent, expected->ascent); metrics->designUnitsPerEm, expected->designUnitsPerEm);
ok(metrics->descent == expected->descent, "%.2f d: got %u expect %u\n", ok(metrics->ascent == expected->ascent, "a: got %u expect %u.\n", metrics->ascent, expected->ascent);
emsize, metrics->descent, expected->descent); ok(metrics->descent == expected->descent, "d: got %u expect %u.\n", metrics->descent, expected->descent);
ok(metrics->lineGap == expected->lineGap, "%.2f lg: got %d expect %d\n", ok(metrics->lineGap == expected->lineGap, "lg: got %d expect %d.\n", metrics->lineGap, expected->lineGap);
emsize, metrics->lineGap, expected->lineGap); ok(metrics->capHeight == expected->capHeight, "capH: got %u expect %u.\n", metrics->capHeight, expected->capHeight);
ok(metrics->capHeight == expected->capHeight, "%.2f capH: got %u expect %u\n", ok(metrics->xHeight == expected->xHeight, "xH: got %u expect %u.\n", metrics->xHeight, expected->xHeight);
emsize, metrics->capHeight, expected->capHeight); ok(metrics->underlinePosition == expected->underlinePosition, "ulP: got %d expect %d.\n",
ok(metrics->xHeight == expected->xHeight, "%.2f xH: got %u expect %u\n", metrics->underlinePosition, expected->underlinePosition);
emsize, metrics->xHeight, expected->xHeight); ok(metrics->underlineThickness == expected->underlineThickness, "ulTh: got %u expect %u.\n",
ok(metrics->underlinePosition == expected->underlinePosition, "%.2f ulP: got %d expect %d\n", metrics->underlineThickness, expected->underlineThickness);
emsize, metrics->underlinePosition, expected->underlinePosition); ok(metrics->strikethroughPosition == expected->strikethroughPosition, "stP: got %d expect %d.\n",
ok(metrics->underlineThickness == expected->underlineThickness, "%.2f ulTh: got %u expect %u\n", metrics->strikethroughPosition, expected->strikethroughPosition);
emsize, metrics->underlineThickness, expected->underlineThickness); ok(metrics->strikethroughThickness == expected->strikethroughThickness, "stTh: got %u expect %u.\n",
ok(metrics->strikethroughPosition == expected->strikethroughPosition, "%.2f stP: got %d expect %d\n", metrics->strikethroughThickness, expected->strikethroughThickness);
emsize, metrics->strikethroughPosition, expected->strikethroughPosition);
ok(metrics->strikethroughThickness == expected->strikethroughThickness, "%.2f stTh: got %u expect %u\n", winetest_pop_context();
emsize, metrics->strikethroughThickness, expected->strikethroughThickness);
} }
static void test_metrics1_cmp(FLOAT emsize, const DWRITE_FONT_METRICS1 *metrics, const DWRITE_FONT_METRICS1 *expected) static void test_metrics1_cmp(FLOAT emsize, const DWRITE_FONT_METRICS1 *metrics, const DWRITE_FONT_METRICS1 *expected)
{ {
ok(metrics->designUnitsPerEm == expected->designUnitsPerEm, "%.2f: emsize: got %u expect %u\n", winetest_push_context("Size %.2f", emsize);
emsize, metrics->designUnitsPerEm, expected->designUnitsPerEm);
ok(metrics->ascent == expected->ascent, "%.2f a: got %u expect %u\n", ok(metrics->designUnitsPerEm == expected->designUnitsPerEm, "got %u expect %u.\n",
emsize, metrics->ascent, expected->ascent); metrics->designUnitsPerEm, expected->designUnitsPerEm);
ok(metrics->descent == expected->descent, "%.2f d: got %u expect %u\n", ok(metrics->ascent == expected->ascent, "a: got %u expect %u.\n", metrics->ascent, expected->ascent);
emsize, metrics->descent, expected->descent); ok(metrics->descent == expected->descent, "d: got %u expect %u.\n", metrics->descent, expected->descent);
ok(metrics->lineGap == expected->lineGap, "%.2f lg: got %d expect %d\n", ok(metrics->lineGap == expected->lineGap, "lg: got %d expect %d.\n", metrics->lineGap, expected->lineGap);
emsize, metrics->lineGap, expected->lineGap); ok(metrics->capHeight == expected->capHeight, "capH: got %u expect %u.\n", metrics->capHeight, expected->capHeight);
ok(metrics->capHeight == expected->capHeight, "%.2f capH: got %u expect %u\n", ok(metrics->xHeight == expected->xHeight, "xH: got %u expect %u.\n", metrics->xHeight, expected->xHeight);
emsize, metrics->capHeight, expected->capHeight); ok(metrics->underlinePosition == expected->underlinePosition, "ulP: got %d expect %d.\n",
ok(metrics->xHeight == expected->xHeight, "%.2f xH: got %u expect %u\n", metrics->underlinePosition, expected->underlinePosition);
emsize, metrics->xHeight, expected->xHeight); ok(metrics->underlineThickness == expected->underlineThickness, "ulTh: got %u expect %u.\n",
ok(metrics->underlinePosition == expected->underlinePosition, "%.2f ulP: got %d expect %d\n", metrics->underlineThickness, expected->underlineThickness);
emsize, metrics->underlinePosition, expected->underlinePosition); ok(metrics->strikethroughPosition == expected->strikethroughPosition, "stP: got %d expect %d.\n",
ok(metrics->underlineThickness == expected->underlineThickness, "%.2f ulTh: got %u expect %u\n", metrics->strikethroughPosition, expected->strikethroughPosition);
emsize, metrics->underlineThickness, expected->underlineThickness); ok(metrics->strikethroughThickness == expected->strikethroughThickness, "stTh: got %u expect %u.\n",
ok(metrics->strikethroughPosition == expected->strikethroughPosition, "%.2f stP: got %d expect %d\n", metrics->strikethroughThickness, expected->strikethroughThickness);
emsize, metrics->strikethroughPosition, expected->strikethroughPosition); ok(metrics->glyphBoxLeft == expected->glyphBoxLeft, "box left: got %d expect %d.\n",
ok(metrics->strikethroughThickness == expected->strikethroughThickness, "%.2f stTh: got %u expect %u\n", metrics->glyphBoxLeft, expected->glyphBoxLeft);
emsize, metrics->strikethroughThickness, expected->strikethroughThickness);
ok(metrics->glyphBoxLeft == expected->glyphBoxLeft, "%.2f box left: got %d expect %d\n",
emsize, metrics->glyphBoxLeft, expected->glyphBoxLeft);
if (0) { /* this is not consistent */ if (0) { /* this is not consistent */
ok(metrics->glyphBoxTop == expected->glyphBoxTop, "%.2f box top: got %d expect %d\n", ok(metrics->glyphBoxTop == expected->glyphBoxTop, "box top: got %d expect %d.\n",
emsize, metrics->glyphBoxTop, expected->glyphBoxTop); metrics->glyphBoxTop, expected->glyphBoxTop);
ok(metrics->glyphBoxRight == expected->glyphBoxRight, "%.2f box right: got %d expect %d\n", ok(metrics->glyphBoxRight == expected->glyphBoxRight, "box right: got %d expect %d.\n",
emsize, metrics->glyphBoxRight, expected->glyphBoxRight); metrics->glyphBoxRight, expected->glyphBoxRight);
} }
ok(metrics->glyphBoxBottom == expected->glyphBoxBottom, "%.2f box bottom: got %d expect %d\n", ok(metrics->glyphBoxBottom == expected->glyphBoxBottom, "box bottom: got %d expect %d.\n",
emsize, metrics->glyphBoxBottom, expected->glyphBoxBottom); metrics->glyphBoxBottom, expected->glyphBoxBottom);
ok(metrics->subscriptPositionX == expected->subscriptPositionX, "%.2f subX: got %d expect %d\n", ok(metrics->subscriptPositionX == expected->subscriptPositionX, "subX: got %d expect %d.\n",
emsize, metrics->subscriptPositionX, expected->subscriptPositionX); metrics->subscriptPositionX, expected->subscriptPositionX);
ok(metrics->subscriptPositionY == expected->subscriptPositionY, "%.2f subY: got %d expect %d\n", ok(metrics->subscriptPositionY == expected->subscriptPositionY, "subY: got %d expect %d.\n",
emsize, metrics->subscriptPositionY, expected->subscriptPositionY); metrics->subscriptPositionY, expected->subscriptPositionY);
ok(metrics->subscriptSizeX == expected->subscriptSizeX, "%.2f subsizeX: got %d expect %d\n", ok(metrics->subscriptSizeX == expected->subscriptSizeX, "subsizeX: got %d expect %d.\n",
emsize, metrics->subscriptSizeX, expected->subscriptSizeX); metrics->subscriptSizeX, expected->subscriptSizeX);
ok(metrics->subscriptPositionY == expected->subscriptPositionY, "%.2f subsizeY: got %d expect %d\n", ok(metrics->subscriptPositionY == expected->subscriptPositionY, "subsizeY: got %d expect %d.\n",
emsize, metrics->subscriptSizeY, expected->subscriptSizeY); metrics->subscriptSizeY, expected->subscriptSizeY);
ok(metrics->superscriptPositionX == expected->superscriptPositionX, "%.2f supX: got %d expect %d\n", ok(metrics->superscriptPositionX == expected->superscriptPositionX, "supX: got %d expect %d.\n",
emsize, metrics->superscriptPositionX, expected->superscriptPositionX); metrics->superscriptPositionX, expected->superscriptPositionX);
if (0) if (0)
ok(metrics->superscriptPositionY == expected->superscriptPositionY, "%.2f supY: got %d expect %d\n", ok(metrics->superscriptPositionY == expected->superscriptPositionY, "supY: got %d expect %d.\n",
emsize, metrics->superscriptPositionY, expected->superscriptPositionY); metrics->superscriptPositionY, expected->superscriptPositionY);
ok(metrics->superscriptSizeX == expected->superscriptSizeX, "%.2f supsizeX: got %d expect %d\n", ok(metrics->superscriptSizeX == expected->superscriptSizeX, "supsizeX: got %d expect %d.\n",
emsize, metrics->superscriptSizeX, expected->superscriptSizeX); metrics->superscriptSizeX, expected->superscriptSizeX);
ok(metrics->superscriptSizeY == expected->superscriptSizeY, "%.2f supsizeY: got %d expect %d\n", ok(metrics->superscriptSizeY == expected->superscriptSizeY, "supsizeY: got %d expect %d.\n",
emsize, metrics->superscriptSizeY, expected->superscriptSizeY); metrics->superscriptSizeY, expected->superscriptSizeY);
ok(metrics->hasTypographicMetrics == expected->hasTypographicMetrics, "%.2f hastypo: got %d expect %d\n", ok(metrics->hasTypographicMetrics == expected->hasTypographicMetrics, "hastypo: got %d expect %d.\n",
emsize, metrics->hasTypographicMetrics, expected->hasTypographicMetrics); metrics->hasTypographicMetrics, expected->hasTypographicMetrics);
winetest_pop_context();
} }
struct compatmetrics_test { struct compatmetrics_test {
@ -6557,27 +6562,31 @@ static void test_GetPanose(void)
IDWriteFont1_GetPanose(font1, &panose); IDWriteFont1_GetPanose(font1, &panose);
get_expected_panose(font1, &expected_panose); get_expected_panose(font1, &expected_panose);
ok(panose.values[0] == expected_panose.values[0], "%s: values[0] %#x, expected %#x.\n", wine_dbgstr_w(nameW), winetest_push_context("Font %s", wine_dbgstr_w(nameW));
ok(panose.values[0] == expected_panose.values[0], "values[0] %#x, expected %#x.\n",
panose.values[0], expected_panose.values[0]); panose.values[0], expected_panose.values[0]);
ok(panose.values[1] == expected_panose.values[1], "%s: values[1] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[1] == expected_panose.values[1], "values[1] %#x, expected %#x.\n",
panose.values[1], expected_panose.values[1]); panose.values[1], expected_panose.values[1]);
ok(panose.values[2] == expected_panose.values[2], "%s: values[2] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[2] == expected_panose.values[2], "values[2] %#x, expected %#x.\n",
panose.values[2], expected_panose.values[2]); panose.values[2], expected_panose.values[2]);
ok(panose.values[3] == expected_panose.values[3], "%s: values[3] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[3] == expected_panose.values[3], "values[3] %#x, expected %#x.\n",
panose.values[3], expected_panose.values[3]); panose.values[3], expected_panose.values[3]);
ok(panose.values[4] == expected_panose.values[4], "%s: values[4] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[4] == expected_panose.values[4], "values[4] %#x, expected %#x.\n",
panose.values[4], expected_panose.values[4]); panose.values[4], expected_panose.values[4]);
ok(panose.values[5] == expected_panose.values[5], "%s: values[5] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[5] == expected_panose.values[5], "values[5] %#x, expected %#x.\n",
panose.values[5], expected_panose.values[5]); panose.values[5], expected_panose.values[5]);
ok(panose.values[6] == expected_panose.values[6], "%s: values[6] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[6] == expected_panose.values[6], "values[6] %#x, expected %#x.\n",
panose.values[6], expected_panose.values[6]); panose.values[6], expected_panose.values[6]);
ok(panose.values[7] == expected_panose.values[7], "%s: values[7] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[7] == expected_panose.values[7], "values[7] %#x, expected %#x.\n",
panose.values[7], expected_panose.values[7]); panose.values[7], expected_panose.values[7]);
ok(panose.values[8] == expected_panose.values[8], "%s: values[8] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[8] == expected_panose.values[8], "values[8] %#x, expected %#x.\n",
panose.values[8], expected_panose.values[8]); panose.values[8], expected_panose.values[8]);
ok(panose.values[9] == expected_panose.values[9], "%s: values[9] %#x, expected %#x.\n", wine_dbgstr_w(nameW), ok(panose.values[9] == expected_panose.values[9], "values[9] %#x, expected %#x.\n",
panose.values[9], expected_panose.values[9]); panose.values[9], expected_panose.values[9]);
winetest_pop_context();
hr = IDWriteFont1_CreateFontFace(font1, &fontface); hr = IDWriteFont1_CreateFontFace(font1, &fontface);
ok(hr == S_OK, "Failed to create a font face, %#x.\n", hr); ok(hr == S_OK, "Failed to create a font face, %#x.\n", hr);
if (IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace3, (void **)&fontface3) == S_OK) { if (IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace3, (void **)&fontface3) == S_OK) {
@ -6876,20 +6885,26 @@ static void test_GetRecommendedRenderingMode(void)
/* detect old dwrite version, that is using higher threshold value */ /* detect old dwrite version, that is using higher threshold value */
g_is_vista = fontface1 == NULL; g_is_vista = fontface1 == NULL;
for (emsize = 1.0; emsize < 500.0; emsize += 1.0) { for (emsize = 1.0; emsize < 500.0; emsize += 1.0)
{
DWRITE_RENDERING_MODE expected; DWRITE_RENDERING_MODE expected;
unsigned int i;
FLOAT ppdip; FLOAT ppdip;
WORD gasp; WORD gasp;
int i;
for (i = 0; i < ARRAY_SIZE(recmode_tests); i++) { winetest_push_context("Size %.2f", emsize);
for (i = 0; i < ARRAY_SIZE(recmode_tests); ++i)
{
winetest_push_context("%u", i);
ppdip = 1.0f; ppdip = 1.0f;
mode = 10; mode = 10;
gasp = get_gasp_flags(fontface, emsize, ppdip); gasp = get_gasp_flags(fontface, emsize, ppdip);
expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold); expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold);
hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode); hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, ppdip %f, flags 0x%04x, expected %d\n", emsize, i, mode, ppdip, gasp, expected); ok(mode == expected, "got %d, ppdip %f, flags 0x%04x, expected %d.\n", mode, ppdip, gasp, expected);
/* some ppdip variants */ /* some ppdip variants */
ppdip = 0.5f; ppdip = 0.5f;
@ -6898,18 +6913,19 @@ static void test_GetRecommendedRenderingMode(void)
expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold); expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold);
hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode); hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, ppdip %f, flags 0x%04x, expected %d\n", emsize, i, mode, ppdip, gasp, expected); ok(mode == expected, "got %d, ppdip %f, flags 0x%04x, expected %d.\n", mode, ppdip, gasp, expected);
/* Only test larger sizes to workaround Win7 differences, where unscaled natural emsize threshold is used; /* Only test larger sizes to workaround Win7 differences, where unscaled natural emsize threshold is used;
Win8 and Win10 handle this as expected. */ Win8 and Win10 handle this as expected. */
if (emsize > 20.0f) { if (emsize > 20.0f)
{
ppdip = 1.5f; ppdip = 1.5f;
mode = 10; mode = 10;
gasp = get_gasp_flags(fontface, emsize, ppdip); gasp = get_gasp_flags(fontface, emsize, ppdip);
expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold); expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold);
hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode); hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, ppdip %f, flags 0x%04x, expected %d\n", emsize, i, mode, ppdip, gasp, expected); ok(mode == expected, "got %d, ppdip %f, flags 0x%04x, expected %d.\n", mode, ppdip, gasp, expected);
ppdip = 2.0f; ppdip = 2.0f;
mode = 10; mode = 10;
@ -6917,15 +6933,21 @@ static void test_GetRecommendedRenderingMode(void)
expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold); expected = get_expected_rendering_mode(emsize * ppdip, gasp, recmode_tests[i].measuring, recmode_tests[i].threshold);
hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode); hr = IDWriteFontFace_GetRecommendedRenderingMode(fontface, emsize, ppdip, recmode_tests[i].measuring, params, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, ppdip %f, flags 0x%04x, expected %d\n", emsize, i, mode, ppdip, gasp, expected); ok(mode == expected, "got %d, ppdip %f, flags 0x%04x, expected %d.\n", mode, ppdip, gasp, expected);
} }
winetest_pop_context();
} }
/* IDWriteFontFace1 offers another variant of this method */ /* IDWriteFontFace1 offers another variant of this method */
if (fontface1) { if (fontface1)
for (i = 0; i < ARRAY_SIZE(recmode_tests1); i++) { {
for (i = 0; i < ARRAY_SIZE(recmode_tests1); ++i)
{
FLOAT dpi; FLOAT dpi;
winetest_push_context("%u", i);
ppdip = 1.0f; ppdip = 1.0f;
dpi = 96.0f * ppdip; dpi = 96.0f * ppdip;
mode = 10; mode = 10;
@ -6934,11 +6956,12 @@ static void test_GetRecommendedRenderingMode(void)
hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi, hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, dpi %f, flags 0x%04x, expected %d\n", emsize, i, mode, dpi, gasp, expected); ok(mode == expected, "got %d, dpi %f, flags 0x%04x, expected %d.\n", mode, dpi, gasp, expected);
/* Only test larger sizes to workaround Win7 differences, where unscaled natural emsize threshold is used; /* Only test larger sizes to workaround Win7 differences, where unscaled natural emsize threshold is used;
Win8 and Win10 handle this as expected. */ Win8 and Win10 handle this as expected. */
if (emsize > 20.0f) { if (emsize > 20.0f)
{
ppdip = 2.0f; ppdip = 2.0f;
dpi = 96.0f * ppdip; dpi = 96.0f * ppdip;
mode = 10; mode = 10;
@ -6947,7 +6970,7 @@ static void test_GetRecommendedRenderingMode(void)
hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi, hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, dpi %f, flags 0x%04x, expected %d\n", emsize, i, mode, dpi, gasp, expected); ok(mode == expected, "got %d, dpi %f, flags 0x%04x, expected %d.\n", mode, dpi, gasp, expected);
ppdip = 0.5f; ppdip = 0.5f;
dpi = 96.0f * ppdip; dpi = 96.0f * ppdip;
@ -6957,7 +6980,7 @@ static void test_GetRecommendedRenderingMode(void)
hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi, hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, dpi %f, flags 0x%04x, expected %d\n", emsize, i, mode, dpi, gasp, expected); ok(mode == expected, "got %d, dpi %f, flags 0x%04x, expected %d.\n", mode, dpi, gasp, expected);
/* try different dpis for X and Y direction */ /* try different dpis for X and Y direction */
ppdip = 1.0f; ppdip = 1.0f;
@ -6968,7 +6991,7 @@ static void test_GetRecommendedRenderingMode(void)
hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi * 0.5f, dpi, hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi * 0.5f, dpi,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, dpi %f, flags 0x%04x, expected %d\n", emsize, i, mode, dpi, gasp, expected); ok(mode == expected, "got %d, dpi %f, flags 0x%04x, expected %d.\n", mode, dpi, gasp, expected);
ppdip = 1.0f; ppdip = 1.0f;
dpi = 96.0f * ppdip; dpi = 96.0f * ppdip;
@ -6978,7 +7001,7 @@ static void test_GetRecommendedRenderingMode(void)
hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi * 0.5f, hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi * 0.5f,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, dpi %f, flags 0x%04x, expected %d\n", emsize, i, mode, dpi, gasp, expected); ok(mode == expected, "got %d, dpi %f, flags 0x%04x, expected %d.\n", mode, dpi, gasp, expected);
ppdip = 2.0f; ppdip = 2.0f;
dpi = 96.0f * ppdip; dpi = 96.0f * ppdip;
@ -6988,7 +7011,7 @@ static void test_GetRecommendedRenderingMode(void)
hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi * 0.5f, dpi, hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi * 0.5f, dpi,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, dpi %f, flags 0x%04x, expected %d\n", emsize, i, mode, dpi, gasp, expected); ok(mode == expected, "got %d, dpi %f, flags 0x%04x, expected %d.\n", mode, dpi, gasp, expected);
ppdip = 2.0f; ppdip = 2.0f;
dpi = 96.0f * ppdip; dpi = 96.0f * ppdip;
@ -6998,8 +7021,10 @@ static void test_GetRecommendedRenderingMode(void)
hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi * 0.5f, hr = IDWriteFontFace1_GetRecommendedRenderingMode(fontface1, emsize, dpi, dpi * 0.5f,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, &mode);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f/%d: got %d, dpi %f, flags 0x%04x, expected %d\n", emsize, i, mode, dpi, gasp, expected); ok(mode == expected, "got %d, dpi %f, flags 0x%04x, expected %d.\n", mode, dpi, gasp, expected);
} }
winetest_pop_context();
} }
} }
@ -7008,16 +7033,20 @@ static void test_GetRecommendedRenderingMode(void)
DWRITE_GRID_FIT_MODE gridfit, expected_gridfit; DWRITE_GRID_FIT_MODE gridfit, expected_gridfit;
gasp = get_gasp_flags(fontface, emsize, 1.0f); gasp = get_gasp_flags(fontface, emsize, 1.0f);
for (i = 0; i < ARRAY_SIZE(recmode_tests1); i++) { for (i = 0; i < ARRAY_SIZE(recmode_tests1); ++i)
{
winetest_push_context("%u", i);
mode = 10; mode = 10;
expected = get_expected_rendering_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold); expected = get_expected_rendering_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold);
expected_gridfit = get_expected_gridfit_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold); expected_gridfit = get_expected_gridfit_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold);
hr = IDWriteFontFace2_GetRecommendedRenderingMode(fontface2, emsize, 96.0f, 96.0f, hr = IDWriteFontFace2_GetRecommendedRenderingMode(fontface2, emsize, 96.0f, 96.0f,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, params, &mode, &gridfit); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, params, &mode, &gridfit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode == expected, "%.2f: got %d, flags 0x%04x, expected %d\n", emsize, mode, gasp, expected); ok(mode == expected, "got %d, flags 0x%04x, expected %d.\n", mode, gasp, expected);
ok(gridfit == expected_gridfit, "%.2f/%d: gridfit: got %d, flags 0x%04x, expected %d\n", emsize, i, gridfit, ok(gridfit == expected_gridfit, "gridfit: got %d, flags 0x%04x, expected %d.\n", gridfit, gasp, expected_gridfit);
gasp, expected_gridfit);
winetest_pop_context();
} }
} }
@ -7027,18 +7056,24 @@ static void test_GetRecommendedRenderingMode(void)
DWRITE_RENDERING_MODE1 mode1, expected1; DWRITE_RENDERING_MODE1 mode1, expected1;
gasp = get_gasp_flags(fontface, emsize, 1.0f); gasp = get_gasp_flags(fontface, emsize, 1.0f);
for (i = 0; i < ARRAY_SIZE(recmode_tests1); i++) { for (i = 0; i < ARRAY_SIZE(recmode_tests1); ++i)
{
winetest_push_context("%u", i);
mode1 = 10; mode1 = 10;
expected1 = get_expected_rendering_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold); expected1 = get_expected_rendering_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold);
expected_gridfit = get_expected_gridfit_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold); expected_gridfit = get_expected_gridfit_mode(emsize, gasp, recmode_tests1[i].measuring, recmode_tests1[i].threshold);
hr = IDWriteFontFace3_GetRecommendedRenderingMode(fontface3, emsize, 96.0f, 96.0f, hr = IDWriteFontFace3_GetRecommendedRenderingMode(fontface3, emsize, 96.0f, 96.0f,
NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, params, &mode1, &gridfit); NULL, FALSE, recmode_tests1[i].threshold, recmode_tests1[i].measuring, params, &mode1, &gridfit);
ok(hr == S_OK, "got 0x%08x\n", hr); ok(hr == S_OK, "got 0x%08x\n", hr);
ok(mode1 == expected1, "%.2f: got %d, flags 0x%04x, expected %d\n", emsize, mode1, gasp, expected1); ok(mode1 == expected1, "got %d, flags 0x%04x, expected %d.\n", mode1, gasp, expected1);
ok(gridfit == expected_gridfit, "%.2f/%d: gridfit: got %d, flags 0x%04x, expected %d\n", emsize, i, gridfit, ok(gridfit == expected_gridfit, "gridfit: got %d, flags 0x%04x, expected %d.\n", gridfit, gasp, expected_gridfit);
gasp, expected_gridfit);
winetest_pop_context();
} }
} }
winetest_pop_context();
} }
IDWriteRenderingParams_Release(params); IDWriteRenderingParams_Release(params);
@ -8161,19 +8196,23 @@ static void test_GetFontSignature(void)
get_expected_fontsig(font, &expected_signature); get_expected_fontsig(font, &expected_signature);
ok(fontsig.fsUsb[0] == expected_signature.fsUsb[0], "%s: fsUsb[0] %#x, expected %#x\n", wine_dbgstr_w(nameW), winetest_push_context("Font %s\n", wine_dbgstr_w(nameW));
fontsig.fsUsb[0], expected_signature.fsUsb[0]);
ok(fontsig.fsUsb[1] == expected_signature.fsUsb[1], "%s: fsUsb[1] %#x, expected %#x\n", wine_dbgstr_w(nameW),
fontsig.fsUsb[1], expected_signature.fsUsb[1]);
ok(fontsig.fsUsb[2] == expected_signature.fsUsb[2], "%s: fsUsb[2] %#x, expected %#x\n", wine_dbgstr_w(nameW),
fontsig.fsUsb[2], expected_signature.fsUsb[2]);
ok(fontsig.fsUsb[3] == expected_signature.fsUsb[3], "%s: fsUsb[3] %#x, expected %#x\n", wine_dbgstr_w(nameW),
fontsig.fsUsb[3], expected_signature.fsUsb[3]);
ok(fontsig.fsCsb[0] == expected_signature.fsCsb[0], "%s: fsCsb[0] %#x, expected %#x\n", wine_dbgstr_w(nameW), ok(fontsig.fsUsb[0] == expected_signature.fsUsb[0], "fsUsb[0] %#x, expected %#x.\n",
fontsig.fsCsb[0], expected_signature.fsCsb[0]); fontsig.fsUsb[0], expected_signature.fsUsb[0]);
ok(fontsig.fsCsb[1] == expected_signature.fsCsb[1], "%s: fsCsb[1] %#x, expected %#x\n", wine_dbgstr_w(nameW), ok(fontsig.fsUsb[1] == expected_signature.fsUsb[1], "fsUsb[1] %#x, expected %#x.\n",
fontsig.fsCsb[1], expected_signature.fsCsb[1]); fontsig.fsUsb[1], expected_signature.fsUsb[1]);
ok(fontsig.fsUsb[2] == expected_signature.fsUsb[2], "fsUsb[2] %#x, expected %#x.\n",
fontsig.fsUsb[2], expected_signature.fsUsb[2]);
ok(fontsig.fsUsb[3] == expected_signature.fsUsb[3], "fsUsb[3] %#x, expected %#x.\n",
fontsig.fsUsb[3], expected_signature.fsUsb[3]);
ok(fontsig.fsCsb[0] == expected_signature.fsCsb[0], "fsCsb[0] %#x, expected %#x.\n",
fontsig.fsCsb[0], expected_signature.fsCsb[0]);
ok(fontsig.fsCsb[1] == expected_signature.fsCsb[1], "fsCsb[1] %#x, expected %#x.\n",
fontsig.fsCsb[1], expected_signature.fsCsb[1]);
winetest_pop_context();
IDWriteFont_Release(font); IDWriteFont_Release(font);
IDWriteFontFamily_Release(family); IDWriteFontFamily_Release(family);
@ -9340,30 +9379,34 @@ static void test_CreateCustomRenderingParams(void)
for (i = 0; i < ARRAY_SIZE(params_tests); i++) { for (i = 0; i < ARRAY_SIZE(params_tests); i++) {
IDWriteRenderingParams *params; IDWriteRenderingParams *params;
winetest_push_context("%u", i);
params = (void *)0xdeadbeef; params = (void *)0xdeadbeef;
hr = IDWriteFactory_CreateCustomRenderingParams(factory, params_tests[i].gamma, params_tests[i].contrast, hr = IDWriteFactory_CreateCustomRenderingParams(factory, params_tests[i].gamma, params_tests[i].contrast,
params_tests[i].cleartype_level, params_tests[i].geometry, params_tests[i].rendering_mode, &params); params_tests[i].cleartype_level, params_tests[i].geometry, params_tests[i].rendering_mode, &params);
ok(hr == params_tests[i].hr, "%u: unexpected hr %#x, expected %#x.\n", i, hr, params_tests[i].hr); ok(hr == params_tests[i].hr, "unexpected hr %#x, expected %#x.\n", hr, params_tests[i].hr);
if (hr == S_OK) { if (hr == S_OK) {
ok(params_tests[i].gamma == IDWriteRenderingParams_GetGamma(params), "%u: unexpected gamma %f, expected %f.\n", ok(params_tests[i].gamma == IDWriteRenderingParams_GetGamma(params), "unexpected gamma %f, expected %f.\n",
i, IDWriteRenderingParams_GetGamma(params), params_tests[i].gamma); IDWriteRenderingParams_GetGamma(params), params_tests[i].gamma);
ok(params_tests[i].contrast == IDWriteRenderingParams_GetEnhancedContrast(params), ok(params_tests[i].contrast == IDWriteRenderingParams_GetEnhancedContrast(params),
"%u: unexpected contrast %f, expected %f.\n", "unexpected contrast %f, expected %f.\n",
i, IDWriteRenderingParams_GetEnhancedContrast(params), params_tests[i].contrast); IDWriteRenderingParams_GetEnhancedContrast(params), params_tests[i].contrast);
ok(params_tests[i].cleartype_level == IDWriteRenderingParams_GetClearTypeLevel(params), ok(params_tests[i].cleartype_level == IDWriteRenderingParams_GetClearTypeLevel(params),
"%u: unexpected ClearType level %f, expected %f.\n", "unexpected ClearType level %f, expected %f.\n",
i, IDWriteRenderingParams_GetClearTypeLevel(params), params_tests[i].cleartype_level); IDWriteRenderingParams_GetClearTypeLevel(params), params_tests[i].cleartype_level);
ok(params_tests[i].geometry == IDWriteRenderingParams_GetPixelGeometry(params), ok(params_tests[i].geometry == IDWriteRenderingParams_GetPixelGeometry(params),
"%u: unexpected pixel geometry %u, expected %u.\n", i, IDWriteRenderingParams_GetPixelGeometry(params), "unexpected pixel geometry %u, expected %u.\n", IDWriteRenderingParams_GetPixelGeometry(params),
params_tests[i].geometry); params_tests[i].geometry);
ok(params_tests[i].rendering_mode == IDWriteRenderingParams_GetRenderingMode(params), ok(params_tests[i].rendering_mode == IDWriteRenderingParams_GetRenderingMode(params),
"%u: unexpected rendering mode %u, expected %u.\n", i, IDWriteRenderingParams_GetRenderingMode(params), "unexpected rendering mode %u, expected %u.\n", IDWriteRenderingParams_GetRenderingMode(params),
params_tests[i].rendering_mode); params_tests[i].rendering_mode);
IDWriteRenderingParams_Release(params); IDWriteRenderingParams_Release(params);
} }
else else
ok(params == NULL, "%u: expected NULL interface pointer on failure.\n", i); ok(params == NULL, "%u: expected NULL interface pointer on failure.\n", i);
winetest_pop_context();
} }
ref = IDWriteFactory_Release(factory); ref = IDWriteFactory_Release(factory);