ReactOS  0.4.14-dev-293-g2b39b42
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 
19  hPen = GetStockObject(WHITE_PEN);
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 
76  DeleteDC(hDC);
77 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT lbStyle
Definition: wingdi.h:1742
HDC WINAPI GetDC(_In_opt_ HWND)
#define WHITE_PEN
Definition: wingdi.h:904
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
uint32_t ULONG_PTR
Definition: typedefs.h:63
__kernel_entry W32KAPI HPEN APIENTRY NtGdiSelectPen(_In_ HDC hdc, _In_ HPEN hpen)
smooth NULL
Definition: ftsmooth.c:416
#define PS_COSMETIC
Definition: wingdi.h:583
#define PS_ALTERNATE
Definition: wingdi.h:584
#define TEST(x)
Definition: precomp.h:20
#define RGB(r, g, b)
Definition: wingdi.h:2935
COLORREF lbColor
Definition: wingdi.h:1743
#define SetLastError(x)
Definition: compat.h:409
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static HDC hDC
Definition: 3dtext.c:33
BOOL WINAPI DeleteDC(_In_ HDC)
#define BLACK_PEN
Definition: wingdi.h:902
HPEN WINAPI ExtCreatePen(_In_ DWORD iPenStyle, _In_ DWORD cWidth, _In_ const LOGBRUSH *plbrush, _In_ DWORD cStyle, _In_reads_opt_(cStyle) const DWORD *pstyle)
#define BS_SOLID
Definition: wingdi.h:1085