From: Akihiro Sagawa Subject: [PATCH 2/4] gdi32/tests: Add synthetic bold metrics tests with various DC transforms. Message-Id: <20180216001732.3E69.375B48EC@gmail.com> Date: Sat, 17 Feb 2018 15:14:27 +0900 Newly add this change before adding bitmap font tests. Signed-off-by: Akihiro Sagawa --- dlls/gdi32/tests/font.c | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index d6fe9e3..37f475e 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -6472,9 +6472,11 @@ static void test_GetCharWidth32(void) DeleteObject(hfont); } -static void test_fake_bold_font(void) +static void test_fake_bold_font(int mmode) { static const MAT2 x2_mat = { {0,2}, {0,0}, {0,0}, {0,2} }; + static const unsigned int win_scale = 20; + POINT map_scale; HDC hdc; LOGFONTA lf; BOOL ret; @@ -6498,6 +6500,17 @@ static void test_fake_bold_font(void) lf.lfCharSet = SYMBOL_CHARSET; hdc = GetDC(NULL); + SetMapMode(hdc, mmode); + if (mmode == MM_ISOTROPIC) + { + int x, y; + x = GetDeviceCaps(hdc, VERTRES); + y = GetDeviceCaps(hdc, HORZRES); + ret = SetWindowExtEx(hdc, x * win_scale, y * win_scale, NULL); + ok(ret, "SetWindowExtEx failed, err %d\n", GetLastError()); + ret = SetViewportExtEx(hdc, x, y, NULL); + ok(ret, "SetViewportExtEx failed, err %d\n", GetLastError()); + } for (i = 0; i <= 1; i++) { @@ -6518,28 +6531,30 @@ static void test_fake_bold_font(void) SelectObject(hdc, hfont_old); DeleteObject(hfont); } + map_scale.x = map_scale.y = 1; + DPtoLP(hdc, &map_scale, 1); ReleaseDC(NULL, hdc); /* compare results (outline) */ ok(data[0].tm.tmHeight == data[1].tm.tmHeight, - "expected %d, got %d\n", data[0].tm.tmHeight, data[1].tm.tmHeight); + "%d: expected %d, got %d\n", mmode, data[0].tm.tmHeight, data[1].tm.tmHeight); ok(data[0].tm.tmAscent == data[1].tm.tmAscent, - "expected %d, got %d\n", data[0].tm.tmAscent, data[1].tm.tmAscent); + "%d: expected %d, got %d\n", mmode, data[0].tm.tmAscent, data[1].tm.tmAscent); ok(data[0].tm.tmDescent == data[1].tm.tmDescent, - "expected %d, got %d\n", data[0].tm.tmDescent, data[1].tm.tmDescent); - ok(data[0].tm.tmAveCharWidth + 1 == data[1].tm.tmAveCharWidth, - "expected %d, got %d\n", data[0].tm.tmAveCharWidth + 1, data[1].tm.tmAveCharWidth); - ok(data[0].tm.tmMaxCharWidth + 1 == data[1].tm.tmMaxCharWidth, - "expected %d, got %d\n", data[0].tm.tmMaxCharWidth + 1, data[1].tm.tmMaxCharWidth); + "%d: expected %d, got %d\n", mmode, data[0].tm.tmDescent, data[1].tm.tmDescent); + ok(match_off_by_1(data[0].tm.tmAveCharWidth + map_scale.x, data[1].tm.tmAveCharWidth, mmode == MM_TEXT), + "%d: expected %d, got %d\n", mmode, data[0].tm.tmAveCharWidth + map_scale.x, data[1].tm.tmAveCharWidth); + ok(match_off_by_1(data[0].tm.tmMaxCharWidth + map_scale.x, data[1].tm.tmMaxCharWidth, mmode == MM_TEXT), + "%d: expected %d, got %d\n", mmode, data[0].tm.tmMaxCharWidth + map_scale.x, data[1].tm.tmMaxCharWidth); ok(data[0].tm.tmOverhang == data[1].tm.tmOverhang, - "expected %d, got %d\n", data[0].tm.tmOverhang, data[1].tm.tmOverhang); - ok(data[0].w + 1 == data[1].w, - "expected %d, got %d\n", data[0].w + 1, data[1].w); + "%d: expected %d, got %d\n", mmode, data[0].tm.tmOverhang, data[1].tm.tmOverhang); + ok(match_off_by_1(data[0].w + map_scale.x, data[1].w, mmode == MM_TEXT), + "%d: expected %d, got %d\n", mmode, data[0].w + map_scale.x, data[1].w); ok(data[0].gm.gmCellIncX + 1 == data[1].gm.gmCellIncX, - "expected %d, got %d\n", data[0].gm.gmCellIncX + 1, data[1].gm.gmCellIncX); + "%d: expected %d, got %d\n", mmode, data[0].gm.gmCellIncX + 1, data[1].gm.gmCellIncX); ok(data[0].gm.gmCellIncY == data[1].gm.gmCellIncY, - "expected %d, got %d\n", data[0].gm.gmCellIncY, data[1].gm.gmCellIncY); + "%d: expected %d, got %d\n", mmode, data[0].gm.gmCellIncY, data[1].gm.gmCellIncY); } static void test_bitmap_font_glyph_index(void) @@ -6830,7 +6845,9 @@ START_TEST(font) test_max_height(); test_vertical_order(); test_GetCharWidth32(); - test_fake_bold_font(); + test_fake_bold_font(MM_TEXT); + test_fake_bold_font(MM_HIENGLISH); + test_fake_bold_font(MM_ISOTROPIC); test_bitmap_font_glyph_index(); test_GetCharWidthI(); test_long_names();