comctl32/tests: Fix wrong use of HDM_GETITEM when getting item text.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-04-16 11:36:08 +03:00 committed by Alexandre Julliard
parent 7f9a3a9af1
commit 025508f755
1 changed files with 16 additions and 14 deletions

View File

@ -1078,10 +1078,7 @@ static void test_hdm_bitmapmarginMessages(HWND hParent)
static void test_hdm_index_messages(HWND hParent)
{
HWND hChild;
int retVal;
int loopcnt;
int strcmpResult;
int iSize;
int retVal, i, iSize;
static const int lpiarray[2] = {1, 0};
static int lpiarrayReceived[2];
static char firstHeaderItem[] = "Name";
@ -1091,10 +1088,7 @@ static void test_hdm_index_messages(HWND hParent)
static char *items[] = {firstHeaderItem, secondHeaderItem, thirdHeaderItem, fourthHeaderItem};
RECT rect;
HDITEMA hdItem;
hdItem.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
hdItem.fmt = HDF_LEFT;
hdItem.cxy = 80;
hdItem.cchTextMax = 260;
char buffA[32];
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, FALSE);
@ -1105,11 +1099,15 @@ static void test_hdm_index_messages(HWND hParent)
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", FALSE);
flush_sequences(sequences, NUM_MSG_SEQUENCES);
for ( loopcnt = 0 ; loopcnt < 4 ; loopcnt++ )
for (i = 0; i < sizeof(items)/sizeof(items[0]); i++)
{
hdItem.pszText = items[loopcnt];
retVal = SendMessageA(hChild, HDM_INSERTITEMA, loopcnt, (LPARAM) &hdItem);
ok(retVal == loopcnt, "Adding item %d failed with return value %d\n", ( loopcnt + 1 ), retVal);
hdItem.mask = HDI_TEXT | HDI_WIDTH | HDI_FORMAT;
hdItem.pszText = items[i];
hdItem.fmt = HDF_LEFT;
hdItem.cxy = 80;
retVal = SendMessageA(hChild, HDM_INSERTITEMA, i, (LPARAM) &hdItem);
ok(retVal == i, "Adding item %d failed with return value %d\n", i, retVal);
}
ok_sequence(sequences, HEADER_SEQ_INDEX, insertItem_seq, "insertItem sequence testing", FALSE);
@ -1135,17 +1133,21 @@ static void test_hdm_index_messages(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hdItem.mask = HDI_WIDTH;
retVal = SendMessageA(hChild, HDM_GETITEMA, 3, (LPARAM) &hdItem);
ok(retVal == FALSE, "Getting already-deleted item should return FALSE, got %d\n", retVal);
hdItem.mask = HDI_TEXT | HDI_WIDTH;
hdItem.pszText = buffA;
hdItem.cchTextMax = sizeof(buffA)/sizeof(buffA[0]);
retVal = SendMessageA(hChild, HDM_GETITEMA, 0, (LPARAM) &hdItem);
ok(retVal == TRUE, "Getting the 1st header item should return TRUE, got %d\n", retVal);
ok_sequence(sequences, HEADER_SEQ_INDEX, getItem_seq, "getItem sequence testing", FALSE);
/* check if the item is the right one */
strcmpResult = strcmp(hdItem.pszText, firstHeaderItem);
expect(0, strcmpResult);
ok(!strcmp(hdItem.pszText, firstHeaderItem), "got wrong item %s, expected %s\n",
hdItem.pszText, firstHeaderItem);
expect(80, hdItem.cxy);
iSize = SendMessageA(hChild, HDM_GETITEMCOUNT, 0, 0);