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

Alexandre Julliard julliard at winehq.org
Mon Apr 2 13:14:52 CDT 2012


Module: wine
Branch: master
Commit: c52d7acf5464747c1eed521b287e0bec4ef042a8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c52d7acf5464747c1eed521b287e0bec4ef042a8

Author: Daniel Jelinski <djelinski1 at gmail.com>
Date:   Sun Apr  1 00:03:56 2012 +0200

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)




More information about the wine-cvs mailing list