4 * Copyright 2006 Mike McCormack for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 #include "wine/test.h"
29 HWND hwnd
, hwndparent
= 0;
30 INITCOMMONCONTROLSEX icc
;
38 icc
.dwSize
= sizeof icc
;
39 InitCommonControlsEx(&icc
);
41 himl
= ImageList_Create(40, 40, 0, 4, 4);
42 ok(himl
!= NULL
, "failed to create imagelist\n");
44 hbmp
= CreateBitmap(40, 40, 1, 1, NULL
);
45 ok(hbmp
!= NULL
, "failed to create bitmap\n");
47 r
= ImageList_Add(himl
, hbmp
, 0);
48 ok(r
== 0, "should be zero\n");
50 hwnd
= CreateWindowEx(0, "SysListView32", "foo", LVS_OWNERDRAWFIXED
,
51 10, 10, 100, 200, hwndparent
, NULL
, NULL
, NULL
);
52 ok(hwnd
!= NULL
, "failed to create listview window\n");
54 r
= SendMessage(hwnd
, LVM_SETEXTENDEDLISTVIEWSTYLE
, 0, 0x940);
55 ok(r
== 0, "should return zero\n");
57 r
= SendMessage(hwnd
, LVM_SETIMAGELIST
, 0, (LPARAM
)himl
);
58 ok(r
== 0, "should return zero\n");
60 r
= SendMessage(hwnd
, LVM_SETICONSPACING
, 0, MAKELONG(100,50));
61 /* returns dimensions */
63 r
= SendMessage(hwnd
, LVM_GETITEMCOUNT
, 0, 0);
64 ok(r
== 0, "should be zero items\n");
66 item
.mask
= LVIF_IMAGE
| LVIF_TEXT
;
70 r
= SendMessage(hwnd
, LVM_INSERTITEM
, 0, (LPARAM
) &item
);
71 ok(r
== -1, "should fail\n");
74 item
.pszText
= "hello";
75 r
= SendMessage(hwnd
, LVM_INSERTITEM
, 0, (LPARAM
) &item
);
76 ok(r
== 0, "should not fail\n");
78 memset(&r1
, 0, sizeof r1
);
80 r
= SendMessage(hwnd
, LVM_GETITEMRECT
, 0, (LPARAM
) &r1
);
82 r
= SendMessage(hwnd
, LVM_DELETEALLITEMS
, 0, 0);
83 ok(r
== TRUE
, "should not fail\n");
86 item
.pszText
= "hello";
87 r
= SendMessage(hwnd
, LVM_INSERTITEM
, 0, (LPARAM
) &item
);
88 ok(r
== 0, "should not fail\n");
90 memset(&r2
, 0, sizeof r2
);
92 r
= SendMessage(hwnd
, LVM_GETITEMRECT
, 0, (LPARAM
) &r2
);
94 ok(!memcmp(&r1
, &r2
, sizeof r1
), "rectangle should be the same\n");