mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[GDI32_APITEST]
- Add a test for EnumFontFamilies* returning no results CORE-8628 svn path=/trunk/; revision=64719
This commit is contained in:
parent
d3d5f95600
commit
00109ad544
3 changed files with 178 additions and 0 deletions
|
@ -22,6 +22,7 @@ list(APPEND SOURCE
|
|||
EngCreateSemaphore.c
|
||||
EngDeleteSemaphore.c
|
||||
EngReleaseSemaphore.c
|
||||
EnumFontFamilies.c
|
||||
ExcludeClipRect.c
|
||||
ExtCreatePen.c
|
||||
GdiConvertBitmap.c
|
||||
|
|
175
rostests/apitests/gdi32/EnumFontFamilies.c
Normal file
175
rostests/apitests/gdi32/EnumFontFamilies.c
Normal file
|
@ -0,0 +1,175 @@
|
|||
/*
|
||||
* PROJECT: ReactOS API tests
|
||||
* LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
|
||||
* PURPOSE: Test for EnumFontFamilies[Ex]
|
||||
* PROGRAMMERS: Thomas Faber <thomas.faber@reactos.org>
|
||||
*/
|
||||
|
||||
#include <apitest.h>
|
||||
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
static BYTE ContextContinue;
|
||||
static BYTE ContextStop;
|
||||
|
||||
static int EnumProcCalls;
|
||||
static ENUMLOGFONTA LastFontA;
|
||||
static ENUMLOGFONTW LastFontW;
|
||||
|
||||
static
|
||||
int
|
||||
CALLBACK
|
||||
EnumProcA(
|
||||
_In_ const LOGFONTA *elf,
|
||||
_In_ const TEXTMETRICA *ntm,
|
||||
_In_ DWORD FontType,
|
||||
_In_ LPARAM lParam)
|
||||
{
|
||||
EnumProcCalls++;
|
||||
|
||||
ok(lParam == (LPARAM)&ContextContinue ||
|
||||
lParam == (LPARAM)&ContextStop,
|
||||
"Context is %p, expected %p or %p\n",
|
||||
(PVOID)lParam, &ContextContinue, &ContextStop);
|
||||
|
||||
LastFontA = *(ENUMLOGFONTA *)elf;
|
||||
return lParam == (LPARAM)&ContextContinue ? 7 : 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
CALLBACK
|
||||
EnumProcW(
|
||||
_In_ const LOGFONTW *elf,
|
||||
_In_ const TEXTMETRICW *ntm,
|
||||
_In_ DWORD FontType,
|
||||
_In_ LPARAM lParam)
|
||||
{
|
||||
EnumProcCalls++;
|
||||
|
||||
ok(lParam == (LPARAM)&ContextContinue ||
|
||||
lParam == (LPARAM)&ContextStop,
|
||||
"Context is %p, expected %p or %p\n",
|
||||
(PVOID)lParam, &ContextContinue, &ContextStop);
|
||||
|
||||
LastFontW = *(ENUMLOGFONTW *)elf;
|
||||
return lParam == (LPARAM)&ContextContinue ? 7 : 0;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
TestEnumFontFamiliesA(
|
||||
_In_ HDC hdc,
|
||||
_In_ PCSTR FontName)
|
||||
{
|
||||
int ret;
|
||||
DWORD error;
|
||||
|
||||
EnumProcCalls = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumFontFamiliesA(hdc,
|
||||
FontName,
|
||||
EnumProcA,
|
||||
(LPARAM)&ContextContinue);
|
||||
error = GetLastError();
|
||||
ok(ret == 1, "ret is %d, expected 0\n", ret);
|
||||
ok(error == 0xdeadbeef, "error is %lu\n", error);
|
||||
ok(EnumProcCalls == 0, "EnumProcCalls is %d\n", EnumProcCalls);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
TestEnumFontFamiliesW(
|
||||
_In_ HDC hdc,
|
||||
_In_ PCWSTR FontName)
|
||||
{
|
||||
int ret;
|
||||
DWORD error;
|
||||
|
||||
EnumProcCalls = 0;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumFontFamiliesW(hdc,
|
||||
FontName,
|
||||
EnumProcW,
|
||||
(LPARAM)&ContextContinue);
|
||||
error = GetLastError();
|
||||
ok(ret == 1, "ret is %d, expected 0\n", ret);
|
||||
ok(error == 0xdeadbeef, "error is %lu\n", error);
|
||||
ok(EnumProcCalls == 0, "EnumProcCalls is %d\n", EnumProcCalls);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
TestEnumFontFamiliesExA(
|
||||
_In_ HDC hdc,
|
||||
_In_ PCSTR FontName)
|
||||
{
|
||||
int ret;
|
||||
DWORD error;
|
||||
LOGFONTA lf;
|
||||
|
||||
EnumProcCalls = 0;
|
||||
ZeroMemory(&lf, sizeof(lf));
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lf.lfPitchAndFamily = 0;
|
||||
StringCbCopyA(lf.lfFaceName, sizeof(lf.lfFaceName), FontName);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumFontFamiliesExA(hdc,
|
||||
&lf,
|
||||
EnumProcA,
|
||||
(LPARAM)&ContextContinue,
|
||||
0);
|
||||
error = GetLastError();
|
||||
ok(ret == 1, "ret is %d, expected 0\n", ret);
|
||||
ok(error == 0xdeadbeef, "error is %lu\n", error);
|
||||
ok(EnumProcCalls == 0, "EnumProcCalls is %d\n", EnumProcCalls);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
TestEnumFontFamiliesExW(
|
||||
_In_ HDC hdc,
|
||||
_In_ PCWSTR FontName)
|
||||
{
|
||||
int ret;
|
||||
DWORD error;
|
||||
LOGFONTW lf;
|
||||
|
||||
EnumProcCalls = 0;
|
||||
ZeroMemory(&lf, sizeof(lf));
|
||||
lf.lfCharSet = DEFAULT_CHARSET;
|
||||
lf.lfPitchAndFamily = 0;
|
||||
StringCbCopyW(lf.lfFaceName, sizeof(lf.lfFaceName), FontName);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumFontFamiliesExW(hdc,
|
||||
&lf,
|
||||
EnumProcW,
|
||||
(LPARAM)&ContextContinue,
|
||||
0);
|
||||
error = GetLastError();
|
||||
ok(ret == 1, "ret is %d, expected 0\n", ret);
|
||||
ok(error == 0xdeadbeef, "error is %lu\n", error);
|
||||
ok(EnumProcCalls == 0, "EnumProcCalls is %d\n", EnumProcCalls);
|
||||
}
|
||||
|
||||
START_TEST(EnumFontFamilies)
|
||||
{
|
||||
HDC hdc;
|
||||
|
||||
hdc = CreateCompatibleDC(NULL);
|
||||
if (!hdc)
|
||||
{
|
||||
skip("No DC\n");
|
||||
return;
|
||||
}
|
||||
|
||||
TestEnumFontFamiliesA(hdc, "ThisFontDoesNotExist");
|
||||
TestEnumFontFamiliesW(hdc, L"ThisFontDoesNotExist");
|
||||
TestEnumFontFamiliesExA(hdc, "ThisFontDoesNotExist");
|
||||
TestEnumFontFamiliesExW(hdc, L"ThisFontDoesNotExist");
|
||||
|
||||
DeleteDC(hdc);
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ extern void func_EngAcquireSemaphore(void);
|
|||
extern void func_EngCreateSemaphore(void);
|
||||
extern void func_EngDeleteSemaphore(void);
|
||||
extern void func_EngReleaseSemaphore(void);
|
||||
extern void func_EnumFontFamilies(void);
|
||||
extern void func_ExcludeClipRect(void);
|
||||
extern void func_ExtCreatePen(void);
|
||||
extern void func_GdiConvertBitmap(void);
|
||||
|
@ -85,6 +86,7 @@ const struct test winetest_testlist[] =
|
|||
{ "EngCreateSemaphore", func_EngCreateSemaphore },
|
||||
{ "EngDeleteSemaphore", func_EngDeleteSemaphore },
|
||||
{ "EngReleaseSemaphore", func_EngReleaseSemaphore },
|
||||
{ "EnumFontFamilies", func_EnumFontFamilies },
|
||||
{ "ExcludeClipRect", func_ExcludeClipRect },
|
||||
{ "ExtCreatePen", func_ExtCreatePen },
|
||||
{ "GdiConvertBitmap", func_GdiConvertBitmap },
|
||||
|
|
Loading…
Reference in a new issue