ReactOS 0.4.16-dev-2104-gb84fa49
NtGdiExtTextOutW.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 NtGdiExtTextOutW
5 * PROGRAMMERS:
6 */
7
8#include "../win32nt.h"
9
10/*
11BOOL
12APIENTRY
13NtGdiExtTextOutW(
14 IN HDC hDC,
15 IN INT XStart,
16 IN INT YStart,
17 IN UINT fuOptions,
18 IN OPTIONAL LPRECT UnsafeRect,
19 IN LPWSTR UnsafeString,
20 IN INT Count,
21 IN OPTIONAL LPINT UnsafeDx,
22 IN DWORD dwCodePage)
23*/
24
26{
27 static const LPWSTR lpstr = L"Hallo";
29 RECT rect = { 0, 0, 100, 100 };
30 INT Dx[10] = {10, -5, 10, 5, 10, -10, 10, 5, 10, 5};
31
35
36 /* Test valid call */
37 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &rect, lpstr, len, Dx, 0), 1);
38
39 /* Test NULL hdc */
40 SetLastError(0xDEADFACE);
41 ok_int(NtGdiExtTextOutW(NULL, 0, 0, 0, &rect, lpstr, len, Dx, 0), 0);
42 ok_err(0xDEADFACE);
43
44 /* Test NULL rect */
45 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, NULL, lpstr, len, Dx, 0), 1);
46
47 /* Test with invalid rect */
48 RECT invalid_rect = { MAXLONG, MINLONG, MINLONG, MAXLONG };
49 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &invalid_rect, lpstr, len, Dx, 0), 1);
50
51 /* Test NULL lpstr with zero len */
52 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &rect, NULL, 0, Dx, 0), 1);
53
54 /* Test NULL lpstr with non-zero len */
55 SetLastError(0xDEADFACE);
56 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &rect, NULL, len, Dx, 0), 0);
57 ok_err(0xDEADFACE);
58
59 /* Test NULL pdx and NULL lpstr with zero len */
60 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &rect, NULL, 0, NULL, 0), 1);
61
62 /* Test NULL pdx and valid lpstr with zero len */
63 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &rect, lpstr, 0, NULL, 0), 1);
64
65 /* Test NULL pdx and valid lpstr with non-zero len */
66 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &rect, lpstr, len, NULL, 0), 1);
67
68 /* Test NULL pdx and ETO_PDY */
70 {
71 ok_int(NtGdiExtTextOutW(hdc, 0, 0, ETO_PDY, &rect, lpstr, len, NULL, 0), 1);
72 }
73 else
74 {
75 SetLastError(0xDEADFACE);
76 ok_int(NtGdiExtTextOutW(hdc, 0, 0, ETO_PDY, &rect, lpstr, len, NULL, 0), 0);
78 }
79
80 /* Test different flOpts */
81 SetLastError(0xDEADFACE);
82 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000001, &rect, lpstr, len, Dx, 0), 0); // ETO_GRAYED
83 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000002, &rect, lpstr, len, Dx, 0), 1); // ETO_OPAQUE
84 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000005, &rect, lpstr, len, Dx, 0), 0); // ETO_OPAQUE | ETO_GRAYED
85 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000004, &rect, lpstr, len, Dx, 0), 1); // ETO_CLIPPED
86 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000008, &rect, lpstr, len, Dx, 0), 0);
87 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000010, &rect, lpstr, len, Dx, 0), 1); // ETO_GLYPH_INDEX
88 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000020, &rect, lpstr, len, Dx, 0), 0);
89 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000040, &rect, lpstr, len, Dx, 0), 0);
90 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000080, &rect, lpstr, len, Dx, 0), 1); // ETO_RTLREADING
91 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000100, &rect, lpstr, len, Dx, 0), 0);
92 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000200, &rect, lpstr, len, Dx, 0), 0);
93 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000400, &rect, lpstr, len, Dx, 0), 1); // ETO_NUMERICSLOCAL
94 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00000800, &rect, lpstr, len, Dx, 0), 1); // ETO_NUMERICSLATIN
95 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00001000, &rect, lpstr, len, Dx, 0), 1); // ETO_IGNORELANGUAGE
96 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00002000, &rect, lpstr, len, Dx, 0), 1); // ETO_PDY
97 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00004000, &rect, lpstr, len, Dx, 0), 0);
98 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00008000, &rect, lpstr, len, Dx, 0), 0);
99 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00010000, &rect, lpstr, len, Dx, 0), 0); // ETO_REVERSE_INDEX_MAP
100 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0x00020000, &rect, lpstr, len, Dx, 0), 0);
101 ok_err(0xDEADFACE);
102
103 /* Test invalid lpDx */
104 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, 0, lpstr, len, (INT*)((ULONG_PTR)-1), 0), 0);
105
106 /* Test alignment requirement for lpDx */
107 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, 0, lpstr, len, (INT*)((ULONG_PTR)Dx + 1), 0),
108 (GetNTVersion() >= _WIN32_WINNT_WIN10) ? 1 : 0);
109
110 /* Test invalid codepage */
111 ok_int(NtGdiExtTextOutW(hdc, 0, 0, 0, &rect, lpstr, len, Dx, 0xDEADCAFE), 1);
112
113 DeleteDC(hdc);
115}
#define GetNTVersion()
Definition: apitest.h:17
#define ok_err(error)
Definition: atltest.h:124
#define START_TEST(x)
Definition: atltest.h:75
#define ok_int(expression, result)
Definition: atltest.h:134
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define lstrlenW
Definition: compat.h:750
#define L(x)
Definition: resources.c:13
pKey DeleteObject()
GLenum GLsizei len
Definition: glext.h:6722
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
static LPCSTR lpstr
Definition: font.c:51
_In_ HBITMAP hbm
Definition: ntgdi.h:2776
__kernel_entry W32KAPI BOOL APIENTRY NtGdiExtTextOutW(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT flOpts, _In_opt_ LPCRECT prcl, _In_reads_opt_(cwc) PCWCH pwsz, _In_range_(0, 0xffff) UINT cwc, _In_reads_opt_(_Inexpressible_(cwc)) const INT *pdx, _In_ DWORD dwCodePage)
#define _WIN32_WINNT_WIN10
Definition: sdkddkver.h:32
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
& rect
Definition: startmenu.cpp:1413
Definition: windef.h:99
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
#define MAXLONG
Definition: umtypes.h:116
#define MINLONG
Definition: umtypes.h:115
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define ETO_PDY
Definition: wingdi.h:657
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL WINAPI DeleteDC(_In_ HDC)
WCHAR * LPWSTR
Definition: xmlstorage.h:184