Commit cca41207 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdi32: Fix parameters of some GDI stock fonts.

parent 1565def7
......@@ -4350,10 +4350,91 @@ static void test_east_asian_font_selection(void)
ReleaseDC(NULL, hdc);
}
static int get_font_dpi(const LOGFONT *lf)
{
HDC hdc = CreateCompatibleDC(0);
HFONT hfont;
TEXTMETRIC tm;
int ret;
hfont = CreateFontIndirect(lf);
ok(hfont != 0, "CreateFontIndirect failed\n");
SelectObject(hdc, hfont);
ret = GetTextMetrics(hdc, &tm);
ok(ret, "GetTextMetrics failed\n");
ret = tm.tmDigitizedAspectX;
DeleteDC(hdc);
DeleteObject(hfont);
return ret;
}
static void test_stock_fonts(void)
{
static const struct test_data
{
int id, weight, height, dpi;
const char face_name[LF_FACESIZE];
} td[] =
{
{ ANSI_FIXED_FONT, FW_NORMAL, 12, 96, "Courier" },
{ ANSI_FIXED_FONT, FW_NORMAL, 12, 120, "Courier" },
{ ANSI_VAR_FONT, FW_NORMAL, 12, 96, "MS Sans Serif" },
{ ANSI_VAR_FONT, FW_NORMAL, 12, 120, "MS Sans Serif" },
{ SYSTEM_FONT, FW_BOLD, 16, 96, "System" },
{ SYSTEM_FONT, FW_BOLD, 20, 120, "System" },
{ DEVICE_DEFAULT_FONT, FW_BOLD, 16, 96, "System" },
{ DEVICE_DEFAULT_FONT, FW_BOLD, 20, 120, "System" },
{ DEFAULT_GUI_FONT, FW_NORMAL, -11, 96, "MS Shell Dlg" },
{ DEFAULT_GUI_FONT, FW_NORMAL, -13, 120, "MS Shell Dlg" }
/*{ SYSTEM_FIXED_FONT, FW_NORMAL, 15, 96, "Fixedsys" },*/
/*{ SYSTEM_FIXED_FONT, FW_NORMAL, 20, 120, "Fixedsys" },*/
/*{ OEM_FIXED_FONT, FW_NORMAL, 16, 96, "Terminal" },*/
/*{ OEM_FIXED_FONT, FW_NORMAL, 20, 120, "Terminal" },*/
};
int i;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
HFONT hfont;
LOGFONT lf;
int ret;
hfont = GetStockObject(td[i].id);
ok(hfont != 0, "%d: GetStockObject(%d) failed\n", i, td[i].id);
ret = GetObject(hfont, sizeof(lf), &lf);
if (ret != sizeof(lf))
{
/* NT4 */
win_skip("%d: GetObject returned %d instead of sizeof(LOGFONT)\n", i, ret);
continue;
}
ret = get_font_dpi(&lf);
if (ret != td[i].dpi)
{
trace("%d: font %s %d dpi doesn't match test data %d\n", i, lf.lfFaceName, ret, td[i].dpi);
continue;
}
ok(td[i].weight == lf.lfWeight, "%d: expected lfWeight %d, got %d\n", i, td[i].weight, lf.lfWeight);
if (td[i].height < 0) /* FIXME: remove once Wine is fixed */
todo_wine ok(td[i].height == lf.lfHeight, "%d: expected lfHeight %d, got %d\n", i, td[i].height, lf.lfHeight);
else
ok(td[i].height == lf.lfHeight, "%d: expected lfHeight %d, got %d\n", i, td[i].height, lf.lfHeight);
ok(!lstrcmp(td[i].face_name, lf.lfFaceName), "%d: expected lfFaceName %s, got %s\n", i, td[i].face_name, lf.lfFaceName);
}
}
START_TEST(font)
{
init();
test_stock_fonts();
test_logfont();
test_bitmap_font();
test_outline_font();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment