From a709e3f98dc807c2423ce5ea1d39902777f07f33 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 12 May 2014 13:18:36 +0400 Subject: [PATCH] comctl32/treeview: Added a test for NM_RETURN. --- dlls/comctl32/tests/treeview.c | 31 +++++++++++++++++++++++++++++++ dlls/comctl32/treeview.c | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) 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;