gdi32/tests: Test substituted face family name.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2021-11-04 23:18:22 +09:00 committed by Alexandre Julliard
parent eb745fd017
commit 64c31e63b8
1 changed files with 46 additions and 0 deletions

View File

@ -7786,6 +7786,51 @@ static void test_select_object(void)
DeleteObject(hfont);
}
static void test_GetOutlineTextMetrics_subst(void)
{
OUTLINETEXTMETRICA *otm;
LOGFONTA lf;
HFONT hfont, hfont_old;
HDC hdc;
DWORD ret;
char face_name[LF_FACESIZE];
const char* family_name;
if (!is_font_installed("MS SHELL DLG"))
{
skip("MS Shell Dlg is not installed\n");
return;
}
hdc = GetDC(0);
memset(&lf, 0, sizeof(lf));
strcpy(lf.lfFaceName, "MS SHELL DLG");
lf.lfCharSet = DEFAULT_CHARSET;
hfont = CreateFontIndirectA(&lf);
ok(hfont != NULL, "failed to create a font\n");
hfont_old = SelectObject(hdc, hfont);
/* face name */
ret = GetTextFaceA(hdc, sizeof(face_name), face_name);
ok(ret, "GetTextFace failed\n");
ok(!lstrcmpiA(lf.lfFaceName, face_name), "expected %s, got %s\n", lf.lfFaceName, face_name);
ret = GetOutlineTextMetricsA(hdc, 0, NULL);
otm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ret);
ret = GetOutlineTextMetricsA(hdc, ret, otm);
ok(ret != 0, "GetOutlineTextMetrics failed\n");
/* family name */
family_name = (const char*)otm + (UINT_PTR)otm->otmpFamilyName;
todo_wine ok(lstrcmpiA(lf.lfFaceName, family_name), "expected a real family name (e.g. Tahoma), got %s\n", family_name);
HeapFree(GetProcessHeap(), 0, otm);
SelectObject(hdc, hfont_old);
DeleteObject(hfont);
ReleaseDC(0, hdc);
}
START_TEST(font)
{
static const char *test_names[] =
@ -7818,6 +7863,7 @@ START_TEST(font)
test_GetGlyphIndices();
test_GetKerningPairs();
test_GetOutlineTextMetrics();
test_GetOutlineTextMetrics_subst();
test_SetTextJustification();
test_font_charset();
test_GdiGetCodePage();