[APITESTS][WIN32KNT_APITEST] Improve NtGdiExtTextOutW testcase (#1286)
[reactos.git] / modules / rostests / apitests / win32nt / ntgdi / NtGdiExtTextOutW.c
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 /*
11 BOOL
12 APIENTRY
13 NtGdiExtTextOutW(
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
25 START_TEST(NtGdiExtTextOutW)
26 {
27 HINSTANCE hinst = GetModuleHandle(NULL);
28 HWND hWnd;
29 HDC hDC;
30 RECT rect;
31 LPWSTR lpstr;
32 BOOL ret;
33 ULONG len;
34 INT Dx[10] = {10, -5, 10, 5, 10, -10, 10, 5, 10, 5};
35
36 /* Create a window */
37 hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
38 CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
39 NULL, NULL, hinst, 0);
40 hDC = GetDC(hWnd);
41
42 lpstr = L"Hallo";
43 len = wcslen(lpstr);
44
45 ret = NtGdiExtTextOutW(hDC, 0, 0, 0, &rect, lpstr, len, Dx, 0);
46 ok_int(ret, 1);
47
48 ret = NtGdiExtTextOutW(hDC, 0, 0, ETO_PDY, &rect, lpstr, len, Dx, 0);
49 ok_int(ret, 1);
50
51 /* Test invalid lpDx */
52 ret = NtGdiExtTextOutW(hDC, 0, 0, 0, 0, lpstr, len, (INT*)((ULONG_PTR)-1), 0);
53 ok_int(ret, 0);
54
55 /* Test alignment requirement for lpDx */
56 ret = NtGdiExtTextOutW(hDC, 0, 0, 0, 0, lpstr, len, (INT*)((ULONG_PTR)Dx + 1), 0);
57 ok_int(ret, 1);
58 }