ReactOS 0.4.17-dev-482-g1b46029
GetGlyphOutline.c File Reference
#include "precomp.h"
#include "undocgdi.h"
Include dependency graph for GetGlyphOutline.c:

Go to the source code of this file.

Classes

struct  TEST_ENTRY
 

Macros

#define WCH0   0
 
#define WCH1   0xFFFF
 
#define WCH2   L'A'
 
#define WCH3   L'T'
 
#define WCH4   L'g'
 
#define WCH5   L'.'
 

Typedefs

typedef struct TEST_ENTRY TEST_ENTRY
 
typedef DWORD(WINAPIFN_GetGlyphOutlineWow) (HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2 *)
 

Functions

static void DoEntryW (HDC hDC, const TEST_ENTRY *pEntry)
 
static void TEST_GetGlyphOutlineW (HDC hDC)
 
static void TEST_GetGlyphOutlineA (HDC hDC)
 
static void TEST_GetGlyphOutlineWow (HDC hDC)
 
 START_TEST (GetGlyphOutline)
 

Variables

static const MAT2 s_mat = { {0,1}, {0,0}, {0,0}, {0,1} }
 
static BYTE s_ab [512]
 
static const TEST_ENTRY s_entries []
 

Macro Definition Documentation

◆ WCH0

#define WCH0   0

Definition at line 30 of file GetGlyphOutline.c.

◆ WCH1

#define WCH1   0xFFFF

Definition at line 31 of file GetGlyphOutline.c.

◆ WCH2

#define WCH2   L'A'

Definition at line 32 of file GetGlyphOutline.c.

◆ WCH3

#define WCH3   L'T'

Definition at line 33 of file GetGlyphOutline.c.

◆ WCH4

#define WCH4   L'g'

Definition at line 34 of file GetGlyphOutline.c.

◆ WCH5

#define WCH5   L'.'

Definition at line 35 of file GetGlyphOutline.c.

Typedef Documentation

◆ FN_GetGlyphOutlineWow

typedef DWORD(WINAPI * FN_GetGlyphOutlineWow) (HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2 *)

Definition at line 403 of file GetGlyphOutline.c.

◆ TEST_ENTRY

Function Documentation

◆ DoEntryW()

static void DoEntryW ( HDC  hDC,
const TEST_ENTRY pEntry 
)
static

Definition at line 302 of file GetGlyphOutline.c.

