Update the address of the Free Software Foundation.
[wine/gsoc_dplay.git] / dlls / comctl32 / tests / header.c
blob70860d90264609f51cbdf1df1dfe8e6eff3e0376
1 /* Unit test suite for header control.
3 * Copyright 2005 Vijay Kiran Kamuju
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <windows.h>
22 #include <commctrl.h>
23 #include <assert.h>
25 #include "wine/test.h"
27 typedef struct tagEXPECTEDNOTIFY
29 INT iCode;
30 BOOL fUnicode;
31 HDITEMA hdItem;
32 } EXPECTEDNOTIFY;
34 EXPECTEDNOTIFY expectedNotify[10];
35 INT nExpectedNotify = 0;
36 INT nReceivedNotify = 0;
37 INT unexpectedNotify[10];
38 INT nUnexpectedNotify = 0;
40 static HWND hHeaderParentWnd;
41 static HWND hWndHeader;
42 #define MAX_CHARS 100
44 static void expect_notify(INT iCode, BOOL fUnicode, HDITEMA *lpItem)
46 assert(nExpectedNotify < 10);
47 expectedNotify[nExpectedNotify].iCode = iCode;
48 expectedNotify[nExpectedNotify].fUnicode = fUnicode;
49 expectedNotify[nExpectedNotify].hdItem = *lpItem;
50 nExpectedNotify++;
53 static void dont_expect_notify(INT iCode)
55 assert(nUnexpectedNotify < 10);
56 unexpectedNotify[nUnexpectedNotify++] = iCode;
59 static BOOL notifies_received()
61 BOOL fRet = (nExpectedNotify == nReceivedNotify);
62 nExpectedNotify = nReceivedNotify = 0;
63 nUnexpectedNotify = 0;
64 return fRet;
67 static LONG addItem(HWND hdex, int idx, LPCSTR text)
69 HDITEMA hdItem;
70 hdItem.mask = HDI_TEXT | HDI_WIDTH;
71 hdItem.cxy = 100;
72 hdItem.pszText = (LPSTR)text;
73 hdItem.cchTextMax = 0;
74 return (LONG)SendMessage(hdex, HDM_INSERTITEMA, (WPARAM)idx, (LPARAM)&hdItem);
77 static LONG setItem(HWND hdex, int idx, LPCSTR text, BOOL fCheckNotifies)
79 LONG ret;
80 HDITEMA hdexItem;
81 hdexItem.mask = HDI_TEXT;
82 hdexItem.pszText = (LPSTR)text;
83 hdexItem.cchTextMax = 0;
84 if (fCheckNotifies)
86 expect_notify(HDN_ITEMCHANGINGA, FALSE, &hdexItem);
87 expect_notify(HDN_ITEMCHANGEDA, FALSE, &hdexItem);
89 ret = (LONG)SendMessage(hdex, HDM_SETITEMA, (WPARAM)idx, (LPARAM)&hdexItem);
90 if (fCheckNotifies)
91 ok(notifies_received(), "setItem(): not all expected notifies were received\n");
92 return ret;
95 static LONG setItemUnicodeNotify(HWND hdex, int idx, LPCSTR text, LPCWSTR wText)
97 LONG ret;
98 HDITEMA hdexItem;
99 HDITEMW hdexNotify;
100 hdexItem.mask = HDI_TEXT;
101 hdexItem.pszText = (LPSTR)text;
102 hdexItem.cchTextMax = 0;
104 hdexNotify.mask = HDI_TEXT;
105 hdexNotify.pszText = (LPWSTR)wText;
107 expect_notify(HDN_ITEMCHANGINGW, TRUE, (HDITEMA*)&hdexNotify);
108 expect_notify(HDN_ITEMCHANGEDW, TRUE, (HDITEMA*)&hdexNotify);
109 ret = (LONG)SendMessage(hdex, HDM_SETITEMA, (WPARAM)idx, (LPARAM)&hdexItem);
110 ok(notifies_received(), "setItemUnicodeNotify(): not all expected notifies were received\n");
111 return ret;
114 static LONG delItem(HWND hdex, int idx)
116 return (LONG)SendMessage(hdex, HDM_DELETEITEM, (WPARAM)idx, 0);
119 static LONG getItemCount(HWND hdex)
121 return (LONG)SendMessage(hdex, HDM_GETITEMCOUNT, 0, 0);
124 static LONG getItem(HWND hdex, int idx, LPSTR textBuffer)
126 HDITEMA hdItem;
127 hdItem.mask = HDI_TEXT;
128 hdItem.pszText = textBuffer;
129 hdItem.cchTextMax = MAX_CHARS;
130 return (LONG)SendMessage(hdex, HDM_GETITEMA, (WPARAM)idx, (LPARAM)&hdItem);
133 static void addReadDelItem(HWND hdex, HDITEMA *phdiCreate, int maskRead, HDITEMA *phdiRead)
135 ok(SendMessage(hdex, HDM_INSERTITEMA, (WPARAM)0, (LPARAM)phdiCreate)!=-1, "Adding item failed\n");
136 ZeroMemory(phdiRead, sizeof(HDITEMA));
137 phdiRead->mask = maskRead;
138 ok(SendMessage(hdex, HDM_GETITEMA, (WPARAM)0, (LPARAM)phdiRead)!=0, "Getting item data failed\n");
139 ok(SendMessage(hdex, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0)!=0, "Deleteing item failed\n");
142 static HWND create_header_control (void)
144 HWND handle;
145 HDLAYOUT hlayout;
146 RECT rectwin;
147 WINDOWPOS winpos;
149 handle = CreateWindowEx(0, WC_HEADER, NULL,
150 WS_CHILD|WS_BORDER|WS_VISIBLE|HDS_BUTTONS|HDS_HORZ,
151 0, 0, 0, 0,
152 hHeaderParentWnd, NULL, NULL, NULL);
153 assert(handle);
155 if (winetest_interactive)
156 ShowWindow (hHeaderParentWnd, SW_SHOW);
158 GetClientRect(hHeaderParentWnd,&rectwin);
159 hlayout.prc = &rectwin;
160 hlayout.pwpos = &winpos;
161 SendMessageA(handle,HDM_LAYOUT,0,(LPARAM) &hlayout);
162 SetWindowPos(handle, winpos.hwndInsertAfter, winpos.x, winpos.y,
163 winpos.cx, winpos.cy, 0);
165 return handle;
168 static void compare_items(INT iCode, HDITEMA *hdi1, HDITEMA *hdi2, BOOL fUnicode)
170 ok(hdi1->mask == hdi2->mask, "Notify %d mask mismatch (%08x != %08x)\n", iCode, hdi1->mask, hdi2->mask);
171 if (hdi1->mask & HDI_WIDTH)
173 ok(hdi1->cxy == hdi2->cxy, "Notify %d cxy mismatch (%08x != %08x)\n", iCode, hdi1->cxy, hdi2->cxy);
175 if (hdi1->mask & HDI_TEXT)
177 if (hdi1->pszText == LPSTR_TEXTCALLBACKA)
179 ok(hdi1->pszText == LPSTR_TEXTCALLBACKA, "Notify %d - only one item is LPSTR_TEXTCALLBACK\n", iCode);
181 else
182 if (fUnicode)
184 char buf1[260];
185 char buf2[260];
186 WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)hdi1->pszText, -1, buf1, 260, NULL, NULL);
187 WideCharToMultiByte(CP_ACP, 0, (LPCWSTR)hdi2->pszText, -1, buf2, 260, NULL, NULL);
188 ok(lstrcmpW((LPWSTR)hdi1->pszText, (LPWSTR)hdi2->pszText)==0,
189 "Notify %d text mismatch (L\"%s\" vs L\"%s\")\n",
190 iCode, buf1, buf2);
192 else
194 ok(strcmp(hdi1->pszText, hdi2->pszText)==0,
195 "Notify %d text mismatch (\"%s\" vs \"%s\")\n",
196 iCode, hdi1->pszText, hdi2->pszText);
201 static const char *str_items[] =
202 {"First Item", "Second Item", "Third Item", "Fourth Item", "Replace Item", "Out Of Range Item"};
204 static const char pszUniTestA[] = "TST";
205 static const WCHAR pszUniTestW[] = {'T','S','T',0};
208 #define TEST_GET_ITEM(i,c)\
209 { res = getItem(hWndHeader, i, buffer);\
210 ok(res != 0, "Getting item[%d] using valid index failed unexpectedly (%ld)\n", i, res);\
211 ok(strcmp(str_items[c], buffer) == 0, "Getting item[%d] returned \"%s\" expecting \"%s\"\n", i, buffer, str_items[c]);\
214 #define TEST_GET_ITEMCOUNT(i)\
215 { res = getItemCount(hWndHeader);\
216 ok(res == i, "Got Item Count as %ld\n", res);\
219 static void check_auto_format(void)
221 HDITEMA hdiCreate;
222 HDITEMA hdiRead;
223 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
225 /* Windows implicitly sets some format bits in INSERTITEM */
227 /* HDF_STRING is automaticaly set and cleared for no text */
228 hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
229 hdiCreate.pszText = "Test";
230 hdiCreate.cxy = 100;
231 hdiCreate.fmt=HDF_CENTER;
232 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
233 ok(hdiRead.fmt == (HDF_STRING|HDF_CENTER), "HDF_STRING not set automatically (fmt=%x)\n", hdiRead.fmt);
235 hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
236 hdiCreate.pszText = "Test";
237 hdiCreate.fmt = HDF_CENTER|HDF_STRING;
238 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
239 ok(hdiRead.fmt == (HDF_CENTER), "HDF_STRING should be automatically cleared (fmt=%x)\n", hdiRead.fmt);
241 /* HDF_BITMAP is automatically set and cleared for a NULL bitmap or no bitmap */
242 hdiCreate.mask = HDI_BITMAP|HDI_WIDTH|HDI_FORMAT;
243 hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
244 hdiCreate.fmt = HDF_CENTER;
245 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
246 ok(hdiRead.fmt == (HDF_BITMAP|HDF_CENTER), "HDF_BITMAP not set automatically (fmt=%x)\n", hdiRead.fmt);
247 DeleteObject(hdiCreate.hbm);
249 hdiCreate.hbm = NULL;
250 hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
251 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
252 ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for NULL bitmap (fmt=%x)\n", hdiRead.fmt);
254 hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
255 hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
256 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
257 ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for no bitmap (fmt=%x)\n", hdiRead.fmt);
259 /* HDF_IMAGE is automatically set but not cleared */
260 hdiCreate.mask = HDI_IMAGE|HDI_WIDTH|HDI_FORMAT;
261 hdiCreate.iImage = 17;
262 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
263 ok(hdiRead.fmt == (HDF_IMAGE|HDF_CENTER), "HDF_IMAGE not set automatically (fmt=%x)\n", hdiRead.fmt);
265 hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
266 hdiCreate.fmt = HDF_CENTER|HDF_IMAGE;
267 hdiCreate.iImage = 0;
268 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
269 ok(hdiRead.fmt == (HDF_CENTER|HDF_IMAGE), "HDF_IMAGE shouldn't be cleared automatically (fmt=%x)\n", hdiRead.fmt);
272 static void check_auto_fields(void)
274 HDITEMA hdiCreate;
275 HDITEMA hdiRead;
276 LRESULT res;
278 /* Windows stores the format, width, lparam even if they are not in the item's mask */
279 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
280 hdiCreate.mask = HDI_TEXT;
281 hdiCreate.cxy = 100;
282 hdiCreate.pszText = "Test";
283 addReadDelItem(hWndHeader, &hdiCreate, HDI_WIDTH, &hdiRead);
284 TEST_GET_ITEMCOUNT(6);
285 ok(hdiRead.cxy == hdiCreate.cxy, "cxy should be automatically set\n");
287 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
288 hdiCreate.mask = HDI_TEXT;
289 hdiCreate.pszText = "Test";
290 hdiCreate.lParam = 0x12345678;
291 addReadDelItem(hWndHeader, &hdiCreate, HDI_LPARAM, &hdiRead);
292 TEST_GET_ITEMCOUNT(6);
293 ok(hdiRead.lParam == hdiCreate.lParam, "lParam should be automatically set\n");
295 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
296 hdiCreate.mask = HDI_TEXT;
297 hdiCreate.pszText = "Test";
298 hdiCreate.fmt = HDF_STRING|HDF_CENTER;
299 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
300 TEST_GET_ITEMCOUNT(6);
301 ok(hdiRead.fmt == hdiCreate.fmt, "fmt should be automatically set\n");
303 /* others fields are not set */
304 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
305 hdiCreate.mask = HDI_TEXT;
306 hdiCreate.pszText = "Test";
307 hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
308 addReadDelItem(hWndHeader, &hdiCreate, HDI_BITMAP, &hdiRead);
309 TEST_GET_ITEMCOUNT(6);
310 ok(hdiRead.hbm == NULL, "hbm should not be automatically set\n");
311 DeleteObject(hdiCreate.hbm);
313 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
314 hdiCreate.mask = HDI_IMAGE;
315 hdiCreate.iImage = 17;
316 hdiCreate.pszText = "Test";
317 addReadDelItem(hWndHeader, &hdiCreate, HDI_TEXT, &hdiRead);
318 TEST_GET_ITEMCOUNT(6);
319 ok(hdiRead.pszText==NULL, "pszText shouldn't be automatically set\n");
321 /* field from comctl >4.0 not tested as the system probably won't touch them */
324 static void check_mask()
326 HDITEMA hdi;
327 LRESULT ret;
329 /* don't create items if the mask is zero */
330 ZeroMemory(&hdi, sizeof(hdi));
331 hdi.mask = 0;
332 hdi.cxy = 200;
333 hdi.pszText = "ABC";
334 hdi.fmt = 0;
335 hdi.iOrder = 0;
336 hdi.lParam = 17;
337 hdi.cchTextMax = 260;
338 ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
339 ok(ret == -1, "Creating an item with a zero mask should have failed\n");
340 if (ret != -1) SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
342 /* with a non-zero mask creation will succeed */
343 ZeroMemory(&hdi, sizeof(hdi));
344 hdi.mask = HDI_LPARAM;
345 ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
346 ok(ret != -1, "Adding item with non-zero mask failed\n");
347 if (ret != -1)
348 SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
350 /* in SETITEM if the mask contains a unknown bit, it is ignored */
351 ZeroMemory(&hdi, sizeof(hdi));
352 hdi.mask = 0x08000000 | HDI_LPARAM | HDI_IMAGE;
353 hdi.lParam = 133;
354 hdi.iImage = 17;
355 ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
356 ok(ret != -1, "Adding item failed\n");
358 if (ret != -1)
360 /* check result */
361 ZeroMemory(&hdi, sizeof(hdi));
362 hdi.mask = HDI_LPARAM | HDI_IMAGE;
363 SendMessage(hWndHeader, HDM_GETITEM, (WPARAM)0, (LPARAM)&hdi);
364 ok(hdi.lParam == 133, "comctl32 4.0 field not set\n");
365 ok(hdi.iImage == 17, "comctl32 >4.0 field not set\n");
367 /* but in GETITEM if an unknown bit is set, comctl32 uses only version 4.0 fields */
368 ZeroMemory(&hdi, sizeof(hdi));
369 hdi.mask = 0x08000000 | HDI_LPARAM | HDI_IMAGE;
370 SendMessage(hWndHeader, HDM_GETITEM, (WPARAM)0, (LPARAM)&hdi);
371 ok(hdi.lParam == 133, "comctl32 4.0 field not read\n");
372 ok(hdi.iImage == 0, "comctl32 >4.0 field shouldn't be read\n");
374 SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
378 static void test_header_control (void)
380 LONG res;
381 static char buffer[MAX_CHARS];
382 int i;
384 hWndHeader = create_header_control ();
386 for (i = 3; i >= 0; i--)
388 TEST_GET_ITEMCOUNT(3-i);
389 res = addItem(hWndHeader, 0, str_items[i]);
390 ok(res == 0, "Adding simple item failed (%ld)\n", res);
393 TEST_GET_ITEMCOUNT(4);
394 res = addItem(hWndHeader, 99, str_items[i+1]);
395 ok(res != -1, "Adding Out of Range item should fail with -1 got (%ld)\n", res);
396 TEST_GET_ITEMCOUNT(5);
397 res = addItem(hWndHeader, 5, str_items[i+1]);
398 ok(res != -1, "Adding Out of Range item should fail with -1 got (%ld)\n", res);
399 TEST_GET_ITEMCOUNT(6);
401 for (i = 0; i < 4; i++) { TEST_GET_ITEM(i,i); TEST_GET_ITEMCOUNT(6); }
403 res=getItem(hWndHeader, 99, buffer);
404 ok(res == 0, "Getting Out of Range item should fail with 0 (%ld), got %s\n", res,buffer);
405 res=getItem(hWndHeader, 5, buffer);
406 ok(res == 1, "Getting Out of Range item should fail with 1 (%ld), got %s\n", res,buffer);
407 res=getItem(hWndHeader, -2, buffer);
408 ok(res == 0, "Getting Out of Range item should fail with 0 (%ld), got %s\n", res,buffer);
410 if (winetest_interactive)
412 UpdateWindow(hHeaderParentWnd);
413 UpdateWindow(hWndHeader);
416 TEST_GET_ITEMCOUNT(6);
417 res=setItem(hWndHeader, 99, str_items[5], FALSE);
418 ok(res == 0, "Setting Out of Range item should fail with 0 (%ld)\n", res);
419 res=setItem(hWndHeader, 5, str_items[5], TRUE);
420 ok(res == 1, "Setting Out of Range item should fail with 1 (%ld)\n", res);
421 res=setItem(hWndHeader, -2, str_items[5], FALSE);
422 ok(res == 0, "Setting Out of Range item should fail with 0 (%ld)\n", res);
423 TEST_GET_ITEMCOUNT(6);
425 for (i = 0; i < 4; i++)
427 res = setItem(hWndHeader, i, str_items[4], TRUE);
428 ok(res != 0, "Setting %d item failed (%ld)\n", i+1, res);
429 TEST_GET_ITEM(i, 4);
430 TEST_GET_ITEMCOUNT(6);
433 SendMessageA(hWndHeader, HDM_SETUNICODEFORMAT, (WPARAM)TRUE, 0);
434 setItemUnicodeNotify(hWndHeader, 3, pszUniTestA, pszUniTestW);
435 SendMessageA(hWndHeader, WM_NOTIFYFORMAT, (WPARAM)hHeaderParentWnd, (LPARAM)NF_REQUERY);
436 setItem(hWndHeader, 3, str_items[4], TRUE);
438 dont_expect_notify(HDN_GETDISPINFOA);
439 dont_expect_notify(HDN_GETDISPINFOW);
440 addItem(hWndHeader, 0, LPSTR_TEXTCALLBACKA);
441 setItem(hWndHeader, 0, str_items[4], TRUE);
442 /* unexpected notifies cleared by notifies_received in setItem */
443 dont_expect_notify(HDN_GETDISPINFOA);
444 dont_expect_notify(HDN_GETDISPINFOW);
445 setItem(hWndHeader, 0, LPSTR_TEXTCALLBACKA, TRUE);
446 /* unexpected notifies cleared by notifies_received in setItem */
447 delItem(hWndHeader, 0);
449 check_auto_format();
450 TEST_GET_ITEMCOUNT(6);
451 check_auto_fields();
452 TEST_GET_ITEMCOUNT(6);
453 check_mask();
454 TEST_GET_ITEMCOUNT(6);
456 res = delItem(hWndHeader, 5);
457 ok(res == 1, "Deleting Out of Range item should fail with 1 (%ld)\n", res);
458 res = delItem(hWndHeader, -2);
459 ok(res == 0, "Deleting Out of Range item should fail with 0 (%ld)\n", res);
460 TEST_GET_ITEMCOUNT(5);
462 res = delItem(hWndHeader, 3);
463 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
464 TEST_GET_ITEMCOUNT(4);
465 res = delItem(hWndHeader, 0);
466 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
467 TEST_GET_ITEMCOUNT(3);
468 res = delItem(hWndHeader, 0);
469 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
470 TEST_GET_ITEMCOUNT(2);
471 res = delItem(hWndHeader, 0);
472 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
473 TEST_GET_ITEMCOUNT(1);
475 DestroyWindow(hWndHeader);
479 LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
481 switch(msg) {
483 case WM_NOTIFY:
485 NMHEADERA *hdr = (NMHEADER *)lParam;
486 EXPECTEDNOTIFY *expected;
487 int i;
489 for (i=0; i<nUnexpectedNotify; i++)
490 ok(hdr->hdr.code != unexpectedNotify[i], "Received invalid notify %d\n", hdr->hdr.code);
492 if (nReceivedNotify >= nExpectedNotify || hdr->hdr.hwndFrom != hWndHeader )
493 break;
495 expected = &expectedNotify[nReceivedNotify];
496 if (hdr->hdr.code != expected->iCode)
497 break;
499 nReceivedNotify++;
500 compare_items(hdr->hdr.code, &expected->hdItem, hdr->pitem, expected->fUnicode);
501 break;
504 case WM_DESTROY:
505 PostQuitMessage(0);
506 break;
508 default:
509 return DefWindowProcA(hWnd, msg, wParam, lParam);
512 return 0L;
515 static void init(void) {
516 WNDCLASSA wc;
517 INITCOMMONCONTROLSEX icex;
519 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
520 icex.dwICC = ICC_USEREX_CLASSES;
521 InitCommonControlsEx(&icex);
523 wc.style = CS_HREDRAW | CS_VREDRAW;
524 wc.cbClsExtra = 0;
525 wc.cbWndExtra = 0;
526 wc.hInstance = GetModuleHandleA(NULL);
527 wc.hIcon = NULL;
528 wc.hCursor = LoadCursorA(NULL, MAKEINTRESOURCEA(IDC_ARROW));
529 wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
530 wc.lpszMenuName = NULL;
531 wc.lpszClassName = "HeaderTestClass";
532 wc.lpfnWndProc = HeaderTestWndProc;
533 RegisterClassA(&wc);
535 hHeaderParentWnd = CreateWindowExA(0, "HeaderTestClass", "Header test", WS_OVERLAPPEDWINDOW,
536 CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
537 assert(hHeaderParentWnd != NULL);
540 START_TEST(header)
542 init();
544 test_header_control();
546 DestroyWindow(hHeaderParentWnd);