2009/4/15 Florian Köberle <florian(a)fkoeberle.de>:
> ---
> Â dlls/comctl32/tests/treeview.c | Â 80 ++++++++++++++++++++++++++++++++++++++++
> Â 1 files changed, 80 insertions(+), 0 deletions(-)
>
> diff --git a/dlls/comctl32/tests/treeview.c b/dlls/comctl32/tests/treeview.c
> index 5f310b5..7d9fcfa 100644
> --- a/dlls/comctl32/tests/treeview.c
> +++ b/dlls/comctl32/tests/treeview.c
> @@ -748,6 +748,84 @@ static LRESULT CALLBACK MyWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
> Â Â return 0L;
> Â }
>
> +static void TestExpandInvisible(void)
> +{
> + Â Â static CHAR nodeRText[] Â = "R",
> + Â Â Â Â Â Â Â Â nodeIText[] Â = "I",
> + Â Â Â Â Â Â Â Â nodeIIText[] = "II",
> + Â Â Â Â Â Â Â Â node1Text[] Â = "1",
> + Â Â Â Â Â Â Â Â node2Text[] Â = "2";
> + Â Â TVINSERTSTRUCTA ins;
> + Â Â HTREEITEM nodeR;
> + Â Â HTREEITEM nodeI;
> + Â Â HTREEITEM nodeII;
> + Â Â HTREEITEM node1;
> + Â Â HTREEITEM node2;
> + Â Â RECT dummyRect;
> + Â Â BOOL nodeIVisible;
> + Â Â BOOL nodeIIVisible;
> + Â Â BOOL node1Visible;
> + Â Â BOOL node2Visible;
> + Â Â HWND window = CreateWindowExA(0, "MyTestWnd", "treeview: TestExpandInvisible", WS_OVERLAPPEDWINDOW,
> + Â Â Â Â CW_USEDEFAULT, CW_USEDEFAULT, 130, 105, NULL, NULL, GetModuleHandleA(NULL), 0);
> +
> + Â Â HWND tree = CreateWindowExA(WS_EX_CLIENTEDGE, WC_TREEVIEWA, NULL, WS_CHILD|WS_VISIBLE|
> + Â Â Â Â TVS_LINESATROOT|TVS_HASLINES|TVS_HASBUTTONS|TVS_EDITLABELS,
> + Â Â Â Â 0, 0, 120, 100, window, (HMENU)100, GetModuleHandleA(0), 0);
> +
> +
> + Â Â ins.hParent = TVI_ROOT;
> + Â Â ins.hInsertAfter = TVI_ROOT;
> + Â Â U(ins).item.mask = TVIF_TEXT;
> + Â Â U(ins).item.pszText = nodeRText;
> + Â Â nodeR = TreeView_InsertItem(tree, &ins);
> + Â Â assert(nodeR);
> +
> + Â Â ins.hInsertAfter = TVI_LAST;
> + Â Â U(ins).item.mask = TVIF_TEXT;
> + Â Â ins.hParent = nodeR;
> +
> + Â Â U(ins).item.pszText = nodeIText;
> + Â Â nodeI = TreeView_InsertItem(tree, &ins);
> + Â Â assert(nodeI);
> + Â Â U(ins).item.pszText = nodeIIText;
> + Â Â nodeII = TreeView_InsertItem(tree, &ins);
> + Â Â assert(nodeII);
> +
> + Â Â ins.hParent = nodeI;
> +
> + Â Â U(ins).item.pszText = node1Text;
> + Â Â node1 = TreeView_InsertItem(tree, &ins);
> + Â Â assert(node1);
> + Â Â U(ins).item.pszText = node2Text;
> + Â Â node2 = TreeView_InsertItem(tree, &ins);
> + Â Â assert(node1);
> +
> + Â Â nodeIVisible = TreeView_GetItemRect(tree, nodeI, &dummyRect, FALSE);
> + Â Â ok(!nodeIVisible, "Node I should not be visible.\n");
> + Â Â node1Visible = TreeView_GetItemRect(tree, node1, &dummyRect, FALSE);
> + Â Â ok(!node1Visible, "Node 1 should not be visible.\n");
> + Â Â node2Visible = TreeView_GetItemRect(tree, node2, &dummyRect, FALSE);
> + Â Â ok(!node2Visible, "Node 2 should not be visible.\n");
> + Â Â nodeIIVisible = TreeView_GetItemRect(tree, nodeII, &dummyRect, FALSE);
> + Â Â ok(!nodeIIVisible, "Node II should not be visible.\n");
> +
> + Â Â ok(TreeView_Expand(tree, nodeI, TVE_EXPAND), "Expand of node I failed.\n");
> +
> + Â Â nodeIVisible = TreeView_GetItemRect(tree, nodeI, &dummyRect, FALSE);
> + Â Â ok(!nodeIVisible, "Node I should not be visible.\n");
> + Â Â node1Visible = TreeView_GetItemRect(tree, node1, &dummyRect, FALSE);
> +todo_wine
> + Â Â ok(!node1Visible, "Node 1 should not be visible.\n");
> + Â Â node2Visible = TreeView_GetItemRect(tree, node2, &dummyRect, FALSE);
> +todo_wine
> + Â Â ok(!node2Visible, "Node 2 should not be visible.\n");
> + Â Â nodeIIVisible = TreeView_GetItemRect(tree, nodeII, &dummyRect, FALSE);
> +todo_wine
> + Â Â ok(!nodeIIVisible, "Node II should not be visible.\n");
> +}
> +
> +
> Â START_TEST(treeview)
> Â {
> Â Â HMODULE hComctl32;
> @@ -819,4 +897,6 @@ START_TEST(treeview)
> Â Â Â Â TranslateMessage(&msg);
> Â Â Â Â DispatchMessageA(&msg);
> Â Â }
> +
> + Â Â TestExpandInvisible();
> Â }
> --
> 1.5.4.3
>
>
>
>
Hi Florian,
I think you should use already created dialog and treeview.
Place your new function just after TestCallback(), clear tree view and
fill it, then just test visibility of expandable items.
--
Nicolas Le Cam