Dmitry Timoshkov : gdi32: Add more tests for bitmap font metrics scaling.
Alexandre Julliard
julliard at winehq.org
Tue Jan 8 10:21:43 CST 2008
Module: wine
Branch: master
Commit: 3068ac9eca997f1c99dd28347e768fdee3709def
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3068ac9eca997f1c99dd28347e768fdee3709def
Author: Dmitry Timoshkov <dmitry at codeweavers.com>
Date: Tue Jan 8 15:55:34 2008 +0800
gdi32: Add more tests for bitmap font metrics scaling.
---
dlls/gdi32/tests/font.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index d38ec8d..b6e8327 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -158,17 +158,20 @@ static INT CALLBACK font_enum_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DW
static void test_font_metrics(HDC hdc, HFONT hfont, const char *test_str,
INT test_str_len, const TEXTMETRICA *tm_orig,
- const SIZE *size_orig, INT width_orig,
+ const SIZE *size_orig, INT width_of_A_orig,
INT scale_x, INT scale_y)
{
HFONT old_hfont;
+ LOGFONTA lf;
TEXTMETRICA tm;
SIZE size;
- INT width;
+ INT width_of_A;
if (!hfont)
return;
+ GetObjectA(hfont, sizeof(lf), &lf);
+
old_hfont = SelectObject(hdc, hfont);
GetTextMetricsA(hdc, &tm);
@@ -177,20 +180,25 @@ static void test_font_metrics(HDC hdc, HFONT hfont, const char *test_str,
ok(tm.tmAscent == tm_orig->tmAscent * scale_y, "%d != %d\n", tm.tmAscent, tm_orig->tmAscent * scale_y);
ok(tm.tmDescent == tm_orig->tmDescent * scale_y, "%d != %d\n", tm.tmDescent, tm_orig->tmDescent * scale_y);
ok(tm.tmAveCharWidth == tm_orig->tmAveCharWidth * scale_x, "%d != %d\n", tm.tmAveCharWidth, tm_orig->tmAveCharWidth * scale_x);
+ ok(tm.tmMaxCharWidth == tm_orig->tmMaxCharWidth * scale_x, "%d != %d\n", tm.tmAveCharWidth, tm_orig->tmMaxCharWidth * scale_x);
+
+ ok(lf.lfHeight == tm.tmHeight, "lf %d != tm %d\n", lf.lfHeight, tm.tmHeight);
+ if (lf.lfWidth)
+ ok(lf.lfWidth == tm.tmAveCharWidth, "lf %d != tm %d\n", lf.lfWidth, tm.tmAveCharWidth);
GetTextExtentPoint32A(hdc, test_str, test_str_len, &size);
ok(size.cx == size_orig->cx * scale_x, "%d != %d\n", size.cx, size_orig->cx * scale_x);
ok(size.cy == size_orig->cy * scale_y, "%d != %d\n", size.cy, size_orig->cy * scale_y);
- GetCharWidthA(hdc, 'A', 'A', &width);
+ GetCharWidthA(hdc, 'A', 'A', &width_of_A);
- ok(width == width_orig * scale_x, "%d != %d\n", width, width_orig * scale_x);
+ ok(width_of_A == width_of_A_orig * scale_x, "%d != %d\n", width_of_A, width_of_A_orig * scale_x);
SelectObject(hdc, old_hfont);
}
-/* see whether GDI scales bitmap font metrics */
+/* Test how GDI scales bitmap font metrics */
static void test_bitmap_font(void)
{
static const char test_str[11] = "Test String";
@@ -246,7 +254,6 @@ todo_wine
bitmap_lf.lfHeight = height_orig * 3;
bitmap_lf.lfWidth = 0;
hfont = create_font("3x3", &bitmap_lf);
-
todo_wine
{
test_font_metrics(hdc, hfont, test_str, sizeof(test_str), &tm_orig, &size_orig, width_orig, 3, 3);
More information about the wine-cvs
mailing list