303{
304 LOGFONTW lf;
305 HFONT hFont;
306 HGDIOBJ hFontOld;
307
308 ZeroMemory(&lf, sizeof(lf));
309
310 lf.lfHeight = pEntry->lfHeight;
312 lstrcpyW(lf.lfFaceName, pEntry->lfFaceName);
313
315 ok(hFont != NULL, "hFont was NULL\n");
316 if (hFont == NULL)
317 {
318 skip("Line %d: skipped because hFont == NULL\n", pEntry->line);
319 return;
320 }
321
322 hFontOld = SelectObject(hDC, hFont);
323 ok(hFontOld != NULL, "SelectObject failed\n");
324 if (hFontOld == NULL)
325 {
326 skip("Line %d: skipped because SelectObject failed\n", pEntry->line);
327 }
328 else
329 {
330 DWORD dwRet, dwError;
331 GLYPHMETRICS gm;
332
333 SetLastError(0xDEADBEEF);
334
335 if (pEntry->bMetrics)
336 {
337 FillMemory(&gm, sizeof(gm), 0xCD);
338 dwRet = GetGlyphOutlineW(hDC, pEntry->wch, pEntry->uFormat, &gm, pEntry->cbBuffer, pEntry->lpvBuffer, &s_mat);
339 }
340 else
341 {
342 dwRet = GetGlyphOutlineW(hDC, pEntry->wch, pEntry->uFormat, NULL, pEntry->cbBuffer, pEntry->lpvBuffer, &s_mat);
343 }
344 dwError = GetLastError();
345
346 ok(dwRet == pEntry->dwRet, "Line %d: dwRet expected 0x%lX, was 0x%lX\n", pEntry->line, pEntry->dwRet, dwRet);
347 ok(dwError == pEntry->dwError, "Line %d: dwError expected 0x%lX, was 0x%lX\n", pEntry->line, pEntry->dwError, dwError);
348
349 if (pEntry->bMetrics)
350 {
351 ok(gm.gmBlackBoxX == pEntry->gm.gmBlackBoxX, "Line %d: gm.gmBlackBoxX expected 0x%X, was 0x%X\n", pEntry->line, pEntry->gm.gmBlackBoxX, gm.gmBlackBoxX);
352 ok(gm.gmBlackBoxY == pEntry->gm.gmBlackBoxY, "Line %d: gm.gmBlackBoxY expected 0x%X, was 0x%X\n", pEntry->line, pEntry->gm.gmBlackBoxY, gm.gmBlackBoxY);
353 ok(gm.gmptGlyphOrigin.x == pEntry->gm.gmptGlyphOrigin.x, "Line %d: gm.gmptGlyphOrigin.x expected %ld, was %ld\n", pEntry->line, pEntry->gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.x);
354 ok(gm.gmptGlyphOrigin.y == pEntry->gm.gmptGlyphOrigin.y, "Line %d: gm.gmptGlyphOrigin.y expected %ld, was %ld\n", pEntry->line, pEntry->gm.gmptGlyphOrigin.y, gm.gmptGlyphOrigin.y);
355 ok(gm.gmCellIncX == pEntry->gm.gmCellIncX, "Line %d: gm.gmCellIncX expected %d, was %d\n", pEntry->line, pEntry->gm.gmCellIncX, gm.gmCellIncX);
356 ok(gm.gmCellIncY == pEntry->gm.gmCellIncY, "Line %d: gm.gmCellIncY expected %d, was %d\n", pEntry->line, pEntry->gm.gmCellIncY, gm.gmCellIncY);
357 }
358 SelectObject(hDC, hFontOld);
359 }
360
362}
static HDC hDC
Definition: 3dtext.c:33
static const MAT2 s_mat
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
HFONT hFont
Definition: main.c:53
#define NULL
Definition: types.h:112
#define SetLastError(x)
Definition: compat.h:752
#define lstrcpyW
Definition: compat.h:749
#define FillMemory(BUF, SIZ, MASK)
Definition: strucsup.c:31
unsigned long DWORD
Definition: ntddk_ex.h:95
PLIST_ENTRY pEntry
Definition: fxioqueue.cpp:4484
pKey DeleteObject()
#define ZeroMemory
Definition: minwinbase.h:31
LONG lfHeight
Definition: dimm.idl:59
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
BYTE lfCharSet
Definition: dimm.idl:67
short gmCellIncX
Definition: wingdi.h:2891
UINT gmBlackBoxY
Definition: wingdi.h:2889
UINT gmBlackBoxX
Definition: wingdi.h:2888
short gmCellIncY
Definition: wingdi.h:2892
POINT gmptGlyphOrigin
Definition: wingdi.h:2890
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DEFAULT_CHARSET
Definition: wingdi.h:384
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
DWORD WINAPI GetGlyphOutlineW(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)

Referenced by TEST_GetGlyphOutlineW().

◆ START_TEST()

START_TEST ( GetGlyphOutline  )

Definition at line 444 of file GetGlyphOutline.c.

445{
450 DeleteDC(hDC);
451}
static void TEST_GetGlyphOutlineW(HDC hDC)
static void TEST_GetGlyphOutlineA(HDC hDC)
static void TEST_GetGlyphOutlineWow(HDC hDC)
static HDC
Definition: imagelist.c:88
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)

◆ TEST_GetGlyphOutlineA()

static void TEST_GetGlyphOutlineA ( HDC  hDC)
static

Definition at line 373 of file GetGlyphOutline.c.

