Nikolay Sivov : comctl32/tests: Some tests for TVM_GETNEXTITEM and item toggle.

Alexandre Julliard julliard at winehq.org
Fri May 20 12:44:28 CDT 2011


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed May 18 15:14:33 2011 +0400

comctl32/tests: Some tests for TVM_GETNEXTITEM and item toggle.

---

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

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index 0b43e87..0437d65 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1341,6 +1341,12 @@ static void test_expandnotify(void)
        the only way is to reset with all children removed */
     ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "collapse after expand notifications", FALSE);
 
+    /* try to toggle child that doesn't have children itself */
+    flush_sequences(sequences, NUM_MSG_SEQUENCES);
+    ret = SendMessageA(hTree, TVM_EXPAND, TVE_TOGGLE, (LPARAM)hChild);
+    expect(FALSE, ret);
+    ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "toggle node without children", TRUE);
+
     DestroyWindow(hTree);
 
     /* test TVM_GETITEMRECT inside TVN_ITEMEXPANDED notification */
@@ -1350,6 +1356,7 @@ static void test_expandnotify(void)
     ret = TreeView_Select(hTree, hChild, TVGN_CARET);
     g_get_rect_in_expand = FALSE;
     ok(ret, "got %d\n", ret);
+
     DestroyWindow(hTree);
 }
 
@@ -1602,6 +1609,44 @@ static void test_TVS_CHECKBOXES(void)
     DestroyWindow(hTree);
 }
 
+static void test_TVM_GETNEXTITEM(void)
+{
+    HTREEITEM item;
+    HWND hTree;
+
+    hTree = create_treeview_control(0);
+    fill_tree(hTree);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, 0);
+    ok(item == hRoot, "got %p, expected %p\n", item, hRoot);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, (LPARAM)TVI_ROOT);
+    ok(item == hRoot, "got %p, expected %p\n", item, hRoot);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, (LPARAM)hRoot);
+    ok(item == hRoot, "got %p, expected %p\n", item, hRoot);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_ROOT, (LPARAM)hChild);
+    ok(item == hRoot, "got %p, expected %p\n", item, hRoot);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, 0);
+    ok(item == hRoot, "got %p, expected %p\n", item, hRoot);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hRoot);
+    ok(item == hChild, "got %p, expected %p\n", item, hChild);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)TVI_ROOT);
+    ok(item == hRoot, "got %p, expected %p\n", item, hRoot);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_PARENT, 0);
+    ok(item == NULL, "got %p\n", item);
+
+    item = (HTREEITEM)SendMessageA(hTree, TVM_GETNEXTITEM, TVGN_PARENT, (LPARAM)hChild);
+    ok(item == hRoot, "got %p, expected %p\n", item, hRoot);
+
+    DestroyWindow(hTree);
+}
+
 START_TEST(treeview)
 {
     HMODULE hComctl32;
@@ -1672,6 +1717,7 @@ START_TEST(treeview)
     test_delete_items();
     test_htreeitem_layout();
     test_TVS_CHECKBOXES();
+    test_TVM_GETNEXTITEM();
 
     if (!load_v6_module(&ctx_cookie, &hCtx))
     {




More information about the wine-cvs mailing list