Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/user32/tests/msg.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 1c3b639aa0..0df9687ae2 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -2243,18 +2243,61 @@ static void add_message_(int line, const struct recvd_message *msg) { MEASURE_ITEM_STRUCT mi; MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)msg->lParam; + BOOL is_unicode_data = TRUE;
sprintf( seq->output, "%s: %p WM_MEASUREITEM: CtlType %#x, CtlID %#x, itemID %#x, itemData %#lx", msg->descr, msg->hwnd, mis->CtlType, mis->CtlID, mis->itemID, mis->itemData);
+ if (mis->CtlType == ODT_LISTBOX) + { + HWND ctrl = GetDlgItem(msg->hwnd, mis->CtlID); + is_unicode_data = GetWindowLongA(ctrl, GWL_STYLE) & LBS_HASSTRINGS; + } + mi.u.wp = 0; mi.u.item.CtlType = mis->CtlType; mi.u.item.CtlID = mis->CtlID; mi.u.item.itemID = mis->itemID; mi.u.item.wParam = msg->wParam; seq->wParam = mi.u.wp; - seq->lParam = mis->itemData ? hash_Ly_W((const WCHAR *)mis->itemData) : 0; + if (is_unicode_data) + seq->lParam = mis->itemData ? hash_Ly_W((const WCHAR *)mis->itemData) : 0; + else + seq->lParam = mis->itemData ? hash_Ly((const char *)mis->itemData) : 0; + break; + } + + case WM_COMPAREITEM: + { + COMPAREITEMSTRUCT *cis = (COMPAREITEMSTRUCT *)msg->lParam; + HWND ctrl = GetDlgItem(msg->hwnd, cis->CtlID); + BOOL is_unicode_data = TRUE; + + ok(msg->wParam == cis->CtlID, "expected %#x, got %#lx\n", cis->CtlID, msg->wParam); + ok(cis->hwndItem == ctrl, "expected %p, got %p\n", ctrl, cis->hwndItem); +todo_wine + ok((int)cis->itemID1 >= 0, "expected >= 0, got %d\n", cis->itemID1); +todo_wine + ok((int)cis->itemID2 == -1, "expected -1, got %d\n", cis->itemID2); + + sprintf( seq->output, "%s: %p WM_COMPAREITEM: CtlType %#x, CtlID %#x, itemID1 %#x, itemData1 %#lx, itemID2 %#x, itemData2 %#lx", + msg->descr, msg->hwnd, cis->CtlType, cis->CtlID, + cis->itemID1, cis->itemData1, cis->itemID2, cis->itemData2); + + if (cis->CtlType == ODT_LISTBOX) + is_unicode_data = GetWindowLongA(ctrl, GWL_STYLE) & LBS_HASSTRINGS; + + if (is_unicode_data) + { + seq->wParam = cis->itemData1 ? hash_Ly_W((const WCHAR *)cis->itemData1) : 0; + seq->lParam = cis->itemData2 ? hash_Ly_W((const WCHAR *)cis->itemData2) : 0; + } + else + { + seq->wParam = cis->itemData1 ? hash_Ly((const char *)cis->itemData1) : 0; + seq->lParam = cis->itemData2 ? hash_Ly((const char *)cis->itemData2) : 0; + } break; }
@@ -9044,7 +9087,7 @@ static LRESULT WINAPI ParentMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam message == WM_PARENTNOTIFY || message == WM_CANCELMODE || message == WM_SETFOCUS || message == WM_KILLFOCUS || message == WM_ENABLE || message == WM_ENTERIDLE || - message == WM_DRAWITEM || message == WM_MEASUREITEM || + message == WM_DRAWITEM || message == WM_MEASUREITEM || message == WM_COMPAREITEM || message == WM_COMMAND || message == WM_IME_SETCONTEXT) { switch (message) @@ -9092,7 +9135,7 @@ static LRESULT WINAPI ParentMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam ret = DefWindowProcA(hwnd, message, wParam, lParam); defwndproc_counter--;
- return ret; + return message == WM_COMPAREITEM ? -1 : ret; }
static INT_PTR CALLBACK StopQuitMsgCheckProcA(HWND hwnd, UINT message, WPARAM wp, LPARAM lp) @@ -14159,6 +14202,19 @@ static const struct message wm_lb_addstring[] = { WM_MEASUREITEM, sent|wparam|lparam|parent, 0xf2f2, 0xf30604ef }, { 0 } }; +static const struct message wm_lb_addstring_sort[] = +{ + { LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ed }, + { WM_MEASUREITEM, sent|wparam|lparam|parent, 0xf0f2, 0xf30604ed }, + { LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ee }, + { WM_COMPAREITEM, sent|wparam|lparam|parent, 0xf30604ed, 0xf30604ee }, + { WM_MEASUREITEM, sent|wparam|lparam|parent, 0xf1f2, 0xf30604ee }, + { LB_ADDSTRING, sent|wparam|lparam, 0, 0xf30604ef }, + { WM_COMPAREITEM, sent|wparam|lparam|parent, 0xf30604ed, 0xf30604ef }, + { WM_COMPAREITEM, sent|wparam|lparam|parent, 0xf30604ee, 0xf30604ef }, + { WM_MEASUREITEM, sent|wparam|lparam|parent, 0xf2f2, 0xf30604ef }, + { 0 } +};
#define check_lb_state(a1, a2, a3, a4, a5) check_lb_state_dbg(a1, a2, a3, a4, a5, __LINE__)
@@ -14224,6 +14280,7 @@ static void test_listbox_messages(void)
parent = CreateWindowExA(0, "TestParentClass", NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 100, 100, 200, 200, 0, 0, 0, NULL); + /* with LBS_HASSTRINGS */ listbox = CreateWindowExA(WS_EX_NOPARENTNOTIFY, "ListBox", NULL, WS_CHILD | LBS_NOTIFY | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | WS_VISIBLE, 10, 10, 80, 80, parent, (HMENU)ID_LISTBOX, 0, NULL); @@ -14304,6 +14361,34 @@ static void test_listbox_messages(void)
log_all_parent_messages--;
+ DestroyWindow(listbox); + + /* with LBS_SORT and without LBS_HASSTRINGS */ + listbox = CreateWindowExA(WS_EX_NOPARENTNOTIFY, "ListBox", NULL, + WS_CHILD | LBS_NOTIFY | LBS_OWNERDRAWVARIABLE | LBS_SORT | WS_VISIBLE, + 10, 10, 80, 80, parent, (HMENU)ID_LISTBOX, 0, NULL); + listbox_orig_proc = (WNDPROC)SetWindowLongPtrA(listbox, GWLP_WNDPROC, (ULONG_PTR)listbox_hook_proc); + + check_lb_state(listbox, 0, LB_ERR, 0, 0); + + flush_sequence(); + + log_all_parent_messages++; + + ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0"); + ok(ret == 0, "expected 0, got %ld\n", ret); + ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1"); +todo_wine + ok(ret == 1, "expected 1, got %ld\n", ret); + ret = SendMessageA(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2"); +todo_wine + ok(ret == 2, "expected 2, got %ld\n", ret); + + ok_sequence(wm_lb_addstring_sort, "LB_ADDSTRING", TRUE); + check_lb_state(listbox, 3, LB_ERR, 0, 0); + + log_all_parent_messages--; + DestroyWindow(listbox); DestroyWindow(parent); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=39441
Your paranoid android.
=== wvistau64_zh_CN (32 bit msg) === msg.c:5182: Test failed: ShowWindow(SW_RESTORE):overlapped: 18: the msg sequence is not complete: expected 0000 - actual 0088