ReactOS
0.4.15-dev-8636-g945e856
NtGdiSelectFont.c
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS api tests
3
* LICENSE: GPL - See COPYING in the top level directory
4
* PURPOSE: Test for NtGdiSelectFont
5
* PROGRAMMERS:
6
*/
7
8
#include "../win32nt.h"
9
10
START_TEST
(
NtGdiSelectFont
)
11
{
12
HDC
hDC
;
13
HFONT
hFont
, hOldFont;
14
15
hDC
=
CreateDCW
(
L
"DISPLAY"
,
NULL
,
NULL
,
NULL
);
16
17
hFont
=
GetStockObject
(
DEFAULT_GUI_FONT
);
18
19
/* Test NULL DC */
20
SetLastError
(
ERROR_SUCCESS
);
21
hOldFont =
NtGdiSelectFont
(
NULL
,
hFont
);
22
TEST
(hOldFont ==
NULL
);
23
TEST
(
GetLastError
() ==
ERROR_SUCCESS
);
24
25
/* Test invalid DC */
26
SetLastError
(
ERROR_SUCCESS
);
27
hOldFont =
NtGdiSelectFont
((
HDC
)((
ULONG_PTR
)
hDC
& 0x0000ffff),
hFont
);
28
TEST
(hOldFont ==
NULL
);
29
TEST
(
GetLastError
() ==
ERROR_SUCCESS
);
30
31
/* Test NULL font */
32
SetLastError
(
ERROR_SUCCESS
);
33
hOldFont =
NtGdiSelectFont
(
hDC
,
NULL
);
34
TEST
(hOldFont ==
NULL
);
35
TEST
(
GetLastError
() ==
ERROR_SUCCESS
);
36
37
/* Test invalid font */
38
SetLastError
(
ERROR_SUCCESS
);
39
hOldFont =
NtGdiSelectFont
(
hDC
, (
HFONT
)((
ULONG_PTR
)
hFont
& 0x0000ffff));
40
TEST
(hOldFont ==
NULL
);
41
TEST
(
GetLastError
() ==
ERROR_SUCCESS
);
42
43
SetLastError
(
ERROR_SUCCESS
);
44
hOldFont =
NtGdiSelectFont
(
hDC
,
hFont
);
45
TEST
(hOldFont !=
NULL
);
46
hOldFont =
NtGdiSelectFont
(
hDC
, hOldFont);
47
TEST
(hOldFont ==
hFont
);
48
TEST
(
GetLastError
() ==
ERROR_SUCCESS
);
49
50
51
DeleteDC
(
hDC
);
52
}
53
hDC
static HDC hDC
Definition:
3dtext.c:33
START_TEST
#define START_TEST(x)
Definition:
atltest.h:75
hFont
HFONT hFont
Definition:
main.c:53
ERROR_SUCCESS
#define ERROR_SUCCESS
Definition:
deptool.c:10
NULL
#define NULL
Definition:
types.h:112
SetLastError
#define SetLastError(x)
Definition:
compat.h:752
TEST
#define TEST(x)
Definition:
precomp.h:20
HDC
static HDC
Definition:
imagelist.c:88
HFONT
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
NtGdiSelectFont
__kernel_entry W32KAPI HFONT APIENTRY NtGdiSelectFont(_In_ HDC hdc, _In_ HFONT hf)
Definition:
dcobjs.c:597
L
#define L(x)
Definition:
ntvdm.h:50
ULONG_PTR
uint32_t ULONG_PTR
Definition:
typedefs.h:65
GetLastError
DWORD WINAPI GetLastError(void)
Definition:
except.c:1042
GetStockObject
HGDIOBJ WINAPI GetStockObject(_In_ int)
DEFAULT_GUI_FONT
#define DEFAULT_GUI_FONT
Definition:
wingdi.h:909
DeleteDC
BOOL WINAPI DeleteDC(_In_ HDC)
CreateDCW
HDC WINAPI CreateDCW(_In_opt_ LPCWSTR pszDriver, _In_opt_ LPCWSTR pszDevice, _In_opt_ LPCWSTR psz, _In_opt_ const DEVMODEW *pdmInit)
modules
rostests
apitests
win32nt
ntgdi
NtGdiSelectFont.c
Generated on Tue Sep 10 2024 06:07:53 for ReactOS by
1.9.6