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

Alexandre Julliard julliard at winehq.org
Mon Jun 1 10:01:02 CDT 2009


Module: wine
Branch: master
Commit: 8cf54c5645bdbd9991de3f4b87f9bced0dfde69e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8cf54c5645bdbd9991de3f4b87f9bced0dfde69e

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Sat May 30 01:43:18 2009 +0400

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

---

 dlls/comctl32/listview.c       |    6 +--
 dlls/comctl32/tests/listview.c |   66 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 1c84f02..7c1aee2 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -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);
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 217c2ee..b6a44c8 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -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);
 }
 




More information about the wine-cvs mailing list