ReactOS 0.4.15-dev-5664-g3bf4ef6
NtGdiSelectPen.c File Reference
#include <win32nt.h>
Include dependency graph for NtGdiSelectPen.c:

Go to the source code of this file.

Functions

 START_TEST (NtGdiSelectPen)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtGdiSelectPen  )

Definition at line 10 of file NtGdiSelectPen.c.

11{
12 HDC hDC;
13 HPEN hPen, hOldPen;
14 LOGBRUSH logbrush;
15
16 hDC = GetDC(NULL);
17 ASSERT(hDC);
18
20
21 /* Test NULL DC */
23 hOldPen = NtGdiSelectPen(NULL, hPen);
24 TEST(hOldPen == NULL);
26
27 /* Test invalid DC */
29 hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen);
30 TEST(hOldPen == NULL);
32
33 /* Test NULL pen */
35 hOldPen = NtGdiSelectPen(hDC, NULL);
36 TEST(hOldPen == NULL);
38
39 /* Test invalid pen */
41 hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
42 TEST(hOldPen == NULL);
44
45 /* Test valid pen */
48 hOldPen = NtGdiSelectPen(hDC, hPen);
49 TEST(hOldPen == GetStockObject(BLACK_PEN));
50 hOldPen = NtGdiSelectPen(hDC, hOldPen);
51 TEST(hOldPen == hPen);
53
54 /* Test extpen */
56 logbrush.lbStyle = BS_SOLID;
57 logbrush.lbColor = RGB(0x12,0x34,0x56);
58 hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL);
59 ASSERT(hPen);
60 hOldPen = NtGdiSelectPen(hDC, hPen);
61 TEST(hOldPen != NULL);
62 hOldPen = NtGdiSelectPen(hDC, hOldPen);
63 TEST(hOldPen == hPen);
65
66 /* Test deleting pen */
68 hOldPen = NtGdiSelectPen(hDC, hPen);
69 TEST(DeleteObject(hPen) == 1);
70 hOldPen = NtGdiSelectPen(hDC, hOldPen);
71 TEST(hOldPen == hPen);
73
74 /* Test that fallback pen is BLACK_PEN */
75
77}
static HDC hDC
Definition: 3dtext.c:33
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define SetLastError(x)
Definition: compat.h:752
#define RGB(r, g, b)
Definition: precomp.h:62
pKey DeleteObject()
#define ASSERT(a)
Definition: mode.c:44
#define TEST(x)
Definition: precomp.h:20
static HDC
Definition: imagelist.c:92
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
UINT lbStyle
Definition: wingdi.h:1747
COLORREF lbColor
Definition: wingdi.h:1748
uint32_t ULONG_PTR
Definition: typedefs.h:65
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define PS_ALTERNATE
Definition: wingdi.h:585
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define PS_COSMETIC
Definition: wingdi.h:584
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define WHITE_PEN
Definition: wingdi.h:905
#define BLACK_PEN
Definition: wingdi.h:903
BOOL WINAPI DeleteDC(_In_ HDC)
#define BS_SOLID
Definition: wingdi.h:1086
HDC WINAPI GetDC(_In_opt_ HWND)