Nikolay Sivov : comctl32/listview: Some LVM_GETITEMRECT tests.

Alexandre Julliard julliard at winehq.org
Wed May 27 09:26:50 CDT 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Tue May 26 20:28:39 2009 +0400

comctl32/listview: Some LVM_GETITEMRECT tests.

---

 dlls/comctl32/tests/listview.c |   90 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 47477a4..fdf3a3d 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -2564,6 +2564,95 @@ static void test_columnscreation(void)
     DestroyWindow(hwnd);
 }
 
+static void test_getitemrect(void)
+{
+    HWND hwnd;
+    RECT rect;
+    DWORD r;
+    LVITEMA item;
+    LVCOLUMNA col;
+    INT order[2];
+    POINT pt;
+
+    hwnd = create_listview_control(0);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+
+    /* empty item */
+    memset(&item, 0, sizeof(item));
+    item.iItem = 0;
+    item.iSubItem = 0;
+    r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM)&item);
+    expect(0, r);
+
+    rect.left = LVIR_BOUNDS;
+    rect.right = rect.top = rect.bottom = -1;
+    r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+    expect(TRUE, r);
+
+    /* zero width rectangle */
+todo_wine {
+    expect(0, rect.left);
+    expect(0, rect.right);
+}
+
+    insert_column(hwnd, 0);
+    insert_column(hwnd, 1);
+
+    col.mask = LVCF_WIDTH;
+    col.cx   = 50;
+    r = SendMessage(hwnd, LVM_SETCOLUMN, 0, (LPARAM)&col);
+    expect(TRUE, r);
+
+    col.mask = LVCF_WIDTH;
+    col.cx   = 100;
+    r = SendMessage(hwnd, LVM_SETCOLUMN, 1, (LPARAM)&col);
+    expect(TRUE, r);
+
+    rect.left = LVIR_BOUNDS;
+    rect.right = rect.top = rect.bottom = -1;
+    r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+    expect(TRUE, r);
+
+    /* still no left padding */
+todo_wine {
+    expect(0, rect.left);
+}
+
+    rect.left = LVIR_SELECTBOUNDS;
+    rect.right = rect.top = rect.bottom = -1;
+    r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+    expect(TRUE, r);
+    /* padding */
+    todo_wine expect(2, rect.left);
+
+    /* change order */
+    order[0] = 1; order[1] = 0;
+    r = SendMessage(hwnd, LVM_SETCOLUMNORDERARRAY, 2, (LPARAM)&order);
+    expect(TRUE, r);
+    pt.x = -1;
+    r = SendMessage(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM)&pt);
+    expect(TRUE, r);
+    /* 1 indexed column width + padding */
+    todo_wine expect(102, pt.x);
+    /* rect is at zero too */
+    rect.left = LVIR_BOUNDS;
+    rect.right = rect.top = rect.bottom = -1;
+    r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+    expect(TRUE, r);
+    todo_wine expect(0, rect.left);
+    /* just width sum */
+    todo_wine expect(150, rect.right);
+
+    rect.left = LVIR_SELECTBOUNDS;
+    rect.right = rect.top = rect.bottom = -1;
+    r = SendMessage(hwnd, LVM_GETITEMRECT, 0, (LPARAM)&rect);
+    expect(TRUE, r);
+    /* column width + padding */
+    todo_wine expect(102, rect.left);
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(listview)
 {
     HMODULE hComctl32;
@@ -2601,6 +2690,7 @@ START_TEST(listview)
     test_columns();
     test_getorigin();
     test_multiselect();
+    test_getitemrect();
     test_subitem_rect();
     test_sorting();
     test_ownerdata();




More information about the wine-cvs mailing list