1 
2 #include <apitest.h>
3 
4 #include <wingdi.h>
5 #include <winuser.h>
6 
7 START_TEST(DrawIconEx)
8 {
9     HCURSOR hcursor;
10     HBITMAP hbmp;
11     ICONINFO ii;
12     HDC hdcScreen, hdc;
13     BOOL ret;
14     HBRUSH hbrush;
15 
16     ZeroMemory(&ii, sizeof(ii));
17 
18     ii.hbmMask = CreateBitmap(8, 16, 1, 1, NULL);
19     ok(ii.hbmMask != NULL, "\n");
20     hcursor = CreateIconIndirect(&ii);
21     ok(hcursor != NULL, "\n");
22     DeleteObject(ii.hbmMask);
23 
24     hdcScreen = GetDC(0);
25     hbmp = CreateCompatibleBitmap(hdcScreen, 8, 8);
26     ok(hbmp != NULL, "\n");
27     hdc = CreateCompatibleDC(hdcScreen);
28     ok(hdc != NULL, "\n");
29     ReleaseDC(0, hdcScreen);
30 
31     hbmp = SelectObject(hdc, hbmp);
32     ok(hbmp != NULL, "\n");
33 
34     hbrush = GetStockObject(DKGRAY_BRUSH);
35     ok(hbrush != NULL, "\n");
36 
37     ret = DrawIconEx(hdc, 0, 0, hcursor, 8, 8, 0, hbrush, DI_NORMAL);
38     ok(ret, "\n");
39     DestroyCursor(hcursor);
40 
41     /* Try with color */
42     ii.hbmMask = CreateBitmap(8, 8, 1, 1, NULL);
43     ok(ii.hbmMask != NULL, "\n");
44     ii.hbmColor = CreateBitmap(8, 8, 16, 1, NULL);
45     ok(ii.hbmColor != NULL, "\n");
46     hcursor = CreateIconIndirect(&ii);
47     ok(hcursor != NULL, "\n");
48     DeleteObject(ii.hbmMask);
49     DeleteObject(ii.hbmColor);
50 
51     ret = DrawIconEx(hdc, 0, 0, hcursor, 8, 8, 0, hbrush, DI_NORMAL);
52     ok(ret, "\n");
53     DestroyCursor(hcursor);
54 
55     hbmp = SelectObject(hdc, hbmp);
56     DeleteObject(hbmp);
57     DeleteDC(hdc);
58 }