comctl32/listview: Item horizontal position isn't applied for any item bounds on LVS_REPORT.

This commit is contained in:
Nikolay Sivov 2009-05-30 01:43:18 +04:00 committed by Alexandre Julliard
parent d56839f64e
commit 8cf54c5645
2 changed files with 67 additions and 5 deletions

View File

@ -2158,7 +2158,7 @@ calc_label:
}
/************************************************************/
/* compute STATEICON bounding box */
/* compute SELECT bounding box */
/************************************************************/
if (doSelectBox)
{
@ -5928,7 +5928,6 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
BOOL doLabel = TRUE, oversizedBox = FALSE;
POINT Position, Origin;
LVITEMW lvItem;
INT type;
TRACE("(hwnd=%p, nItem=%d, lprc=%p)\n", infoPtr->hwndSelf, nItem, lprc);
@ -5963,7 +5962,6 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
lvItem.state = (oversizedBox ? LVIS_FOCUSED : 0);
}
type = lprc->left;
if (uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT) && lprc->left == LVIR_SELECTBOUNDS)
lprc->left = LVIR_BOUNDS;
switch(lprc->left)
@ -5989,7 +5987,7 @@ static BOOL LISTVIEW_GetItemRect(const LISTVIEW_INFO *infoPtr, INT nItem, LPRECT
return FALSE;
}
if ((uView == LVS_REPORT) && (type == LVIR_BOUNDS))
if (uView == LVS_REPORT)
OffsetRect(lprc, Origin.x, Position.y + Origin.y);
else
OffsetRect(lprc, Position.x + Origin.x, Position.y + Origin.y);

View File

@ -2597,6 +2597,8 @@ static void test_columnscreation(void)
static void test_getitemrect(void)
{
HWND hwnd;
HIMAGELIST himl;
HBITMAP hbm;
RECT rect;
DWORD r;
LVITEMA item;
@ -2650,7 +2652,24 @@ static void test_getitemrect(void)
r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
expect(TRUE, r);
/* padding */
todo_wine expect(2, rect.left);
expect(2, rect.left);
rect.left = LVIR_LABEL;
rect.right = rect.top = rect.bottom = -1;
r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
expect(TRUE, r);
/* padding, column width */
expect(2, rect.left);
expect(50, rect.right);
/* no icons attached */
rect.left = LVIR_ICON;
rect.right = rect.top = rect.bottom = -1;
r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
expect(TRUE, r);
/* padding */
expect(2, rect.left);
expect(2, rect.right);
/* change order */
order[0] = 1; order[1] = 0;
@ -2677,6 +2696,51 @@ static void test_getitemrect(void)
/* column width + padding */
todo_wine expect(102, rect.left);
/* back to initial order */
order[0] = 0; order[1] = 1;
r = SendMessage(hwnd, LVM_SETCOLUMNORDERARRAY, 2, (LPARAM)&order);
expect(TRUE, r);
/* state icons */
himl = ImageList_Create(16, 16, 0, 2, 2);
ok(himl != NULL, "failed to create imagelist\n");
hbm = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbm != NULL, "failed to create bitmap\n");
r = ImageList_Add(himl, hbm, 0);
ok(r == 0, "should be zero\n");
hbm = CreateBitmap(16, 16, 1, 1, NULL);
ok(hbm != NULL, "failed to create bitmap\n");
r = ImageList_Add(himl, hbm, 0);
ok(r == 1, "should be one\n");
r = SendMessage(hwnd, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)himl);
ok(r == 0, "should return zero\n");
item.mask = LVIF_STATE;
item.state = INDEXTOSTATEIMAGEMASK(1);
item.stateMask = LVIS_STATEIMAGEMASK;
item.iItem = 0;
item.iSubItem = 0;
r = SendMessage(hwnd, LVM_SETITEM, 0, (LPARAM)&item);
expect(TRUE, r);
/* icon bounds */
rect.left = LVIR_ICON;
rect.right = rect.top = rect.bottom = -1;
r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
expect(TRUE, r);
/* padding + stateicon width */
expect(18, rect.left);
expect(18, rect.right);
/* label bounds */
rect.left = LVIR_LABEL;
rect.right = rect.top = rect.bottom = -1;
r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
expect(TRUE, r);
/* padding + stateicon width -> column width */
expect(18, rect.left);
expect(50, rect.right);
DestroyWindow(hwnd);
}