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
25 #include "wine/test.h"
27 typedef struct tagEXPECTEDNOTIFY
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;
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;
53 static void dont_expect_notify(INT iCode)
55 assert(nUnexpectedNotify < 10);
56 unexpectedNotify[nUnexpectedNotify++] = iCode;
59 static BOOL notifies_received(void)
61 BOOL fRet = (nExpectedNotify == nReceivedNotify);
62 nExpectedNotify = nReceivedNotify = 0;
63 nUnexpectedNotify = 0;
67 static LONG addItem(HWND hdex, int idx, LPCSTR text)
70 hdItem.mask = HDI_TEXT | HDI_WIDTH;
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)
81 hdexItem.mask = HDI_TEXT;
82 hdexItem.pszText = (LPSTR)text;
83 hdexItem.cchTextMax = 0;
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);
91 ok(notifies_received(), "setItem(): not all expected notifies were received\n");
95 static LONG setItemUnicodeNotify(HWND hdex, int idx, LPCSTR text, LPCWSTR wText)
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");
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)
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)
149 handle = CreateWindowEx(0, WC_HEADER, NULL,
150 WS_CHILD|WS_BORDER|WS_VISIBLE|HDS_BUTTONS|HDS_HORZ,
152 hHeaderParentWnd, NULL, NULL, NULL);
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);
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);
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",
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)
223 static CHAR text[] = "Test";
224 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
226 /* Windows implicitly sets some format bits in INSERTITEM */
228 /* HDF_STRING is automatically set and cleared for no text */
229 hdiCreate.mask = HDI_TEXT|HDI_WIDTH|HDI_FORMAT;
230 hdiCreate.pszText = text;
232 hdiCreate.fmt=HDF_CENTER;
233 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
234 ok(hdiRead.fmt == (HDF_STRING|HDF_CENTER), "HDF_STRING not set automatically (fmt=%x)\n", hdiRead.fmt);
236 hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
237 hdiCreate.pszText = text;
238 hdiCreate.fmt = HDF_CENTER|HDF_STRING;
239 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
240 ok(hdiRead.fmt == (HDF_CENTER), "HDF_STRING should be automatically cleared (fmt=%x)\n", hdiRead.fmt);
242 /* HDF_BITMAP is automatically set and cleared for a NULL bitmap or no bitmap */
243 hdiCreate.mask = HDI_BITMAP|HDI_WIDTH|HDI_FORMAT;
244 hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
245 hdiCreate.fmt = HDF_CENTER;
246 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
247 ok(hdiRead.fmt == (HDF_BITMAP|HDF_CENTER), "HDF_BITMAP not set automatically (fmt=%x)\n", hdiRead.fmt);
248 DeleteObject(hdiCreate.hbm);
250 hdiCreate.hbm = NULL;
251 hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
252 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
253 ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for NULL bitmap (fmt=%x)\n", hdiRead.fmt);
255 hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
256 hdiCreate.fmt = HDF_CENTER|HDF_BITMAP;
257 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
258 ok(hdiRead.fmt == HDF_CENTER, "HDF_BITMAP not cleared automatically for no bitmap (fmt=%x)\n", hdiRead.fmt);
260 /* HDF_IMAGE is automatically set but not cleared */
261 hdiCreate.mask = HDI_IMAGE|HDI_WIDTH|HDI_FORMAT;
262 hdiCreate.iImage = 17;
263 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
264 ok(hdiRead.fmt == (HDF_IMAGE|HDF_CENTER), "HDF_IMAGE not set automatically (fmt=%x)\n", hdiRead.fmt);
266 hdiCreate.mask = HDI_WIDTH|HDI_FORMAT;
267 hdiCreate.fmt = HDF_CENTER|HDF_IMAGE;
268 hdiCreate.iImage = 0;
269 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
270 ok(hdiRead.fmt == (HDF_CENTER|HDF_IMAGE), "HDF_IMAGE shouldn't be cleared automatically (fmt=%x)\n", hdiRead.fmt);
273 static void check_auto_fields(void)
277 static CHAR text[] = "Test";
280 /* Windows stores the format, width, lparam even if they are not in the item's mask */
281 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
282 hdiCreate.mask = HDI_TEXT;
284 hdiCreate.pszText = text;
285 addReadDelItem(hWndHeader, &hdiCreate, HDI_WIDTH, &hdiRead);
286 TEST_GET_ITEMCOUNT(6);
287 ok(hdiRead.cxy == hdiCreate.cxy, "cxy should be automatically set\n");
289 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
290 hdiCreate.mask = HDI_TEXT;
291 hdiCreate.pszText = text;
292 hdiCreate.lParam = 0x12345678;
293 addReadDelItem(hWndHeader, &hdiCreate, HDI_LPARAM, &hdiRead);
294 TEST_GET_ITEMCOUNT(6);
295 ok(hdiRead.lParam == hdiCreate.lParam, "lParam should be automatically set\n");
297 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
298 hdiCreate.mask = HDI_TEXT;
299 hdiCreate.pszText = text;
300 hdiCreate.fmt = HDF_STRING|HDF_CENTER;
301 addReadDelItem(hWndHeader, &hdiCreate, HDI_FORMAT, &hdiRead);
302 TEST_GET_ITEMCOUNT(6);
303 ok(hdiRead.fmt == hdiCreate.fmt, "fmt should be automatically set\n");
305 /* others fields are not set */
306 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
307 hdiCreate.mask = HDI_TEXT;
308 hdiCreate.pszText = text;
309 hdiCreate.hbm = CreateBitmap(16, 16, 1, 8, NULL);
310 addReadDelItem(hWndHeader, &hdiCreate, HDI_BITMAP, &hdiRead);
311 TEST_GET_ITEMCOUNT(6);
312 ok(hdiRead.hbm == NULL, "hbm should not be automatically set\n");
313 DeleteObject(hdiCreate.hbm);
315 ZeroMemory(&hdiCreate, sizeof(HDITEMA));
316 hdiCreate.mask = HDI_IMAGE;
317 hdiCreate.iImage = 17;
318 hdiCreate.pszText = text;
319 addReadDelItem(hWndHeader, &hdiCreate, HDI_TEXT, &hdiRead);
320 TEST_GET_ITEMCOUNT(6);
321 ok(hdiRead.pszText==NULL, "pszText shouldn't be automatically set\n");
323 /* field from comctl >4.0 not tested as the system probably won't touch them */
326 static void check_mask(void)
329 static CHAR text[] = "ABC";
332 /* don't create items if the mask is zero */
333 ZeroMemory(&hdi, sizeof(hdi));
340 hdi.cchTextMax = 260;
341 ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
342 ok(ret == -1, "Creating an item with a zero mask should have failed\n");
343 if (ret != -1) SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
345 /* with a non-zero mask creation will succeed */
346 ZeroMemory(&hdi, sizeof(hdi));
347 hdi.mask = HDI_LPARAM;
348 ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
349 ok(ret != -1, "Adding item with non-zero mask failed\n");
351 SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
353 /* in SETITEM if the mask contains a unknown bit, it is ignored */
354 ZeroMemory(&hdi, sizeof(hdi));
355 hdi.mask = 0x08000000 | HDI_LPARAM | HDI_IMAGE;
358 ret = SendMessage(hWndHeader, HDM_INSERTITEM, (WPARAM)0, (LPARAM)&hdi);
359 ok(ret != -1, "Adding item failed\n");
364 ZeroMemory(&hdi, sizeof(hdi));
365 hdi.mask = HDI_LPARAM | HDI_IMAGE;
366 SendMessage(hWndHeader, HDM_GETITEM, (WPARAM)0, (LPARAM)&hdi);
367 ok(hdi.lParam == 133, "comctl32 4.0 field not set\n");
368 ok(hdi.iImage == 17, "comctl32 >4.0 field not set\n");
370 /* but in GETITEM if an unknown bit is set, comctl32 uses only version 4.0 fields */
371 ZeroMemory(&hdi, sizeof(hdi));
372 hdi.mask = 0x08000000 | HDI_LPARAM | HDI_IMAGE;
373 SendMessage(hWndHeader, HDM_GETITEM, (WPARAM)0, (LPARAM)&hdi);
374 ok(hdi.lParam == 133, "comctl32 4.0 field not read\n");
375 ok(hdi.iImage == 0, "comctl32 >4.0 field shouldn't be read\n");
377 SendMessage(hWndHeader, HDM_DELETEITEM, (WPARAM)0, (LPARAM)0);
381 static void test_header_control (void)
384 static char buffer[MAX_CHARS];
387 hWndHeader = create_header_control ();
389 for (i = 3; i >= 0; i--)
391 TEST_GET_ITEMCOUNT(3-i);
392 res = addItem(hWndHeader, 0, str_items[i]);
393 ok(res == 0, "Adding simple item failed (%ld)\n", res);
396 TEST_GET_ITEMCOUNT(4);
397 res = addItem(hWndHeader, 99, 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(5);
400 res = addItem(hWndHeader, 5, str_items[i+1]);
401 ok(res != -1, "Adding Out of Range item should fail with -1 got (%ld)\n", res);
402 TEST_GET_ITEMCOUNT(6);
404 for (i = 0; i < 4; i++) { TEST_GET_ITEM(i,i); TEST_GET_ITEMCOUNT(6); }
406 res=getItem(hWndHeader, 99, buffer);
407 ok(res == 0, "Getting Out of Range item should fail with 0 (%ld), got %s\n", res,buffer);
408 res=getItem(hWndHeader, 5, buffer);
409 ok(res == 1, "Getting Out of Range item should fail with 1 (%ld), got %s\n", res,buffer);
410 res=getItem(hWndHeader, -2, buffer);
411 ok(res == 0, "Getting Out of Range item should fail with 0 (%ld), got %s\n", res,buffer);
413 if (winetest_interactive)
415 UpdateWindow(hHeaderParentWnd);
416 UpdateWindow(hWndHeader);
419 TEST_GET_ITEMCOUNT(6);
420 res=setItem(hWndHeader, 99, str_items[5], FALSE);
421 ok(res == 0, "Setting Out of Range item should fail with 0 (%ld)\n", res);
422 res=setItem(hWndHeader, 5, str_items[5], TRUE);
423 ok(res == 1, "Setting Out of Range item should fail with 1 (%ld)\n", res);
424 res=setItem(hWndHeader, -2, str_items[5], FALSE);
425 ok(res == 0, "Setting Out of Range item should fail with 0 (%ld)\n", res);
426 TEST_GET_ITEMCOUNT(6);
428 for (i = 0; i < 4; i++)
430 res = setItem(hWndHeader, i, str_items[4], TRUE);
431 ok(res != 0, "Setting %d item failed (%ld)\n", i+1, res);
433 TEST_GET_ITEMCOUNT(6);
436 SendMessageA(hWndHeader, HDM_SETUNICODEFORMAT, (WPARAM)TRUE, 0);
437 setItemUnicodeNotify(hWndHeader, 3, pszUniTestA, pszUniTestW);
438 SendMessageA(hWndHeader, WM_NOTIFYFORMAT, (WPARAM)hHeaderParentWnd, (LPARAM)NF_REQUERY);
439 setItem(hWndHeader, 3, str_items[4], TRUE);
441 dont_expect_notify(HDN_GETDISPINFOA);
442 dont_expect_notify(HDN_GETDISPINFOW);
443 addItem(hWndHeader, 0, LPSTR_TEXTCALLBACKA);
444 setItem(hWndHeader, 0, str_items[4], TRUE);
445 /* unexpected notifies cleared by notifies_received in setItem */
446 dont_expect_notify(HDN_GETDISPINFOA);
447 dont_expect_notify(HDN_GETDISPINFOW);
448 setItem(hWndHeader, 0, LPSTR_TEXTCALLBACKA, TRUE);
449 /* unexpected notifies cleared by notifies_received in setItem */
450 delItem(hWndHeader, 0);
453 TEST_GET_ITEMCOUNT(6);
455 TEST_GET_ITEMCOUNT(6);
457 TEST_GET_ITEMCOUNT(6);
459 res = delItem(hWndHeader, 5);
460 ok(res == 1, "Deleting Out of Range item should fail with 1 (%ld)\n", res);
461 res = delItem(hWndHeader, -2);
462 ok(res == 0, "Deleting Out of Range item should fail with 0 (%ld)\n", res);
463 TEST_GET_ITEMCOUNT(5);
465 res = delItem(hWndHeader, 3);
466 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
467 TEST_GET_ITEMCOUNT(4);
468 res = delItem(hWndHeader, 0);
469 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
470 TEST_GET_ITEMCOUNT(3);
471 res = delItem(hWndHeader, 0);
472 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
473 TEST_GET_ITEMCOUNT(2);
474 res = delItem(hWndHeader, 0);
475 ok(res != 0, "Deleting using out of range index failed (%ld)\n", res);
476 TEST_GET_ITEMCOUNT(1);
478 DestroyWindow(hWndHeader);
482 static void check_order(const int expected_id[], const int expected_order[],
483 int count, const char *type)
488 ok(getItemCount(hWndHeader) == count, "Invalid item count in order tests\n");
489 for (i = 0; i < count; i++)
491 hdi.mask = HDI_LPARAM|HDI_ORDER;
492 SendMessage(hWndHeader, HDM_GETITEMA, i, (LPARAM)&hdi);
493 ok(hdi.lParam == expected_id[i],
494 "Invalid item ids after '%s'- item %d has lParam %d\n", type, i, (int)hdi.lParam);
495 ok(hdi.iOrder == expected_order[i],
496 "Invalid item order after '%s'- item %d has iOrder %d\n", type, i, hdi.iOrder);
500 static void test_header_order (void)
502 const int rand1[] = {0, 1, 1, 0, 4};
503 const int rand2[] = {4, 5, 6, 7, 4};
504 const int rand3[] = {5, 5, 1, 6, 1};
505 const int rand4[] = {1, 5, 2, 7, 6, 1, 4, 2, 3, 2};
506 const int rand5[] = {7, 8, 5, 6, 7, 2, 1, 9, 10, 10};
507 const int rand6[] = {2, 8, 3, 4, 0};
509 const int ids1[] = {3, 0, 2, 1, 4};
510 const int ord1[] = {0, 1, 2, 3, 4};
511 const int ids2[] = {3, 9, 7, 0, 2, 1, 4, 8, 6, 5};
512 const int ord2[] = {0, 4, 7, 1, 2, 3, 9, 8, 6, 5};
513 const int ord3[] = {0, 3, 9, 2, 1, 8, 7, 6, 5, 4};
514 const int ids4[] = {9, 0, 1, 8, 6};
515 const int ord4[] = {1, 0, 4, 3, 2};
521 hWndHeader = create_header_control();
523 ZeroMemory(&hdi, sizeof(HDITEMA));
524 hdi.mask = HDI_TEXT | HDI_LPARAM;
525 hdi.pszText = buffer;
526 strcpy(buffer, "test");
528 for (i = 0; i < 5; i++)
531 SendMessage(hWndHeader, HDM_INSERTITEMA, rand1[i], (LPARAM)&hdi);
534 check_order(ids1, ord1, 5, "insert without iOrder");
536 hdi.mask |= HDI_ORDER;
537 for (i = 0; i < 5; i++)
540 hdi.iOrder = rand2[i];
541 SendMessage(hWndHeader, HDM_INSERTITEMA, rand3[i], (LPARAM)&hdi);
544 check_order(ids2, ord2, 10, "insert with order");
546 hdi.mask = HDI_ORDER;
549 hdi.iOrder = rand5[i];
550 SendMessage(hWndHeader, HDM_SETITEMA, rand4[i], (LPARAM)&hdi);
553 check_order(ids2, ord3, 10, "setitems changing order");
556 SendMessage(hWndHeader, HDM_DELETEITEM, rand6[i], 0);
557 check_order(ids4, ord4, 5, "deleteitem");
559 DestroyWindow(hWndHeader);
562 LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
568 NMHEADERA *hdr = (NMHEADER *)lParam;
569 EXPECTEDNOTIFY *expected;
572 for (i=0; i<nUnexpectedNotify; i++)
573 ok(hdr->hdr.code != unexpectedNotify[i], "Received invalid notify %d\n", hdr->hdr.code);
575 if (nReceivedNotify >= nExpectedNotify || hdr->hdr.hwndFrom != hWndHeader )
578 expected = &expectedNotify[nReceivedNotify];
579 if (hdr->hdr.code != expected->iCode)
583 compare_items(hdr->hdr.code, &expected->hdItem, hdr->pitem, expected->fUnicode);
592 return DefWindowProcA(hWnd, msg, wParam, lParam);
598 static void init(void) {
600 INITCOMMONCONTROLSEX icex;
602 icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
603 icex.dwICC = ICC_USEREX_CLASSES;
604 InitCommonControlsEx(&icex);
606 wc.style = CS_HREDRAW | CS_VREDRAW;
609 wc.hInstance = GetModuleHandleA(NULL);
611 wc.hCursor = LoadCursorA(NULL, MAKEINTRESOURCEA(IDC_ARROW));
612 wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW);
613 wc.lpszMenuName = NULL;
614 wc.lpszClassName = "HeaderTestClass";
615 wc.lpfnWndProc = HeaderTestWndProc;
618 hHeaderParentWnd = CreateWindowExA(0, "HeaderTestClass", "Header test", WS_OVERLAPPEDWINDOW,
619 CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
620 assert(hHeaderParentWnd != NULL);
627 test_header_control();
630 DestroyWindow(hHeaderParentWnd);