Module: wine Branch: master Commit: 5c2976eebc93a67e07b3a431d6bcc27a388e617a URL: http://source.winehq.org/git/wine.git/?a=commit;h=5c2976eebc93a67e07b3a431d6... Author: Grazvydas Ignotas <notasas(a)gmail.com> Date: Tue Aug 23 23:11:58 2011 +0300 gdi32/tests: Check for exact fonts before doing fullname test. --- dlls/gdi32/tests/font.c | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 insertions(+), 7 deletions(-) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index aab371f..fcb0776 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -3733,6 +3733,28 @@ static void test_EnumFonts(void) DeleteDC(hdc); } +static INT CALLBACK is_font_installed_fullname_proc(const LOGFONT *lf, const TEXTMETRIC *ntm, DWORD type, LPARAM lParam) +{ + const ENUMLOGFONT *elf = (const ENUMLOGFONT *)lf; + const char *fullname = (const char *)lParam; + + if (!strcmp((const char *)elf->elfFullName, fullname)) return 0; + + return 1; +} + +static BOOL is_font_installed_fullname(const char *family, const char *fullname) +{ + HDC hdc = GetDC(0); + BOOL ret = FALSE; + + if(!EnumFontFamiliesA(hdc, family, is_font_installed_fullname_proc, (LPARAM)fullname)) + ret = TRUE; + + ReleaseDC(0, hdc); + return ret; +} + static void test_fullname(void) { static const char *TestName[] = {"Lucida Sans Demibold Roman", "Lucida Sans Italic"}; @@ -3742,13 +3764,6 @@ static void test_fullname(void) HDC hdc; int i; - /* Lucida Sans comes with XP SP2 or later */ - if (!is_truetype_font_installed("Lucida Sans")) - { - skip("Lucida Sans is not installed\n"); - return; - } - hdc = CreateCompatibleDC(0); ok(hdc != NULL, "CreateCompatibleDC failed\n"); @@ -3763,6 +3778,12 @@ static void test_fullname(void) for (i = 0; i < sizeof(TestName) / sizeof(TestName[0]); i++) { + if (!is_font_installed_fullname("Lucida Sans", TestName[i])) + { + skip("%s is not installed\n", TestName[i]); + continue; + } + lstrcpyA(lf.lfFaceName, TestName[i]); hfont = CreateFontIndirectA(&lf); ok(hfont != 0, "CreateFontIndirectA failed\n");