d0e1ec018a34c82db48dbea892fd92ab943b2afb
[reactos.git] / rostests / apitests / w32knapi / ntuser / NtUserGetIconInfo.c
1 INT
2 Test_NtUserGetIconInfo(PTESTINFO pti)
3 {
4 HICON hIcon;
5 ICONINFO iinfo;
6 HBITMAP mask, color;
7
8 ZeroMemory(&iinfo, sizeof(ICONINFO));
9
10 /* BASIC TESTS */
11 hIcon = (HICON) NtUserCallOneParam(0, _ONEPARAM_ROUTINE_CREATEEMPTYCUROBJECT);
12 TEST(hIcon != NULL);
13
14 /* Last param is unknown */
15 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == FALSE);
16 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == FALSE);
17
18 TEST(NtUserDestroyCursor(hIcon, 0) == TRUE);
19
20 mask = CreateBitmap(16,16,1,1,NULL);
21 color = CreateBitmap(16,16,1,16,NULL);
22
23 iinfo.hbmMask = mask;
24 iinfo.hbmColor = color ;
25 iinfo.fIcon = TRUE;
26 iinfo.xHotspot = 8;
27 iinfo.yHotspot = 8;
28
29 hIcon = CreateIconIndirect(&iinfo);
30 TEST(hIcon!=NULL);
31
32 // TODO : test last parameter...
33 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, FALSE) == TRUE);
34
35 TEST(iinfo.hbmMask != NULL);
36 TEST(iinfo.hbmColor != NULL);
37 TEST(iinfo.fIcon == TRUE);
38 TEST(iinfo.yHotspot == 8);
39 TEST(iinfo.xHotspot == 8);
40
41 TEST(iinfo.hbmMask != mask);
42 TEST(iinfo.hbmColor != color);
43
44 /* Does it make a difference? */
45 TEST(NtUserGetIconInfo(hIcon, &iinfo, NULL, NULL, NULL, TRUE) == TRUE);
46
47 TEST(iinfo.hbmMask != NULL);
48 TEST(iinfo.hbmColor != NULL);
49 TEST(iinfo.fIcon == TRUE);
50 TEST(iinfo.yHotspot == 8);
51 TEST(iinfo.xHotspot == 8);
52
53 TEST(iinfo.hbmMask != mask);
54 TEST(iinfo.hbmColor != color);
55
56 DeleteObject(mask);
57 DeleteObject(color);
58
59 DestroyIcon(hIcon);
60
61 return APISTATUS_NORMAL;
62 }