Nikolay Sivov : comctl32/listview: A couple of LVM_GETITEMPOSITION tests.

Alexandre Julliard julliard at winehq.org
Tue May 26 09:24:54 CDT 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Tue May 26 03:47:45 2009 +0400

comctl32/listview: A couple of LVM_GETITEMPOSITION tests.

---

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

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 13d8fde..1a1ae06 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -185,6 +185,17 @@ static const struct message single_getdispinfo_parent_seq[] = {
     { 0 }
 };
 
+static const struct message getitemposition_seq1[] = {
+    { LVM_GETITEMPOSITION, sent|id, 0, 0, LISTVIEW_ID },
+    { 0 }
+};
+
+static const struct message getitemposition_seq2[] = {
+    { LVM_GETITEMPOSITION, sent|id, 0, 0, LISTVIEW_ID },
+    { HDM_GETITEMRECT, sent|id, 0, 0, HEADER_ID },
+    { 0 }
+};
+
 struct subclass_info
 {
     WNDPROC oldproc;
@@ -2493,6 +2504,66 @@ static void test_getviewrect(void)
     DestroyWindow(hwnd);
 }
 
+static void test_getitemposition(void)
+{
+    HWND hwnd, header;
+    DWORD r;
+    POINT pt;
+    RECT rect;
+
+    hwnd = create_listview_control(0);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+    header = subclass_header(hwnd);
+
+    /* LVS_REPORT, single item, no columns added */
+    insert_item(hwnd, 0);
+
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+    pt.x = pt.y = -1;
+    r = SendMessage(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM)&pt);
+    expect(TRUE, r);
+    ok_sequence(sequences, LISTVIEW_SEQ_INDEX, getitemposition_seq1, "get item position 1", FALSE);
+
+    /* LVS_REPORT, single item, single column */
+    insert_column(hwnd, 0);
+
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+    pt.x = pt.y = -1;
+    r = SendMessage(hwnd, LVM_GETITEMPOSITION, 0, (LPARAM)&pt);
+    expect(TRUE, r);
+    ok_sequence(sequences, LISTVIEW_SEQ_INDEX, getitemposition_seq2, "get item position 2", TRUE);
+
+    memset(&rect, 0, sizeof(rect));
+    SendMessage(header, HDM_GETITEMRECT, 0, (LPARAM)&rect);
+    /* some padding? */
+    todo_wine expect(2, pt.x);
+    /* offset by header height */
+    expect(rect.bottom - rect.top, pt.y);
+
+    DestroyWindow(hwnd);
+}
+
+static void test_columnscreation(void)
+{
+    HWND hwnd, header;
+    DWORD r;
+
+    hwnd = create_listview_control(0);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+
+    insert_item(hwnd, 0);
+
+    /* headers columns aren't created automatically */
+    header = (HWND)SendMessage(hwnd, LVM_GETHEADER, 0, 0);
+    ok(IsWindow(header), "Expected header handle\n");
+    r = SendMessage(header, HDM_GETITEMCOUNT, 0, 0);
+    expect(0, r);
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(listview)
 {
     HMODULE hComctl32;
@@ -2538,6 +2609,8 @@ START_TEST(listview)
     test_setredraw();
     test_hittest();
     test_getviewrect();
+    test_getitemposition();
+    test_columnscreation();
 
     DestroyWindow(hwndparent);
 }




More information about the wine-cvs mailing list