comctl32: header: Check for HDN_GETDISPINFO not being sent during INSERT/SETITEM.
This commit is contained in:
parent
700dd456e9
commit
8266fdd8cb
|
@ -34,6 +34,8 @@ typedef struct tagEXPECTEDNOTIFY
|
||||||
EXPECTEDNOTIFY expectedNotify[10];
|
EXPECTEDNOTIFY expectedNotify[10];
|
||||||
INT nExpectedNotify = 0;
|
INT nExpectedNotify = 0;
|
||||||
INT nReceivedNotify = 0;
|
INT nReceivedNotify = 0;
|
||||||
|
INT unexpectedNotify[10];
|
||||||
|
INT nUnexpectedNotify = 0;
|
||||||
|
|
||||||
static HWND hHeaderParentWnd;
|
static HWND hHeaderParentWnd;
|
||||||
static HWND hWndHeader;
|
static HWND hWndHeader;
|
||||||
|
@ -48,10 +50,17 @@ static void expect_notify(INT iCode, BOOL fUnicode, HDITEMA *lpItem)
|
||||||
nExpectedNotify++;
|
nExpectedNotify++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dont_expect_notify(INT iCode)
|
||||||
|
{
|
||||||
|
assert(nUnexpectedNotify < 10);
|
||||||
|
unexpectedNotify[nUnexpectedNotify++] = iCode;
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL notifies_received()
|
static BOOL notifies_received()
|
||||||
{
|
{
|
||||||
BOOL fRet = (nExpectedNotify == nReceivedNotify);
|
BOOL fRet = (nExpectedNotify == nReceivedNotify);
|
||||||
nExpectedNotify = nReceivedNotify = 0;
|
nExpectedNotify = nReceivedNotify = 0;
|
||||||
|
nUnexpectedNotify = 0;
|
||||||
return fRet;
|
return fRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +165,11 @@ static void compare_items(INT iCode, HDITEMA *hdi1, HDITEMA *hdi2, BOOL fUnicode
|
||||||
}
|
}
|
||||||
if (hdi1->mask & HDI_TEXT)
|
if (hdi1->mask & HDI_TEXT)
|
||||||
{
|
{
|
||||||
|
if (hdi1->pszText == LPSTR_TEXTCALLBACKA)
|
||||||
|
{
|
||||||
|
ok(hdi1->pszText == LPSTR_TEXTCALLBACKA, "Notify %d - only one item is LPSTR_TEXTCALLBACK\n", iCode);
|
||||||
|
}
|
||||||
|
else
|
||||||
if (fUnicode)
|
if (fUnicode)
|
||||||
{
|
{
|
||||||
char buf1[260];
|
char buf1[260];
|
||||||
|
@ -253,6 +267,17 @@ static void test_header_control (void)
|
||||||
SendMessageA(hWndHeader, WM_NOTIFYFORMAT, (WPARAM)hHeaderParentWnd, (LPARAM)NF_REQUERY);
|
SendMessageA(hWndHeader, WM_NOTIFYFORMAT, (WPARAM)hHeaderParentWnd, (LPARAM)NF_REQUERY);
|
||||||
setItem(hWndHeader, 3, str_items[4], TRUE);
|
setItem(hWndHeader, 3, str_items[4], TRUE);
|
||||||
|
|
||||||
|
dont_expect_notify(HDN_GETDISPINFOA);
|
||||||
|
dont_expect_notify(HDN_GETDISPINFOW);
|
||||||
|
addItem(hWndHeader, 0, LPSTR_TEXTCALLBACKA);
|
||||||
|
setItem(hWndHeader, 0, str_items[4], TRUE);
|
||||||
|
/* unexpected notifies cleared by notifies_received in setItem */
|
||||||
|
dont_expect_notify(HDN_GETDISPINFOA);
|
||||||
|
dont_expect_notify(HDN_GETDISPINFOW);
|
||||||
|
setItem(hWndHeader, 0, LPSTR_TEXTCALLBACKA, TRUE);
|
||||||
|
/* unexpected notifies cleared by notifies_received in setItem */
|
||||||
|
delItem(hWndHeader, 0);
|
||||||
|
|
||||||
res = delItem(hWndHeader, 5);
|
res = delItem(hWndHeader, 5);
|
||||||
ok(res == 1, "Deleting Out of Range item should fail with 1 (%ld)\n", res);
|
ok(res == 1, "Deleting Out of Range item should fail with 1 (%ld)\n", res);
|
||||||
res = delItem(hWndHeader, -2);
|
res = delItem(hWndHeader, -2);
|
||||||
|
@ -284,6 +309,10 @@ LRESULT CALLBACK HeaderTestWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||||
{
|
{
|
||||||
NMHEADERA *hdr = (NMHEADER *)lParam;
|
NMHEADERA *hdr = (NMHEADER *)lParam;
|
||||||
EXPECTEDNOTIFY *expected;
|
EXPECTEDNOTIFY *expected;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0; i<nUnexpectedNotify; i++)
|
||||||
|
ok(hdr->hdr.code != unexpectedNotify[i], "Received invalid notify %d\n", hdr->hdr.code);
|
||||||
|
|
||||||
if (nReceivedNotify >= nExpectedNotify || hdr->hdr.hwndFrom != hWndHeader )
|
if (nReceivedNotify >= nExpectedNotify || hdr->hdr.hwndFrom != hWndHeader )
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue