Daniel Jelinski : comctl32/tests: Treeview shouldn' t modify cChildren if it was explicitly set.

Alexandre Julliard julliard at winehq.org
Thu Jun 7 13:39:19 CDT 2012


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

Author: Daniel Jelinski <djelinski1 at gmail.com>
Date:   Thu Jun  7 14:17:50 2012 +0200

comctl32/tests: Treeview shouldn't modify cChildren if it was explicitly set.

---

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

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index a669df9..5a4fde3 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -1602,6 +1602,55 @@ static void test_delete_items(void)
     DestroyWindow(hTree);
 }
 
+static void test_cchildren(void)
+{
+    HWND hTree;
+    INT ret;
+    TVITEMA item;
+
+    hTree = create_treeview_control(0);
+    fill_tree(hTree);
+
+    ret = SendMessage(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
+    expect(TRUE, ret);
+
+    /* check cChildren - automatic mode */
+    item.hItem = hRoot;
+    item.mask = TVIF_CHILDREN;
+
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    expect(TRUE, ret);
+    expect(0, item.cChildren);
+
+    DestroyWindow(hTree);
+
+    /* start over */
+    hTree = create_treeview_control(0);
+    fill_tree(hTree);
+
+    /* turn off automatic mode by setting cChildren explicitly */
+    item.hItem = hRoot;
+    item.mask = TVIF_CHILDREN;
+
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    expect(TRUE, ret);
+    expect(1, item.cChildren);
+
+    ret = SendMessageA(hTree, TVM_SETITEMA, 0, (LPARAM)&item);
+    expect(TRUE, ret);
+
+    ret = SendMessage(hTree, TVM_DELETEITEM, 0, (LPARAM)hChild);
+    expect(TRUE, ret);
+
+    /* check cChildren */
+    ret = SendMessageA(hTree, TVM_GETITEMA, 0, (LPARAM)&item);
+    expect(TRUE, ret);
+todo_wine
+    expect(1, item.cChildren);
+
+    DestroyWindow(hTree);
+}
+
 struct _ITEM_DATA
 {
     HTREEITEM  parent; /* for root value of parent field is unidetified */
@@ -1908,6 +1957,7 @@ START_TEST(treeview)
     test_TVS_SINGLEEXPAND();
     test_WM_PAINT();
     test_delete_items();
+    test_cchildren();
     test_htreeitem_layout();
     test_TVS_CHECKBOXES();
     test_TVM_GETNEXTITEM();




More information about the wine-cvs mailing list