Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com ---
This gets sent from all buttons when using arrow keys (since there's no dropdown to click unless it's a split button).
dlls/comctl32/tests/button.c | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index abbee64..4c83d6c 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -186,6 +186,7 @@ static LRESULT WINAPI test_parent_wndproc(HWND hwnd, UINT message, WPARAM wParam static HDC cd_first_hdc; struct message msg = { 0 }; NMCUSTOMDRAW *cd = (NMCUSTOMDRAW*)lParam; + NMBCDROPDOWN *bcd = (NMBCDROPDOWN*)lParam; LRESULT ret;
if (ignore_message( message )) return 0; @@ -252,6 +253,29 @@ static LRESULT WINAPI test_parent_wndproc(HWND hwnd, UINT message, WPARAM wParam return ret; }
+ if (message == WM_NOTIFY && bcd->hdr.code == BCN_DROPDOWN) + { + UINT button = GetWindowLongW(bcd->hdr.hwndFrom, GWL_STYLE) & BS_TYPEMASK; + RECT rc; + + GetClientRect(bcd->hdr.hwndFrom, &rc); + + ok(bcd->hdr.hwndFrom != NULL, "Received BCN_DROPDOWN with no hwnd attached, wParam %lu id %lu\n", + wParam, bcd->hdr.idFrom); + ok(bcd->hdr.idFrom == wParam, "[%u] Mismatch between wParam (%lu) and idFrom (%lu)\n", + button, wParam, bcd->hdr.idFrom); + ok(EqualRect(&rc, &bcd->rcButton), "[%u] Wrong rcButton, expected %s got %s\n", + button, wine_dbgstr_rect(&rc), wine_dbgstr_rect(&bcd->rcButton)); + + msg.message = message; + msg.flags = sent|parent|wparam|lparam|id; + msg.wParam = wParam; + msg.lParam = lParam; + msg.id = BCN_DROPDOWN; + add_message(sequences, COMBINED_SEQ_INDEX, &msg); + return 0; + } + if (message == WM_PAINT) { PAINTSTRUCT ps; @@ -569,6 +593,18 @@ static const struct message pre_post_pre_post_cd_seq[] = { 0 } };
+static const struct message bcn_dropdown_seq[] = +{ + { WM_KEYDOWN, sent|wparam|lparam, VK_DOWN, 0 }, + { BCM_SETDROPDOWNSTATE, sent|wparam|lparam|defwinproc, 1, 0 }, + { WM_NOTIFY, sent|parent|id, 0, 0, BCN_DROPDOWN }, + { BCM_SETDROPDOWNSTATE, sent|wparam|lparam|defwinproc, 0, 0 }, + { WM_KEYUP, sent|wparam|lparam, VK_DOWN, 0xc0000000 }, + { WM_PAINT, sent }, + { WM_DRAWITEM, sent|parent|optional }, /* for owner draw button */ + { 0 } +}; + static HWND create_button(DWORD style, HWND parent) { HMENU menuid = 0; @@ -932,6 +968,17 @@ static void test_button_messages(void) }
disable_test_cd(); + + if (!broken(LOBYTE(LOWORD(GetVersion())) < 6)) /* not available pre-Vista */ + { + /* Send down arrow key to make the buttons send the drop down notification */ + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageW(hwnd, WM_KEYDOWN, VK_DOWN, 0); + SendMessageW(hwnd, WM_KEYUP, VK_DOWN, 0xc0000000); + while (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE)) DispatchMessageA(&msg); + ok_sequence(sequences, COMBINED_SEQ_INDEX, bcn_dropdown_seq, "BCN_DROPDOWN from the button", FALSE); + } + DestroyWindow(hwnd); }