comctl32/tests: Added test for treeview expand notifications on keyboard events

Daniel Jelinski djelinski1 at gmail.com
Sat Mar 31 17:19:02 CDT 2012


Current Wine implementation incorrectly sends TVN_ITEMEXPANDING
notification when an item with no children is selected and + (VK_ADD)
is pressed.
Tested on Linux with builtin and native comctl32. Not tested on Windows.
-------------- next part --------------
From 8d2a6c5cde1cd68cc5111167fa1296531f6fcb81 Mon Sep 17 00:00:00 2001
From: Daniel Jelinski <djelinski1 at gmail.com>
Date: Sun, 1 Apr 2012 00:03:56 +0200
Subject: comctl32/tests: Added test for treeview expand notifications on
 keyboard events

---
 dlls/comctl32/tests/treeview.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 8c0ec93..61a3ce6 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -204,6 +204,20 @@ static const struct message parent_expand_seq[] = {
     { 0 }
 };
 
+static const struct message parent_expand_kb_seq[] = {
+    { WM_NOTIFY, sent|id|optional, 0, 0, TVN_KEYDOWN },
+    { WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDINGA },
+    { WM_NOTIFY, sent|id, 0, 0, TVN_ITEMEXPANDEDA },
+    { WM_CHANGEUISTATE, sent|optional },
+    { 0 }
+};
+
+static const struct message parent_expand_empty_kb_seq[] = {
+    { WM_NOTIFY, sent|id|optional, 0, 0, TVN_KEYDOWN },
+    { WM_CHANGEUISTATE, sent|optional },
+    { 0 }
+};
+
 static const struct message parent_singleexpand_seq[] = {
     { WM_NOTIFY, sent|id, 0, 0, TVN_SELCHANGINGA },
     { WM_NOTIFY, sent|id, 0, 0, TVN_SELCHANGEDA },
@@ -1423,6 +1437,31 @@ static void test_expandnotify(void)
     ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "toggle node (collapse)", FALSE);
 
     DestroyWindow(hTree);
+
+    /* some keyboard events are also translated to expand */
+    hTree = create_treeview_control(0);
+    fill_tree(hTree);
+
+    /* preselect root node here */
+    ret = SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hRoot);
+    expect(TRUE, ret);
+
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    ret = SendMessageA(hTree, WM_KEYDOWN, VK_ADD, 0);
+    expect(FALSE, ret);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_kb_seq, "expand node", FALSE);
+
+    /* go to child */
+    ret = SendMessageA(hTree, WM_KEYDOWN, VK_RIGHT, 0);
+    expect(FALSE, ret);
+
+    /* try to expand child that doesn't have children itself */
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    ret = SendMessageA(hTree, WM_KEYDOWN, VK_ADD, 0);
+    expect(FALSE, ret);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, parent_expand_empty_kb_seq, "expand node with no children", TRUE);
+
+    DestroyWindow(hTree);
 }
 
 static void test_expandedimage(void)
-- 
1.7.5.4


More information about the wine-patches mailing list