Nikolay Sivov : comctl32/listview: Some tests for LVIF_NORECOMPUTE flag.

Alexandre Julliard julliard at winehq.org
Wed Apr 29 10:20:20 CDT 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Tue Apr 28 18:59:25 2009 +0400

comctl32/listview: Some tests for LVIF_NORECOMPUTE flag.

---

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

diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 5d40546..cde7a25 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -158,6 +158,10 @@ static const struct message listview_getorderarray_seq[] = {
     { 0 }
 };
 
+static const struct message empty_seq[] = {
+    { 0 }
+};
+
 struct subclass_info
 {
     WNDPROC oldproc;
@@ -1835,6 +1839,81 @@ static void test_ownerdata(void)
     DestroyWindow(hwnd);
 }
 
+static void test_norecompute(void)
+{
+    static CHAR testA[] = "test";
+    CHAR buff[10];
+    LVITEMA item;
+    HWND hwnd;
+    DWORD res;
+
+    /* self containing control */
+    hwnd = create_listview_control(0);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+    memset(&item, 0, sizeof(item));
+    item.mask = LVIF_TEXT | LVIF_STATE;
+    item.iItem = 0;
+    item.stateMask = LVIS_SELECTED;
+    item.state     = LVIS_SELECTED;
+    item.pszText   = testA;
+    res = SendMessageA(hwnd, LVM_INSERTITEM, 0, (LPARAM)&item);
+    expect(0, res);
+    /* retrieve with LVIF_NORECOMPUTE */
+    item.mask  = LVIF_TEXT | LVIF_NORECOMPUTE;
+    item.iItem = 0;
+    item.pszText    = buff;
+    item.cchTextMax = sizeof(buff)/sizeof(CHAR);
+    res = SendMessageA(hwnd, LVM_GETITEM, 0, (LPARAM)&item);
+    expect(TRUE, res);
+    ok(lstrcmp(buff, testA) == 0, "Expected (%s), got (%s)\n", testA, buff);
+
+    item.mask = LVIF_TEXT;
+    item.iItem = 1;
+    item.pszText = LPSTR_TEXTCALLBACK;
+    res = SendMessageA(hwnd, LVM_INSERTITEM, 0, (LPARAM)&item);
+    expect(1, res);
+
+    item.mask  = LVIF_TEXT | LVIF_NORECOMPUTE;
+    item.iItem = 1;
+    item.pszText    = buff;
+    item.cchTextMax = sizeof(buff)/sizeof(CHAR);
+
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    res = SendMessageA(hwnd, LVM_GETITEM, 0, (LPARAM)&item);
+    expect(TRUE, res);
+todo_wine
+    ok(item.pszText == LPSTR_TEXTCALLBACK, "Expected (%p), got (%p)\n",
+       LPSTR_TEXTCALLBACK, (VOID*)item.pszText);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq", TRUE);
+
+    DestroyWindow(hwnd);
+
+    /* LVS_OWNERDATA */
+    hwnd = create_listview_control(LVS_OWNERDATA);
+    ok(hwnd != NULL, "failed to create a listview window\n");
+
+    item.mask = LVIF_STATE;
+    item.stateMask = LVIS_SELECTED;
+    item.state     = LVIS_SELECTED;
+    item.iItem = 0;
+    res = SendMessageA(hwnd, LVM_INSERTITEM, 0, (LPARAM)&item);
+    expect(0, res);
+
+    item.mask  = LVIF_TEXT | LVIF_NORECOMPUTE;
+    item.iItem = 0;
+    item.pszText    = buff;
+    item.cchTextMax = sizeof(buff)/sizeof(CHAR);
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    res = SendMessageA(hwnd, LVM_GETITEM, 0, (LPARAM)&item);
+    expect(TRUE, res);
+todo_wine
+    ok(item.pszText == LPSTR_TEXTCALLBACK, "Expected (%p), got (%p)\n",
+       LPSTR_TEXTCALLBACK, (VOID*)item.pszText);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "retrieve with LVIF_NORECOMPUTE seq 2", TRUE);
+
+    DestroyWindow(hwnd);
+}
+
 START_TEST(listview)
 {
     HMODULE hComctl32;
@@ -1875,4 +1954,5 @@ START_TEST(listview)
     test_subitem_rect();
     test_sorting();
     test_ownerdata();
+    test_norecompute();
 }




More information about the wine-cvs mailing list