gdi32/tests: Prevent a crash if the shell dlg font is not found.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2017-04-05 09:35:07 +01:00 committed by Alexandre Julliard
parent d687fc8f34
commit 8dc039a7d1

View file

@ -5305,10 +5305,13 @@ static void test_EnumFonts_subst(void)
ret = EnumFontFamiliesExA(hdc, &lf, enum_ms_shell_dlg_proc, (LPARAM)&efnd, 0);
ok(!ret, "MS Shell Dlg should be enumerated\n");
ok(efnd.total > 0, "MS Shell Dlg should be enumerated\n");
ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg");
ok(!ret, "expected MS Shell Dlg, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg");
ok(ret, "did not expect MS Shell Dlg\n");
if (efnd.total)
{
ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg");
ok(!ret, "expected MS Shell Dlg, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg");
ok(ret, "did not expect MS Shell Dlg\n");
}
efnd.total = 0;
ret = EnumFontFamiliesExA(hdc, NULL, enum_ms_shell_dlg2_proc, (LPARAM)&efnd, 0);
@ -5320,10 +5323,13 @@ static void test_EnumFonts_subst(void)
ret = EnumFontFamiliesExA(hdc, &lf, enum_ms_shell_dlg2_proc, (LPARAM)&efnd, 0);
ok(!ret, "MS Shell Dlg 2 should be enumerated\n");
ok(efnd.total > 0, "MS Shell Dlg 2 should be enumerated\n");
ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg 2");
ok(!ret, "expected MS Shell Dlg 2, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg 2");
ok(ret, "did not expect MS Shell Dlg 2\n");
if (efnd.total)
{
ret = strcmp((const char *)efnd.elf[0].elfLogFont.lfFaceName, "MS Shell Dlg 2");
ok(!ret, "expected MS Shell Dlg 2, got %s\n", efnd.elf[0].elfLogFont.lfFaceName);
ret = strcmp((const char *)efnd.elf[0].elfFullName, "MS Shell Dlg 2");
ok(ret, "did not expect MS Shell Dlg 2\n");
}
heap_free(efnd.elf);
DeleteDC(hdc);