374{
375 LOGFONTW lf;
376 ZeroMemory(&lf, sizeof(lf));
377 lf.lfHeight = 100;
379 lstrcpynW(lf.lfFaceName, L"Arial", _countof(lf.lfFaceName));
380 HFONT hFont = CreateFontIndirectW(&lf);
381 ok(hFont != NULL, "hFont was NULL\n");
382
383 HGDIOBJ hFontOld = SelectObject(hDC, hFont);
384
385 GLYPHMETRICS gm;
386 ZeroMemory(&gm, sizeof(gm));
387
388 DWORD ret;
389
390 ret = GetGlyphOutlineA(hDC, 'A', GGO_NATIVE, &gm, 0, NULL, &s_mat);
391 ok(ret != GDI_ERROR && ret != 0, "ret was 0x%lX\n", ret);
392
393 ret = GetGlyphOutlineA(hDC, 'A', GGO_BITMAP, &gm, 0, NULL, &s_mat);
394 ok(ret != GDI_ERROR && ret != 0, "ret was 0x%lX\n", ret);
395
396 ret = GetGlyphOutlineA(hDC, 'A', GGO_METRICS, &gm, 0, NULL, &s_mat);
397 ok(ret != GDI_ERROR, "ret was 0x%lX\n", ret);
398
399 SelectObject(hDC, hFontOld);
401}
#define lstrcpynW
Definition: compat.h:738
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define _countof(array)
Definition: sndvol32.h:70
#define GDI_ERROR
Definition: wingdi.h:1309
#define GGO_BITMAP
Definition: wingdi.h:849
#define GGO_NATIVE
Definition: wingdi.h:850
#define GGO_METRICS
Definition: wingdi.h:848
DWORD WINAPI GetGlyphOutlineA(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)

Referenced by START_TEST().

◆ TEST_GetGlyphOutlineW()

static void TEST_GetGlyphOutlineW ( HDC  hDC)
static

Definition at line 364 of file GetGlyphOutline.c.

365{
367 for (i = 0; i < count; ++i)
368 {
370 }
371}
static const TEST_ENTRY s_entries[]
static void DoEntryW(HDC hDC, const TEST_ENTRY *pEntry)
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG_PTR SIZE_T
Definition: typedefs.h:80

Referenced by START_TEST().

◆ TEST_GetGlyphOutlineWow()

static void TEST_GetGlyphOutlineWow ( HDC  hDC)
static

Definition at line 405 of file GetGlyphOutline.c.

406{
407 HINSTANCE hGDI32 = GetModuleHandleA("gdi32");
408 FN_GetGlyphOutlineWow fnGetGlyphOutlineWow =
409 (FN_GetGlyphOutlineWow)GetProcAddress(hGDI32, "GetGlyphOutlineWow");
410 if (!fnGetGlyphOutlineWow)
411 {
412 skip("GetGlyphOutlineWow not found\n");
413 return;
414 }
415
416 LOGFONTW lf;
417 ZeroMemory(&lf, sizeof(lf));
418 lf.lfHeight = 100;
420 lstrcpynW(lf.lfFaceName, L"Arial", _countof(lf.lfFaceName));
421 HFONT hFont = CreateFontIndirectW(&lf);
422 ok(hFont != NULL, "hFont was NULL\n");
423
424 HGDIOBJ hFontOld = SelectObject(hDC, hFont);
425
426 GLYPHMETRICS gm;
427 ZeroMemory(&gm, sizeof(gm));
428
429 DWORD ret;
430
431 ret = fnGetGlyphOutlineWow(hDC, 'A', GGO_NATIVE, &gm, 0, NULL, &s_mat);
432 ok(ret != GDI_ERROR && ret != 0, "ret was 0x%lX\n", ret);
433
434 ret = fnGetGlyphOutlineWow(hDC, 'A', GGO_BITMAP, &gm, 0, NULL, &s_mat);
435 ok(ret != GDI_ERROR && ret != 0, "ret was 0x%lX\n", ret);
436
437 ret = fnGetGlyphOutlineWow(hDC, 'A', GGO_METRICS, &gm, 0, NULL, &s_mat);
438 ok(ret != GDI_ERROR, "ret was 0x%lX\n", ret);
439
440 SelectObject(hDC, hFontOld);
442}
DWORD(WINAPI * FN_GetGlyphOutlineWow)(HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2 *)
#define GetProcAddress(x, y)
Definition: compat.h:753
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812

Referenced by START_TEST().

Variable Documentation

◆ s_ab

BYTE s_ab[512]
static

Definition at line 28 of file GetGlyphOutline.c.

◆ s_entries

const TEST_ENTRY s_entries[]
static

Definition at line 37 of file GetGlyphOutline.c.

Referenced by TEST_GetGlyphOutlineW().

◆ s_mat

const MAT2 s_mat = { {0,1}, {0,0}, {0,0}, {0,1} }
static

Definition at line 26 of file GetGlyphOutline.c.

Referenced by DoEntryW(), TEST_GetGlyphOutlineA(), and TEST_GetGlyphOutlineWow().