Florian Köberle : comctl32/tests: Test calculating the rect of a child item while handling TVN_ITEMEXPANDED.

Alexandre Julliard julliard at winehq.org
Mon Jun 21 11:07:05 CDT 2010


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

Author: Florian Köberle <florian at fkoeberle.de>
Date:   Sun Jun 20 14:50:00 2010 +0200

comctl32/tests: Test calculating the rect of a child item while handling TVN_ITEMEXPANDED.

---

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

diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
index a0d8e77..320deba 100644
--- a/dlls/comctl32/tests/treeview.c
+++ b/dlls/comctl32/tests/treeview.c
@@ -819,12 +819,15 @@ static void test_get_set_unicodeformat(void)
 
 static TVITEMA g_item_expanding, g_item_expanded;
 static BOOL g_get_from_expand;
+static BOOL g_get_rect_in_expand;
 
 static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
     static LONG defwndproc_counter = 0;
     struct message msg;
     LRESULT ret;
+    RECT rect;
+    HTREEITEM visibleItem;
 
     msg.message = message;
     msg.flags = sent|wparam|lparam;
@@ -907,6 +910,17 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hWnd, UINT message, WPARAM wParam,
                   ret = SendMessageA(pHdr->hwndFrom, TVM_GETITEMA, 0, (LPARAM)&g_item_expanded);
                   ok(ret == TRUE, "got %lu\n", ret);
                 }
+                if (g_get_rect_in_expand) {
+                  visibleItem = TreeView_GetNextItem(pHdr->hwndFrom, NULL, TVGN_FIRSTVISIBLE);
+                  ok(pTreeView->itemNew.hItem == visibleItem, "expanded item == first visible item\n");
+                  *(HTREEITEM*)&rect = visibleItem;
+                  ok(SendMessage(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect), "Failed to get rect for first visible item.\n");
+                  visibleItem = TreeView_GetNextItem(pHdr->hwndFrom, visibleItem, TVGN_NEXTVISIBLE);
+                  *(HTREEITEM*)&rect = visibleItem;
+                  ok(visibleItem != NULL, "There must be a visible item after the first visisble item.\n");
+                  todo_wine
+                  ok(SendMessage(pHdr->hwndFrom, TVM_GETITEMRECT, TRUE, (LPARAM)&rect), "Failed to get rect for second visible item.\n");
+                }
                 break;
             }
         }
@@ -1167,6 +1181,17 @@ static void test_expandnotify(void)
     DestroyWindow(hTree);
 }
 
+static void test_rect_retrieval_after_expand_with_select(void) {
+  BOOL ret;
+  HWND hTree;
+  hTree = create_treeview_control();
+  fill_tree(hTree);
+  g_get_rect_in_expand = TRUE;
+  ret = TreeView_Select(hTree, hChild, TVGN_CARET);
+  g_get_rect_in_expand = FALSE;
+  ok(ret,"TreeView_Select should return true\n");
+}
+
 START_TEST(treeview)
 {
     HMODULE hComctl32;
@@ -1227,6 +1252,7 @@ START_TEST(treeview)
     test_itemedit();
     test_treeview_classinfo();
     test_expandnotify();
+    test_rect_retrieval_after_expand_with_select();
 
     PostMessageA(hMainWnd, WM_CLOSE, 0, 0);
     while(GetMessageA(&msg,0,0,0)) {




More information about the wine-cvs mailing list