diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c index cd619a9d98c..3b70e6c7e26 100644 --- a/dlls/comctl32/tests/treeview.c +++ b/dlls/comctl32/tests/treeview.c @@ -252,6 +252,13 @@ static const struct message parent_cd_seq[] = { { 0 } }; +static const struct message parent_vk_return_seq[] = { + { WM_NOTIFY, sent|id, 0, 0, TVN_KEYDOWN }, + { WM_NOTIFY, sent|id, 0, 0, NM_RETURN }, + { WM_CHANGEUISTATE, sent|optional }, + { 0 } +}; + static HWND hMainWnd; static HTREEITEM hRoot, hChild; @@ -2126,6 +2133,29 @@ static void test_customdraw(void) DestroyWindow(hwnd); } +static void test_WM_KEYDOWN(void) +{ + static const char *rootA = "root"; + TVINSERTSTRUCTA ins; + HTREEITEM hRoot; + HWND hwnd; + + hwnd = create_treeview_control(0); + + ins.hParent = TVI_ROOT; + ins.hInsertAfter = TVI_ROOT; + U(ins).item.mask = TVIF_TEXT; + U(ins).item.pszText = (char*)rootA; + hRoot = TreeView_InsertItemA(hwnd, &ins); + ok(hRoot != NULL, "got %p\n", hRoot); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + SendMessageA(hwnd, WM_KEYDOWN, VK_RETURN, 0); + ok_sequence(sequences, PARENT_SEQ_INDEX, parent_vk_return_seq, "WM_KEYDOWN/VK_RETURN parent notification", TRUE); + + DestroyWindow(hwnd); +} + START_TEST(treeview) { HMODULE hComctl32; @@ -2200,6 +2230,7 @@ START_TEST(treeview) test_TVM_HITTEST(); test_WM_GETDLGCODE(); test_customdraw(); + test_WM_KEYDOWN(); if (!load_v6_module(&ctx_cookie, &hCtx)) { diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index bb42b21a114..6dd7e93a6d3 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -5261,7 +5261,7 @@ TREEVIEW_KeyDown(TREEVIEW_INFO *infoPtr, WPARAM wParam) case VK_RETURN: TREEVIEW_SendSimpleNotify(infoPtr, NM_RETURN); - break; + break; case VK_HOME: newSelection = infoPtr->root->firstChild;