From b68593ef5c307d7f1db40b3b276da0899f8797dd Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 17 Jul 2015 17:23:08 +0800 Subject: [PATCH] user32: Add a test to show that fonts returned by SystemParametersInfo(SPI_GETNONCLIENTMETRICS) should be listed by EnumFontFamilies(hdc, NULL). --- dlls/user32/tests/sysparams.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dlls/user32/tests/sysparams.c b/dlls/user32/tests/sysparams.c index 31d1a8eef97..dabecdbe866 100644 --- a/dlls/user32/tests/sysparams.c +++ b/dlls/user32/tests/sysparams.c @@ -2650,6 +2650,23 @@ static int gsm_error_ctr; ok( !( exp1 != act && exp2 != act && exp3 != act),"GetSystemMetrics(%s): expected %d or %d or %d actual %d\n", #i, exp1, exp2, exp3, act);\ } +static INT CALLBACK enum_all_fonts_proc(const LOGFONTA *elf, const TEXTMETRICA *ntm, DWORD type, LPARAM lparam) +{ + return lstrcmpiA(elf->lfFaceName, (const char *)lparam); +} + +static BOOL is_font_enumerated(const char *name) +{ + HDC hdc = CreateCompatibleDC(0); + BOOL ret = FALSE; + + if (!EnumFontFamiliesA(hdc, NULL, enum_all_fonts_proc, (LPARAM)name)) + ret = TRUE; + + DeleteDC(hdc); + return ret; +} + static void test_GetSystemMetrics( void) { TEXTMETRICA tmMenuFont; @@ -2691,6 +2708,18 @@ static void test_GetSystemMetrics( void) win_skip("SPI_GETNONCLIENTMETRICS is not available\n"); return; } + +todo_wine + ok(is_font_enumerated(ncm.lfCaptionFont.lfFaceName), "font %s should be enumerated\n", ncm.lfCaptionFont.lfFaceName); +todo_wine + ok(is_font_enumerated(ncm.lfSmCaptionFont.lfFaceName), "font %s should be enumerated\n", ncm.lfSmCaptionFont.lfFaceName); +todo_wine + ok(is_font_enumerated(ncm.lfMenuFont.lfFaceName), "font %s should be enumerated\n", ncm.lfMenuFont.lfFaceName); +todo_wine + ok(is_font_enumerated(ncm.lfStatusFont.lfFaceName), "font %s should be enumerated\n", ncm.lfStatusFont.lfFaceName); +todo_wine + ok(is_font_enumerated(ncm.lfMessageFont.lfFaceName), "font %s should be enumerated\n", ncm.lfMessageFont.lfFaceName); + /* CaptionWidth from the registry may have different value of iCaptionWidth * from the non client metrics (observed on WinXP) */ CaptionWidthfromreg = metricfromreg(