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