Nikolay Sivov : comctl32/listview: A couple of tests for changing item attributes.
Alexandre Julliard
julliard at winehq.org
Tue May 12 09:08:47 CDT 2009
Module: wine
Branch: master
Commit: bad1dda9ad1f3299e6f7d3b6f4d01bbfe7299d04
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bad1dda9ad1f3299e6f7d3b6f4d01bbfe7299d04
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue May 12 01:16:12 2009 +0400
comctl32/listview: A couple of tests for changing item attributes.
---
dlls/comctl32/tests/listview.c | 62 ++++++++++++++++++++++++++++++++++++++++
dlls/comctl32/tests/msg.h | 3 +-
2 files changed, 64 insertions(+), 1 deletions(-)
diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
index 5987e1e..43eb274 100644
--- a/dlls/comctl32/tests/listview.c
+++ b/dlls/comctl32/tests/listview.c
@@ -168,6 +168,18 @@ static const struct message forward_erasebkgnd_parent_seq[] = {
{ 0 }
};
+static const struct message ownderdata_select_focus_parent_seq[] = {
+ { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
+ { WM_NOTIFY, sent|id, 0, 0, LVN_GETDISPINFOA },
+ { 0 }
+};
+
+static const struct message textcallback_set_again_parent_seq[] = {
+ { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGING },
+ { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
+ { 0 }
+};
+
struct subclass_info
{
WNDPROC oldproc;
@@ -184,6 +196,7 @@ static LRESULT WINAPI parent_wnd_proc(HWND hwnd, UINT message, WPARAM wParam, LP
if (defwndproc_counter) msg.flags |= defwinproc;
msg.wParam = wParam;
msg.lParam = lParam;
+ if (message == WM_NOTIFY && lParam) msg.id = ((NMHDR*)lParam)->code;
/* log system messages, except for painting */
if (message < WM_USER &&
@@ -827,6 +840,26 @@ static void test_items(void)
r = SendMessage(hwnd, LVM_GETITEMA, 0, (LPARAM) &item);
ok(r != 0, "ret %d\n", r);
+ /* set text to callback value already having it */
+ r = SendMessage(hwnd, LVM_DELETEALLITEMS, 0, 0);
+ expect(TRUE, r);
+ memset (&item, 0, sizeof (item));
+ item.mask = LVIF_TEXT;
+ item.pszText = LPSTR_TEXTCALLBACK;
+ item.iItem = 0;
+ r = SendMessage(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item);
+ ok(r == 0, "ret %d\n", r);
+ memset (&item, 0, sizeof (item));
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+ item.pszText = LPSTR_TEXTCALLBACK;
+ r = SendMessage(hwnd, LVM_SETITEMTEXT, 0 , (LPARAM) &item);
+ expect(TRUE, r);
+
+ ok_sequence(sequences, PARENT_SEQ_INDEX, textcallback_set_again_parent_seq,
+ "check callback text comparison rule", TRUE);
+
DestroyWindow(hwnd);
}
@@ -1983,6 +2016,35 @@ static void test_ownerdata(void)
res = SendMessageA(hwnd, LVM_SETITEM, 0, (LPARAM)&item);
expect(FALSE, res);
DestroyWindow(hwnd);
+
+ /* check notifications after focused/selected changed */
+ hwnd = create_listview_control(LVS_OWNERDATA);
+ ok(hwnd != NULL, "failed to create a listview window\n");
+ res = SendMessageA(hwnd, LVM_SETITEMCOUNT, 1, 0);
+ ok(res != 0, "Expected LVM_SETITEMCOUNT to succeed\n");
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+ memset(&item, 0, sizeof(item));
+ item.stateMask = LVIS_SELECTED;
+ item.state = LVIS_SELECTED;
+ res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item);
+ expect(TRUE, res);
+
+ ok_sequence(sequences, PARENT_SEQ_INDEX, ownderdata_select_focus_parent_seq,
+ "ownerdata select notification", TRUE);
+
+ flush_sequences(sequences, NUM_MSG_SEQUENCES);
+
+ memset(&item, 0, sizeof(item));
+ item.stateMask = LVIS_FOCUSED;
+ item.state = LVIS_FOCUSED;
+ res = SendMessageA(hwnd, LVM_SETITEMSTATE, 0, (LPARAM)&item);
+ expect(TRUE, res);
+
+ ok_sequence(sequences, PARENT_SEQ_INDEX, ownderdata_select_focus_parent_seq,
+ "ownerdata focus notification", TRUE);
+ DestroyWindow(hwnd);
}
static void test_norecompute(void)
diff --git a/dlls/comctl32/tests/msg.h b/dlls/comctl32/tests/msg.h
index 2ec3ea1..16ab542 100644
--- a/dlls/comctl32/tests/msg.h
+++ b/dlls/comctl32/tests/msg.h
@@ -47,7 +47,8 @@ struct message
msg_flags_t flags; /* message props */
WPARAM wParam; /* expected value of wParam */
LPARAM lParam; /* expected value of lParam */
- UINT id; /* id of the window */
+ UINT id; /* extra message data: id of the window,
+ notify code etc. */
};
struct msg_sequence
More information about the wine-cvs
mailing list